Merge lp:~akretion-team/openobject-addons/trunk-addons-mrp-perf-improve into lp:openobject-addons

Proposed by Alexis de Lattre
Status: Merged
Merged at revision: 7652
Proposed branch: lp:~akretion-team/openobject-addons/trunk-addons-mrp-perf-improve
Merge into: lp:openobject-addons
Diff against target: 12 lines (+1/-1)
1 file modified
mrp/mrp.py (+1/-1)
To merge this branch: bzr merge lp:~akretion-team/openobject-addons/trunk-addons-mrp-perf-improve
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+102072@code.launchpad.net

Description of the change

2 reasons for this one-line patch :

- performance : most of the time, production.move_prod_id.location_id = "Stock" and production.location_dest_id = "Stock", so, in those frequent cases, a write is not required... the stock_move already has the right value

- usability : in stock/stock.py line 1731, you can see that writing to a stock_move in 'done' state is very restricted. When you have already validated the outgoing product but haven't validated the production order (I know, you should first validate the production order and THEN the outgoing product), and you try to validate the production order, then you get the error message "Quantities, UoMs, Products and Locations cannot be modified on stock moves that have already been processed (except by the Administrator)". This patch allows this scenario without the error message when the stock_move already has the right value for 'location_id'.

To post a comment you must log in.

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 2012-04-03 17:21:08 +0000
3+++ mrp/mrp.py 2012-04-16 09:08:31 +0000
4@@ -660,7 +660,7 @@
5
6 for (production_id,name) in self.name_get(cr, uid, ids):
7 production = self.browse(cr, uid, production_id)
8- if production.move_prod_id:
9+ if production.move_prod_id and production.move_prod_id.location_id.id != production.location_dest_id.id:
10 move_obj.write(cr, uid, [production.move_prod_id.id],
11 {'location_id': production.location_dest_id.id})
12 self.action_ready_send_note(cr, uid, [production_id], context)

Subscribers

People subscribed via source and target branches

to all changes: