← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~hbrunn/ocb-addons/trunk-lp1252652 into lp:ocb-addons

 

Holger Brunn (Therp) has proposed merging lp:~hbrunn/ocb-addons/trunk-lp1252652 into lp:ocb-addons.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1212197 in OpenERP Community Backports (Addons): "[trunk/7.0] Routing field on MRP order has no effect"
  https://bugs.launchpad.net/ocb-addons/+bug/1212197

For more details, see:
https://code.launchpad.net/~hbrunn/ocb-addons/trunk-lp1252652/+merge/210981

Automatically derived from https://code.launchpad.net/~therp-nl/openobject-addons/trunk-lp1252652 for https://code.launchpad.net/~openerp/openobject-addons/trunk.
-- 
https://code.launchpad.net/~hbrunn/ocb-addons/trunk-lp1252652/+merge/210981
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~hbrunn/ocb-addons/trunk-lp1252652 into lp:ocb-addons.
=== modified file 'mrp/mrp.py'
--- mrp/mrp.py	2014-03-13 17:17:59 +0000
+++ mrp/mrp.py	2014-03-14 08:15:06 +0000
@@ -957,8 +957,8 @@
 
         # Take routing address as a Shipment Address.
         # If usage of routing location is a internal, make outgoing shipment otherwise internal shipment
-        if production.bom_id.routing_id and production.bom_id.routing_id.location_id:
-            routing_loc = production.bom_id.routing_id.location_id
+        if production.routing_id and production.routing_id.location_id:
+            routing_loc = production.routing_id.location_id
             if routing_loc.usage != 'internal':
                 pick_type = 'out'
             partner_id = routing_loc.partner_id and routing_loc.partner_id.id or False
@@ -984,7 +984,13 @@
 
     def _make_production_produce_line(self, cr, uid, production, context=None):
         stock_move = self.pool.get('stock.move')
-        source_location_id = production.product_id.property_stock_production.id
+
+        if production.routing_id and production.routing_id.location_id:
+            source_location_id = production.routing_id.location_id.id
+        else:
+            source_location_id = production.product_id\
+                                    .property_stock_production.id
+
         destination_location_id = production.location_dest_id.id
         data = {
             'name': production.name,
@@ -1010,7 +1016,13 @@
         # Internal shipment is created for Stockable and Consumer Products
         if production_line.product_id.type not in ('product', 'consu'):
             return False
-        destination_location_id = production.product_id.property_stock_production.id
+
+        if production.routing_id and production.routing_id.location_id:
+            destination_location_id = production.routing_id.location_id.id
+        else:
+            destination_location_id = production.product_id\
+                                        .property_stock_production.id
+
         if not source_location_id:
             source_location_id = production.location_src_id.id
         move_id = stock_move.create(cr, uid, {
@@ -1044,8 +1056,8 @@
 
             # Take routing location as a Source Location.
             source_location_id = production.location_src_id.id
-            if production.bom_id.routing_id and production.bom_id.routing_id.location_id:
-                source_location_id = production.bom_id.routing_id.location_id.id
+            if production.routing_id and production.routing_id.location_id:
+                source_location_id = production.routing_id.location_id.id
 
             for line in production.product_lines:
                 consume_move_id = self._make_production_consume_line(cr, uid, line, produce_move_id, source_location_id=source_location_id, context=context)


Follow ups