From bc31ea4fbd1494a468403caccbba5e5d16320c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 11 Sep 2022 01:27:48 +0200 Subject: [PATCH] Update currency when company is changed issue11679 --- opportunity.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opportunity.py b/opportunity.py index 2d517dc295..aadcc7e4f4 100644 --- a/opportunity.py +++ b/opportunity.py @@ -256,10 +256,13 @@ class SaleOpportunity( def default_company(): return Transaction().context.get('company') - @fields.depends('company') + @fields.depends('amount', 'company') def on_change_company(self): self.payment_term = self.default_payment_term( company=self.company.id if self.company else None) + if not self.amount: + self.currency = self.default_currency( + company=self.company.id if self.company else None) @classmethod def default_currency(cls, **pattern):