Do not include flat location children from child_of search

If the flat location children are not explicitly in the requested locations,
they should not be included because the quantity is already included in the
parent location and they will be added twice if a single location is requested
(because of the quick loop).

issue7162
review44871003
This commit is contained in:
Cédric Krier committed 2018-04-03 16:40:00 +02:00
1 parent 101eaecb89
commit d2befe114e
1 file changed
+5 -2
+5 -2
View File
@@ -1469,8 +1469,11 @@ def _location_children(location_ids, query=False):
nested_location_ids.append(location.id)
if nested_location_ids:
return Location.search(['OR',
('parent', 'child_of', nested_location_ids),
('id', 'in', flat_location_ids),
[
('parent', 'child_of', nested_location_ids),
('parent.flat_childs', '!=', True),
],
('id', 'in', location_ids),
], query=query, order=[])
else:
if query: