[FIX] mrp: Use the route on the production if set to create the previous moves

Description of the issue/feature this PR addresses:
The production routing is ignored when creating previous movements

Current behavior before PR:
When you create a production that does not have a routing established in the BOM, and you set a route manually, it is ignored when creating the previous movements
This commit is contained in:
jesusVMayor 2017-03-09 18:50:51 +01:00 committed by Yannick Tivisse
parent 140113346d
commit ebda8caa97
1 changed files with 7 additions and 2 deletions

View File

@ -1197,8 +1197,13 @@ class mrp_production(osv.osv):
source_location_id = production.location_src_id.id
prod_location_id = source_location_id
prev_move= False
if production.bom_id.routing_id and production.bom_id.routing_id.location_id and production.bom_id.routing_id.location_id.id != source_location_id:
source_location_id = production.bom_id.routing_id.location_id.id
if production.routing_id:
routing = production.routing_id
else:
routing = production.bom_id.routing_id
if routing and routing.location_id and routing.location_id.id != source_location_id:
source_location_id = routing.location_id.id
prev_move = True
destination_location_id = production.product_id.property_stock_production.id