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

Proposed by Holger Brunn (Therp)
Status: Rejected
Rejected by: Holger Brunn (Therp)
Proposed branch: lp:~hbrunn/ocb-addons/trunk-lp1252652
Merge into: lp:ocb-addons
Diff against target: 55 lines (+18/-6)
1 file modified
mrp/mrp.py (+18/-6)
To merge this branch: bzr merge lp:~hbrunn/ocb-addons/trunk-lp1252652
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) Disapprove
Ana Juaristi Olalde (community) code review Approve
Pedro Manuel Baeza code review Approve
Review via email: mp+210981@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Good point, thanks for bringing this.

Regards.

review: Approve (code review)
Revision history for this message
Ana Juaristi Olalde (ajuaristio) wrote :

+1 Pedro.
Thank you Jordi

review: Approve (code review)
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

Development for 7.0 has moved to github on https://github.com/OCA/ocb - please move your merge proposal there if it is still valid.

(I close and reject this in order to have a cleaner overview for 6.1 MPs which indeed have to be done on launchpad)

review: Disapprove

Unmerged revisions

10009. By Jordi Llinares - KM Sistemas

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

10008. 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-13 17:17:59 +0000
3+++ mrp/mrp.py 2014-03-14 08:15:06 +0000
4@@ -957,8 +957,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@@ -984,7 +984,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@@ -1010,7 +1016,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@@ -1044,8 +1056,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)