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
This commit is contained in:
Cédric Krier committed 2021-04-22 00:03:27 +02:00
1 parent f84a891925
commit 996ceffb64
1 file changed
+5 -2
+5 -2
View File
@@ -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",