Hardik Ansodariya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-881356-han into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #881356 in OpenERP Addons: "Floating Point / Rounding issue in stock 
partial picking wizard"
  https://bugs.launchpad.net/openobject-addons/+bug/881356

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-881356-han/+merge/86036
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-881356-han/+merge/86036
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-881356-han.
=== modified file 'sale/sale.py'
--- sale/sale.py	2011-12-12 05:33:51 +0000
+++ sale/sale.py	2011-12-16 12:47:30 +0000
@@ -1231,7 +1231,7 @@
 
         if not uom2:
             uom2 = product_obj.uom_id
-        if (product_obj.type=='product') and (product_obj.virtual_available * uom2.factor < qty * product_obj.uom_id.factor) \
+        if (product_obj.type=='product') and (round(product_obj.virtual_available * uom2.factor,self.pool.get('decimal.precision').precision_get(cr, uid, 'Product UOM')) < round(qty * product_obj.uom_id.factor,self.pool.get('decimal.precision').precision_get(cr, uid, 'Product UOM'))) \
           and (product_obj.procure_method=='make_to_stock'):
             warn_msg = _('You plan to sell %.2f %s but you only have %.2f %s available !\nThe real stock is %.2f %s. (without reservations)') % \
                     (qty, uom2 and uom2.name or product_obj.uom_id.name,

=== modified file 'stock/stock.py'
--- stock/stock.py	2011-12-15 18:49:54 +0000
+++ stock/stock.py	2011-12-16 12:47:30 +0000
@@ -460,11 +460,14 @@
 
             amount = results2
             if amount > 0:
+                total = round(total, self.pool.get('decimal.precision').precision_get(cr, uid, 'Product UoM'))
+                product_qty = round(product_qty, self.pool.get('decimal.precision').precision_get(cr, uid, 'Product UoM'))
                 if amount > min(total, product_qty):
                     amount = min(product_qty, total)
                 result.append((amount, id))
                 product_qty -= amount
                 total -= amount
+                product_qty = round(product_qty,self.pool.get('decimal.precision').precision_get(cr, uid, 'Product UoM'))
                 if product_qty <= 0.0:
                     return result
                 if total <= 0.0:

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to