Merge lp:~camptocamp/product-kitting/7.0-bom_stock-no-lines-1298860-gbr into lp:product-kitting

Proposed by Guewen Baconnier @ Camptocamp
Status: Merged
Approved by: Yannick Vaucher @ Camptocamp
Approved revision: 10
Merged at revision: 10
Proposed branch: lp:~camptocamp/product-kitting/7.0-bom_stock-no-lines-1298860-gbr
Merge into: lp:product-kitting
Diff against target: 23 lines (+7/-6)
1 file modified
bom_stock/bom_stock.py (+7/-6)
To merge this branch: bzr merge lp:~camptocamp/product-kitting/7.0-bom_stock-no-lines-1298860-gbr
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp code review, no test Approve
Pedro Manuel Baeza code review Approve
Review via email: mp+213216@code.launchpad.net

Commit message

Error when computing bom_stock on a bill of material without lines.

When a bill of material has no lines, it can't produce more products, so the code can be moved in the 'if bom.bom_lines:' branch

Description of the change

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

LGTM

review: Approve (code review)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

LGTM

review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bom_stock/bom_stock.py'
2--- bom_stock/bom_stock.py 2014-02-12 15:38:27 +0000
3+++ bom_stock/bom_stock.py 2014-03-28 09:11:39 +0000
4@@ -90,12 +90,13 @@
5 prod_min_quantities.append(prod_min_quantity)
6 if stop_compute_bom:
7 break
8- produced_qty = uom_obj._compute_qty_obj(cr, uid,
9- bom.product_uom,
10- bom.product_qty,
11- bom.product_id.uom_id,
12- context=context)
13- product_qty += min(prod_min_quantities) * produced_qty
14+
15+ produced_qty = uom_obj._compute_qty_obj(cr, uid,
16+ bom.product_uom,
17+ bom.product_qty,
18+ bom.product_id.uom_id,
19+ context=context)
20+ product_qty += min(prod_min_quantities) * produced_qty
21 return product_qty
22
23 def _product_available(self, cr, uid, ids, field_names=None,

Subscribers

People subscribed via source and target branches