diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index 0a2a309ba92..71835c183f8 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -19,7 +19,7 @@ - + diff --git a/addons/stock/product.py b/addons/stock/product.py index 2a819ea89b2..7e54ff19840 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -182,6 +182,10 @@ class product_product(osv.osv): """ if context is None: context = {} + + location_obj = self.pool.get('stock.location') + warehouse_obj = self.pool.get('stock.warehouse') + states = context.get('states',[]) what = context.get('what',()) if not ids: @@ -207,18 +211,18 @@ class product_product(osv.osv): if type(context['location']) == type(1): location_ids = [context['location']] elif type(context['location']) in (type(''), type(u'')): - location_ids = self.pool.get('stock.location').search(cr, uid, [('name','ilike',context['location'])], context=context) + location_ids = location_obj.search(cr, uid, [('name','ilike',context['location'])], context=context) else: location_ids = context['location'] else: location_ids = [] - wids = self.pool.get('stock.warehouse').search(cr, uid, [], context=context) - for w in self.pool.get('stock.warehouse').browse(cr, uid, wids, context=context): + wids = warehouse_obj.search(cr, uid, [], context=context) + for w in warehouse_obj.browse(cr, uid, wids, context=context): location_ids.append(w.lot_stock_id.id) # build the list of ids of children of the location given by id if context.get('compute_child',True): - child_location_ids = self.pool.get('stock.location').search(cr, uid, [('location_id', 'child_of', location_ids)]) + child_location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', location_ids)]) location_ids = child_location_ids or location_ids else: location_ids = location_ids @@ -333,7 +337,8 @@ class product_product(osv.osv): 'track_production': fields.boolean('Track Manufacturing Lots' , help="Forces to specify a Production Lot for all moves containing this product and generated by a Manufacturing Order"), 'track_incoming': fields.boolean('Track Incoming Lots', help="Forces to specify a Production Lot for all moves containing this product and coming from a Supplier Location"), 'track_outgoing': fields.boolean('Track Outgoing Lots', help="Forces to specify a Production Lot for all moves containing this product and going to a Customer Location"), - 'location_id': fields.dummy(string='Stock Location', relation='stock.location', type='many2one'), + 'location_id': fields.dummy(string='Location', relation='stock.location', type='many2one'), + 'warehouse_id': fields.dummy(string='Warehouse', relation='stock.warehouse', type='many2one'), 'valuation':fields.selection([('manual_periodic', 'Periodical (manual)'), ('real_time','Real Time (automated)'),], 'Inventory Valuation', help="If real-time valuation is enabled for a product, the system will automatically write journal entries corresponding to stock moves." \ diff --git a/addons/stock/product_view.xml b/addons/stock/product_view.xml index def92fe79eb..226fa13b594 100644 --- a/addons/stock/product_view.xml +++ b/addons/stock/product_view.xml @@ -9,7 +9,8 @@ - + +