Merge lp:~laetitia-gangloff/openobject-addons/7.0_fix_1200676 into lp:openobject-addons/7.0

Proposed by Laetitia Gangloff (Acsone)
Status: Merged
Merged at revision: 9446
Proposed branch: lp:~laetitia-gangloff/openobject-addons/7.0_fix_1200676
Merge into: lp:openobject-addons/7.0
Diff against target: 14 lines (+2/-2)
1 file modified
mrp/mrp.py (+2/-2)
To merge this branch: bzr merge lp:~laetitia-gangloff/openobject-addons/7.0_fix_1200676
Reviewer Review Type Date Requested Status
Acsone OpenErp Team Pending
Review via email: mp+174776@code.launchpad.net

Description of the change

fix bug 1200676 by using subproductfactor in the comparison

To post a comment you must log in.
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Code looks good to me, but you should re-do this MP against bug #1048807 so it gets more visibility. Indeed, since #1200676 is a duplicate it will be mostly ignored.

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-12-20 11:47:30 +0000
3+++ mrp/mrp.py 2013-07-15 14:32:07 +0000
4@@ -760,9 +760,9 @@
5 subproduct_factor = self._get_subproduct_factor(cr, uid, production.id, produce_product.id, context=context)
6 rest_qty = (subproduct_factor * production.product_qty) - produced_qty
7
8- if rest_qty < production_qty:
9+ if rest_qty < (subproduct_factor * production_qty):
10 prod_name = produce_product.product_id.name_get()[0][1]
11- raise osv.except_osv(_('Warning!'), _('You are going to produce total %s quantities of "%s".\nBut you can only produce up to total %s quantities.') % (production_qty, prod_name, rest_qty))
12+ raise osv.except_osv(_('Warning!'), _('You are going to produce total %s quantities of "%s".\nBut you can only produce up to total %s quantities.') % ((subproduct_factor * production_qty), prod_name, rest_qty))
13 if rest_qty > 0 :
14 stock_mov_obj.action_consume(cr, uid, [produce_product.id], (subproduct_factor * production_qty), context=context)
15