changeset 1157b8d4aa69 in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset&node=1157b8d4aa69
description:
        Use length of field name instead of lstrip to get nested part of clause

        issue11714
        review437381003
diffstat:

 inventory.py |  4 ++--
 location.py  |  4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r f80b86865a95 -r 1157b8d4aa69 inventory.py
--- a/inventory.py      Fri Sep 30 09:01:20 2022 +0200
+++ b/inventory.py      Sat Oct 01 15:35:33 2022 +0200
@@ -412,8 +412,8 @@
 
     @classmethod
     def search_inventory_location(cls, name, clause):
-        nested = clause[0].lstrip(name)
-        return [('inventory.' + name + nested,) + tuple(clause[1:])]
+        nested = clause[0][len(name):]
+        return [('inventory.' + name + nested, *clause[1:])]
 
     @fields.depends('inventory', '_parent_inventory.date')
     def on_change_with_inventory_date(self, name=None):
diff -r f80b86865a95 -r 1157b8d4aa69 location.py
--- a/location.py       Fri Sep 30 09:01:20 2022 +0200
+++ b/location.py       Sat Oct 01 15:35:33 2022 +0200
@@ -725,8 +725,8 @@
 
     @classmethod
     def search_product(cls, name, clause):
-        nested = clause[0].lstrip(name)
-        return [('product.' + name + nested,) + tuple(clause[1:])]
+        nested = clause[0][len(name):]
+        return [('product.' + name + nested, *clause[1:])]
 
 
 class LocationLeadTime(sequence_ordered(), ModelSQL, ModelView, MatchMixin):

Reply via email to