Merge lp:~therp-nl/openobject-addons/trunk-lp1252652 into lp:openobject-addons

Proposed by Holger Brunn (Therp)
Status: Needs review
Proposed branch: lp:~therp-nl/openobject-addons/trunk-lp1252652
Merge into: lp:openobject-addons
Diff against target: 55 lines (+18/-6)
1 file modified
mrp/mrp.py (+18/-6)
To merge this branch: bzr merge lp:~therp-nl/openobject-addons/trunk-lp1252652
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+210974@code.launchpad.net
To post a comment you must log in.
9046. By Jordi Llinares - KM Sistemas

[FIX] use mo's routing, not the bom's

Unmerged revisions

9046. By Jordi Llinares - KM Sistemas

[FIX] use mo's routing, not the bom's

9045. By Jordi Llinares - KM Sistemas

[FIX] get produce lines' source location and consume lines' destination
location from routing if available

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mrp/mrp.py'
2--- mrp/mrp.py 2014-03-11 14:52:05 +0000
3+++ mrp/mrp.py 2014-03-14 07:19:04 +0000
4@@ -964,8 +964,8 @@
5
6 # Take routing address as a Shipment Address.
7 # If usage of routing location is a internal, make outgoing shipment otherwise internal shipment
8- if production.bom_id.routing_id and production.bom_id.routing_id.location_id:
9- routing_loc = production.bom_id.routing_id.location_id
10+ if production.routing_id and production.routing_id.location_id:
11+ routing_loc = production.routing_id.location_id
12 if routing_loc.usage != 'internal':
13 pick_type = 'out'
14 partner_id = routing_loc.partner_id and routing_loc.partner_id.id or False
15@@ -991,7 +991,13 @@
16
17 def _make_production_produce_line(self, cr, uid, production, context=None):
18 stock_move = self.pool.get('stock.move')
19- source_location_id = production.product_id.property_stock_production.id
20+
21+ if production.routing_id and production.routing_id.location_id:
22+ source_location_id = production.routing_id.location_id.id
23+ else:
24+ source_location_id = production.product_id\
25+ .property_stock_production.id
26+
27 destination_location_id = production.location_dest_id.id
28 data = {
29 'name': production.name,
30@@ -1017,7 +1023,13 @@
31 # Internal shipment is created for Stockable and Consumer Products
32 if production_line.product_id.type not in ('product', 'consu'):
33 return False
34- destination_location_id = production.product_id.property_stock_production.id
35+
36+ if production.routing_id and production.routing_id.location_id:
37+ destination_location_id = production.routing_id.location_id.id
38+ else:
39+ destination_location_id = production.product_id\
40+ .property_stock_production.id
41+
42 if not source_location_id:
43 source_location_id = production.location_src_id.id
44 move_id = stock_move.create(cr, uid, {
45@@ -1050,8 +1062,8 @@
46
47 # Take routing location as a Source Location.
48 source_location_id = production.location_src_id.id
49- if production.bom_id.routing_id and production.bom_id.routing_id.location_id:
50- source_location_id = production.bom_id.routing_id.location_id.id
51+ if production.routing_id and production.routing_id.location_id:
52+ source_location_id = production.routing_id.location_id.id
53
54 for line in production.product_lines:
55 consume_move_id = self._make_production_consume_line(cr, uid, line, produce_move_id, source_location_id=source_location_id, context=context)

Subscribers

People subscribed via source and target branches

to all changes: