changeset ffe683caf404 in modules/stock_supply:4.2
details: 
https://hg.tryton.org/modules/stock_supply?cmd=changeset;node=ffe683caf404
description:
        Use OR clauses on location searcher

        issue8141
        review58531002
        (grafted from b5dff78398eb94515deaab0798ca1ff980bf1f31)
diffstat:

 order_point.py |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (24 lines):

diff -r 2578ad7505fe -r ffe683caf404 order_point.py
--- a/order_point.py    Fri Nov 16 21:13:35 2018 +0100
+++ b/order_point.py    Fri Mar 15 17:49:32 2019 +0100
@@ -195,13 +195,13 @@
 
     @classmethod
     def search_location(cls, name, domain=None):
-        ids = []
-        for type, field in cls._type2field().iteritems():
-            args = [('type', '=', type)]
-            for _, operator, operand in domain:
-                args.append((field, operator, operand))
-            ids.extend([o.id for o in cls.search(args)])
-        return [('id', 'in', ids)]
+        clauses = ['OR']
+        for type, field in cls._type2field().items():
+            clauses.append([
+                    ('type', '=', type),
+                    (field,) + tuple(domain[1:]),
+                    ])
+        return clauses
 
     @staticmethod
     def default_company():

Reply via email to