mirror of
https://gitlab.com/datalifeit/trytond-stock_product_category_location
synced 2023-12-14 04:33:11 +01:00
parent
9d8f37cf5a
commit
5c5d28f2e9
1 changed files with 4 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue