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

        issue11134
        review380081002
diffstat:

 product.py |  16 ++++------------
 uom.py     |   1 -
 2 files changed, 4 insertions(+), 13 deletions(-)

diffs (98 lines):

diff -r 5a9354b2ed88 -r b0e8f1a28f68 product.py
--- a/product.py        Wed Apr 06 23:37:43 2022 +0200
+++ b/product.py        Fri Apr 08 19:07:13 2022 +0200
@@ -63,14 +63,12 @@
         "Code", select=True,
         states={
             'readonly': Eval('code_readonly', False),
-            },
-        depends=['code_readonly'])
+            })
     type = fields.Selection(TYPES, "Type", required=True)
     consumable = fields.Boolean('Consumable',
         states={
             'invisible': Eval('type', 'goods') != 'goods',
             },
-        depends=['type'],
         help="Check to allow stock moves to be assigned "
         "regardless of stock level.")
     list_price = fields.MultiValue(fields.Numeric(
@@ -114,7 +112,6 @@
         domain=[
             If(~Eval('active'), ('active', '=', False), ()),
             ],
-        depends=['active'],
         help="The different variants the product comes in.")
 
     @classmethod
@@ -138,7 +135,6 @@
         cls.cost_price_method.domain = [
             Get(types_cost_method, Eval('type'), []),
             ]
-        cls.cost_price_method.depends = ['type']
 
     @classmethod
     def _cost_price_method_domain_per_type(cls):
@@ -339,7 +335,6 @@
         domain=[
             If(Eval('active'), ('active', '=', True), ()),
             ],
-        depends=['active'],
         help="The product that defines the common properties "
         "inherited by the variant.")
     code_readonly = fields.Function(fields.Boolean('Code Readonly'),
@@ -355,7 +350,6 @@
         states={
             'readonly': Eval('code_readonly', False),
             },
-        depends=['code_readonly'],
         help="The unique identifier for the product (aka SKU).")
     code = fields.Char("Code", readonly=True, select=True,
         help="A unique identifier for the variant.")
@@ -414,8 +408,6 @@
                     tfield.states['invisible'] |= invisible_state
                 else:
                     tfield.states['invisible'] = invisible_state
-                if 'template' not in tfield.depends:
-                    tfield.depends.append('template')
                 setattr(cls, attr, TemplateFunction(tfield))
                 order_method = getattr(cls, 'order_%s' % attr, None)
                 if (not order_method
@@ -634,7 +626,7 @@
         context={
             'company': Eval('company', -1),
             },
-        depends=['company'])
+        depends={'company'})
     list_price = fields.Numeric("List Price", digits=price_digits)
 
     @classmethod
@@ -669,7 +661,7 @@
         context={
             'company': Eval('company', -1),
             },
-        depends=['company'])
+        depends={'company'})
     cost_price_method = fields.Selection(
         'get_cost_price_methods', "Cost Price Method")
 
@@ -729,7 +721,7 @@
         context={
             'company': Eval('company', -1),
             },
-        depends=['company'])
+        depends={'company'})
     cost_price = fields.Numeric(
         "Cost Price", required=True, digits=price_digits)
 
diff -r 5a9354b2ed88 -r b0e8f1a28f68 uom.py
--- a/uom.py    Wed Apr 06 23:37:43 2022 +0200
+++ b/uom.py    Fri Apr 08 19:07:13 2022 +0200
@@ -57,7 +57,6 @@
         domain=[
             ('rounding', '>', 0),
             ],
-        depends=['digits'],
         help="The accuracy to which values are rounded.")
     digits = fields.Integer(
         "Display Digits", required=True,

Reply via email to