Order locations by the MPTT left field when searching on quantities
This improves the likelihood that a full branch of locations will be calculated in the same batch. Closes #14182
This commit is contained in:
1 parent
d72c4e2a95
commit
3c82eeca33
1 file changed
+1
-1
@@ -460,7 +460,7 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView):
|
||||
}.get(operator_, lambda v, l: False)
|
||||
|
||||
ids = []
|
||||
for location in cls.search([]):
|
||||
for location in cls.search([], order=[('left', 'ASC')]):
|
||||
if operator_(getattr(location, name), operand):
|
||||
ids.append(location.id)
|
||||
return [('id', 'in', ids)]
|
||||
|
||||
Reference in new issue
Block a user