← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~numerigraphe-team/ocb-addons/7.0-inventory-fill-precision into lp:ocb-addons

 

Lionel Sausin - Numérigraphe has proposed merging lp:~numerigraphe-team/ocb-addons/7.0-inventory-fill-precision into lp:ocb-addons.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1229646 in OpenERP Community Backports (Addons): "Wizard "Fill inventory" does not respect the UoM's precision at the end of the computation"
  https://bugs.launchpad.net/ocb-addons/+bug/1229646

For more details, see:
https://code.launchpad.net/~numerigraphe-team/ocb-addons/7.0-inventory-fill-precision/+merge/210459

when a Physical inventory is filled with the wizard, the quantity of products is computed by summing all the stock moves, but it's not rounded to the correct precision.
This can lead to tiny differences when validating the inventory, particularly when a large number of decimals are used.
-- 
https://code.launchpad.net/~numerigraphe-team/ocb-addons/7.0-inventory-fill-precision/+merge/210459
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~numerigraphe-team/ocb-addons/7.0-inventory-fill-precision into lp:ocb-addons.
=== modified file 'stock/wizard/stock_fill_inventory.py'
--- stock/wizard/stock_fill_inventory.py	2014-03-04 11:34:07 +0000
+++ stock/wizard/stock_fill_inventory.py	2014-03-11 17:01:41 +0000
@@ -119,6 +119,9 @@
                     if datas.get((prod_id, lot_id)):
                         qty += datas[(prod_id, lot_id)]['product_qty']
 
+                    # Floating point sum could introduce tiny rounding errors. We'll use the UoM API for the rounding (same UoM in and out).
+                    qty = uom_obj._compute_qty_obj(cr, uid,
+                        move.product_id.uom_id, qty, move.product_id.uom_id)
                     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}
 
             if datas:


Follow ups