[FIX] stock: _get_domain_locations function

To adopt the same behavior than location with warehouse in function _get_domain_locations.

opw:644219
This commit is contained in:
Goffin Simon 2015-07-08 14:00:32 +02:00
parent 067fd2f342
commit c33f79ae3e
1 changed files with 11 additions and 3 deletions

View File

@ -74,9 +74,9 @@ class product_product(osv.osv):
location_ids = []
if context.get('location', False):
if type(context['location']) == type(1):
if isinstance(context['location'], (int, long)):
location_ids = [context['location']]
elif type(context['location']) in (type(''), type(u'')):
elif isinstance(context['location'], basestring):
domain = [('complete_name','ilike',context['location'])]
if context.get('force_company', False):
domain += [('company_id', '=', context['force_company'])]
@ -85,7 +85,15 @@ class product_product(osv.osv):
location_ids = context['location']
else:
if context.get('warehouse', False):
wids = [context['warehouse']]
if isinstance(context['warehouse'], (int, long)):
wids = [context['warehouse']]
elif isinstance(context['warehouse'], basestring):
domain = [('name', 'ilike', context['warehouse'])]
if context.get('force_company', False):
domain += [('company_id', '=', context['force_company'])]
wids = warehouse_obj.search(cr, uid, domain, context=context)
else:
wids = context['warehouse']
else:
wids = warehouse_obj.search(cr, uid, [], context=context)