From 996ceffb64c9500cfaefdadc01acce4d7b1d261e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 22 Apr 2021 00:03:27 +0200 Subject: [PATCH] Prevent changing the company when party is set As many fields are set using party which depends on the company context, the company can not be changed once they are set. issue10289 review332591002 --- invoice.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/invoice.py b/invoice.py index 1a39b62372..a2e4003ce0 100644 --- a/invoice.py +++ b/invoice.py @@ -50,8 +50,11 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin): _depends = ['state'] company = fields.Many2One( - 'company.company', "Company", required=True, select=True, - states=_states, depends=_depends) + 'company.company', 'Company', required=True, select=True, + states={ + 'readonly': _states['readonly'] | Eval('party', True), + }, + depends=_depends + ['party']) company_party = fields.Function( fields.Many2One( 'party.party', "Company Party",