Search also for inactive warehouse in get_warehouse

issue5580
review27301003
This commit is contained in:
Cédric Krier
2016-05-30 22:22:19 +02:00
parent a424386b45
commit 45ccdc9060
+5 -4
View File
@@ -207,10 +207,11 @@ class Location(ModelSQL, ModelView):
def get_warehouse(self, name):
# Order by descending left to get the first one in the tree
locations = self.search([
('parent', 'parent_of', [self.id]),
('type', '=', 'warehouse'),
], order=[('left', 'DESC')])
with Transaction().set_context(active_test=False):
locations = self.search([
('parent', 'parent_of', [self.id]),
('type', '=', 'warehouse'),
], order=[('left', 'DESC')])
if locations:
return locations[0].id