From d58a5bdb2a5f996848e7af8ced73a3c372b807a2 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Tue, 26 Nov 2019 09:54:55 +0100 Subject: [PATCH] [12.0][FIX] - Run onchange contract_type when changing the contract template Fix this use-case: If the contract journal is not set on the contract template the contract is created without a journal when confirming the sale order --- contract/models/contract.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contract/models/contract.py b/contract/models/contract.py index 481a64c9a..85272ae2b 100644 --- a/contract/models/contract.py +++ b/contract/models/contract.py @@ -209,7 +209,8 @@ class ContractContract(models.Model): field.name in self.NO_SYNC, ) ): - self[field_name] = self.contract_template_id[field_name] + if self.contract_template_id[field_name]: + self[field_name] = self.contract_template_id[field_name] @api.onchange('partner_id') def _onchange_partner_id(self):