changeset 457954e02feb in modules/currency:default
details: https://hg.tryton.org/modules/currency?cmd=changeset&node=457954e02feb
description:
        Send only the required fields when fetching a readonly view definition

        issue11134
        review380081002
diffstat:

 currency.py |  8 +++-----
 fields.py   |  8 ++++----
 2 files changed, 7 insertions(+), 9 deletions(-)

diffs (50 lines):

diff -r f4fa211f161d -r 457954e02feb currency.py
--- a/currency.py       Wed Apr 06 23:37:42 2022 +0200
+++ b/currency.py       Fri Apr 08 19:07:13 2022 +0200
@@ -47,7 +47,7 @@
     rates = fields.One2Many('currency.currency.rate', 'currency', 'Rates',
         help="Add floating exchange rates for the currency.")
     rounding = fields.Numeric('Rounding factor', required=True,
-        digits=(12, Eval('digits', 6)), depends=['digits'],
+        digits=(12, Eval('digits', 6)),
         help="The minimum amount which can be represented in this currency.")
     digits = fields.Integer("Digits", required=True,
         help="The number of digits to display after the decimal separator.")
@@ -312,8 +312,7 @@
         states={
             'required': Eval('frequency') == 'weekly',
             'invisible': Eval('frequency') != 'weekly',
-            },
-        depends=['frequency'])
+            })
     day = fields.Integer(
         "Day of Month",
         domain=[If(Eval('frequency') == 'monthly',
@@ -323,8 +322,7 @@
         states={
             'required': Eval('frequency') == 'monthly',
             'invisible': Eval('frequency') != 'monthly',
-            },
-        depends=['frequency'])
+            })
     currency = fields.Many2One(
         'currency.currency', "Currency", required=True,
         help="The base currency to fetch rate.")
diff -r f4fa211f161d -r 457954e02feb fields.py
--- a/fields.py Wed Apr 06 23:37:42 2022 +0200
+++ b/fields.py Fri Apr 08 19:07:13 2022 +0200
@@ -19,10 +19,10 @@
         '''
         if currency:
             if depends is None:
-                depends = [currency]
-            elif currency not in depends:
-                depends = depends.copy()
-                depends.append(currency)
+                depends = set()
+            else:
+                depends = set(depends)
+            depends.add(currency)
         super().__init__(string=string, digits=digits, help=help,
             required=required, readonly=readonly, domain=domain, states=states,
             select=select, on_change=on_change, on_change_with=on_change_with,

Reply via email to