changeset b9cc5dff7bf1 in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset&node=b9cc5dff7bf1
description:
        Use dictionary as domain for Reference field

        issue11074
        review383911002
diffstat:

 inventory.py |  25 ++++++-------------------
 1 files changed, 6 insertions(+), 19 deletions(-)

diffs (41 lines):

diff -r c994fc728bf3 -r b9cc5dff7bf1 inventory.py
--- a/inventory.py      Thu Feb 03 22:29:08 2022 +0100
+++ b/inventory.py      Thu Feb 03 23:05:47 2022 +0100
@@ -630,31 +630,18 @@
             ('product.product', "Product"),
             ],
         required=True,
-        domain=[If(Eval('search_model') == 'product.product',
-                [
-                    ('type', '=', 'goods'),
-                    ('consumable', '=', False),
-                    ],
-                [])],
-        depends=['search_model'],
+        domain={
+            'product.product': [
+                ('type', '=', 'goods'),
+                ('consumable', '=', False),
+                ],
+            },
         help="The item that's counted.")
-    search_model = fields.Function(fields.Selection(
-        'get_search_models', "Search Model"),
-        'on_change_with_search_model')
 
     @classmethod
     def default_search(cls):
         return 'product.product,-1'
 
-    @classmethod
-    def get_search_models(cls):
-        return cls.fields_get(['search'])['search']['selection']
-
-    @fields.depends('search')
-    def on_change_with_search_model(self, name=None):
-        if self.search:
-            return self.search.__name__
-
 
 class CountQuantity(ModelView):
     "Stock Inventory Count"

Reply via email to