changeset 0a4fd3b4c04a in modules/sale_opportunity:default
details: 
https://hg.tryton.org/modules/sale_opportunity?cmd=changeset&node=0a4fd3b4c04a
description:
        Update currency when company is changed

        issue11679
diffstat:

 opportunity.py |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (18 lines):

diff -r 52318bf4d650 -r 0a4fd3b4c04a opportunity.py
--- a/opportunity.py    Sun Sep 11 01:21:17 2022 +0200
+++ b/opportunity.py    Sun Sep 11 01:27:48 2022 +0200
@@ -256,10 +256,13 @@
     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):

Reply via email to