[FIX] cant choose template
This commit is contained in:
parent
94c50928ec
commit
06864fe013
@ -15,6 +15,9 @@ class ContractWizard(models.TransientModel):
|
|||||||
model=self.active_model, target_id=int(self.env.context.get("self_id"))
|
model=self.active_model, target_id=int(self.env.context.get("self_id"))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def _default_document_template(self):
|
||||||
|
return self.env["res.partner.document.template"].search(self._get_template_domain(), limit=1)
|
||||||
|
|
||||||
target = fields.Reference(
|
target = fields.Reference(
|
||||||
selection=[
|
selection=[
|
||||||
("res.partner.contract", "Contract"),
|
("res.partner.contract", "Contract"),
|
||||||
@ -35,7 +38,7 @@ class ContractWizard(models.TransientModel):
|
|||||||
document_template = fields.Many2one(
|
document_template = fields.Many2one(
|
||||||
"res.partner.document.template",
|
"res.partner.document.template",
|
||||||
string="Document Template",
|
string="Document Template",
|
||||||
compute="_compute_document_template",
|
default=_default_document_template,
|
||||||
readonly=False,
|
readonly=False,
|
||||||
)
|
)
|
||||||
transient_field_ids = fields.One2many(
|
transient_field_ids = fields.One2many(
|
||||||
@ -63,10 +66,6 @@ class ContractWizard(models.TransientModel):
|
|||||||
self.document_template
|
self.document_template
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.depends('target')
|
|
||||||
def _compute_document_template(self):
|
|
||||||
self.document_template = self.env["res.partner.document.template"].search(self._get_template_domain(), limit=1)
|
|
||||||
|
|
||||||
@api.constrains("document_template")
|
@api.constrains("document_template")
|
||||||
def _check_document_template(self):
|
def _check_document_template(self):
|
||||||
if not self.document_template:
|
if not self.document_template:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user