Merge lp:~numerigraphe/openobject-addons/6.0-inventory-fill-precision into lp:openobject-addons/6.0

Proposed by Numérigraphe
Status: Needs review
Proposed branch: lp:~numerigraphe/openobject-addons/6.0-inventory-fill-precision
Merge into: lp:openobject-addons/6.0
Diff against target: 13 lines (+3/-0)
1 file modified
stock/wizard/stock_fill_inventory.py (+3/-0)
To merge this branch: bzr merge lp:~numerigraphe/openobject-addons/6.0-inventory-fill-precision
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+187194@code.launchpad.net

Description of the change

Precision errors may lead to tiny stock variations when filling inventories from the wizard.

To post a comment you must log in.

Unmerged revisions

5499. By Numérigraphe

[FIX] respect the UoM's precision when filling a physical inventory

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/wizard/stock_fill_inventory.py'
2--- stock/wizard/stock_fill_inventory.py 2012-04-25 12:22:20 +0000
3+++ stock/wizard/stock_fill_inventory.py 2013-09-24 10:37:52 +0000
4@@ -101,6 +101,9 @@
5 if datas.get((prod_id, lot_id)):
6 qty += datas[(prod_id, lot_id)]['product_qty']
7
8+ # Floating point sum could introduce tiny rounding errors. We'll use the UoM API for the rounding (same UoM in and out).
9+ qty = uom_obj._compute_qty_obj(cr, uid,
10+ move.product_id.uom_id, qty, move.product_id.uom_id)
11 datas[(prod_id, lot_id)] = {'product_id': prod_id, 'location_id': location, 'product_qty': qty, 'product_uom': move.product_id.uom_id.id, 'prod_lot_id': lot_id}
12
13 if datas: