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:28 +02:00
1 parent 58fab6157a
commit 14bb7731be
1 file changed
+5 -1
+5 -1
View File
@@ -77,7 +77,11 @@ class Purchase(
company = fields.Many2One(
'company.company', "Company", required=True, select=True,
states={
'readonly': (Eval('state') != 'draft') | Eval('lines', [0]),
'readonly': (
(Eval('state') != 'draft')
| Eval('lines', [0])
| Eval('party', True)
| Eval('invoice_party', True)),
},
depends=['state'])
number = fields.Char('Number', size=None, readonly=True, select=True)