From ebda8caa97a1ed154030e9a257eebfed087e9a18 Mon Sep 17 00:00:00 2001 From: jesusVMayor Date: Thu, 9 Mar 2017 18:50:51 +0100 Subject: [PATCH] [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 --- addons/mrp/mrp.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 7915a69fbc8..621f46b528f 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -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