Fixed bug.

This commit refs #6441
This commit is contained in:
Sergio Morillo 2019-02-01 16:14:49 +01:00
parent 9d8f37cf5a
commit 5c5d28f2e9

View file

@ -64,12 +64,13 @@ class ProductCategoryLocation(ModelSQL, ModelView):
@classmethod
def default_warehouse(cls):
Location = Pool().get('stock.location')
loc_id = Transaction().context.get('current_location', None)
if loc_id:
location_pool = Pool().get('stock.location')
loc = location_pool(loc_id)
if loc.type == 'storage':
loc = Location(loc_id)
if loc and loc.type == 'storage':
while not loc.parent.type == 'warehouse':
loc = loc.parent
return loc.parent.id