use warehouse._get_mto_route to get the MTO route
instead of using a custom lookup with a different implementation closes #2608 pass context as a named argument
This commit is contained in:
parent
58301b99e8
commit
817e459d43
|
@ -1054,8 +1054,9 @@ class mrp_production(osv.osv):
|
|||
|
||||
def _get_raw_material_procure_method(self, cr, uid, product, context=None):
|
||||
'''This method returns the procure_method to use when creating the stock move for the production raw materials'''
|
||||
warehouse_obj = self.pool['stock.warehouse']
|
||||
try:
|
||||
mto_route = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'route_warehouse0_mto')[1]
|
||||
mto_route = warehouse_obj._get_mto_route(cr, uid, context=context)
|
||||
except:
|
||||
return "make_to_stock"
|
||||
routes = product.route_ids + product.categ_id.total_route_ids
|
||||
|
|
|
@ -288,6 +288,7 @@ class sale_order_line(osv.osv):
|
|||
context = context or {}
|
||||
product_uom_obj = self.pool.get('product.uom')
|
||||
product_obj = self.pool.get('product.product')
|
||||
warehouse_obj = self.pool['stock.warehouse']
|
||||
warning = {}
|
||||
#UoM False due to hack which makes sure uom changes price, ... in product_id_change
|
||||
res = self.product_id_change(cr, uid, ids, pricelist, product, qty=qty,
|
||||
|
@ -311,14 +312,14 @@ class sale_order_line(osv.osv):
|
|||
#determine if the product is MTO or not (for a further check)
|
||||
isMto = False
|
||||
if warehouse_id:
|
||||
warehouse = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context=context)
|
||||
warehouse = warehouse_obj.browse(cr, uid, warehouse_id, context=context)
|
||||
for product_route in product_obj.route_ids:
|
||||
if warehouse.mto_pull_id and warehouse.mto_pull_id.route_id and warehouse.mto_pull_id.route_id.id == product_route.id:
|
||||
isMto = True
|
||||
break
|
||||
else:
|
||||
try:
|
||||
mto_route_id = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'route_warehouse0_mto').id
|
||||
mto_route_id = warehouse_obj._get_mto_route(cr, uid, context=context)
|
||||
except:
|
||||
# if route MTO not found in ir_model_data, we treat the product as in MTS
|
||||
mto_route_id = False
|
||||
|
|
Loading…
Reference in New Issue