From 14bb7731be530e6ff3c453cff622e8765a23dc23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 22 Apr 2021 00:03:28 +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 --- purchase.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/purchase.py b/purchase.py index b12569a79f..ea34100eb5 100644 --- a/purchase.py +++ b/purchase.py @@ -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)