← Back to team overview

openerp-india team mailing list archive

[Bug 1082047] Re: Rounding Problem on Delivery Orders

 

*** This bug is a duplicate of bug 1080183 ***
    https://bugs.launchpad.net/bugs/1080183

** This bug has been marked a duplicate of bug 1080183
   [trunk] Rounding error in partial picking

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1082047

Title:
  Rounding Problem on Delivery Orders

Status in OpenERP Addons (modules):
  Confirmed

Bug description:

  open erp Version 6.1.1, r6628

  scenario:

  - make a delivery order with a product in kg, rounding precision  =
  0.01, quantity is a rational number like 566323.7

  - process and validate

  You see the error: The uom rounding does not allow you to ship
  "566323.7 kg", only roundings of "0.01 kg" is accepted by the uom.

  The problem is:

  First we used python floats and calculated:  
  566323.7 * 100 = 56632369.9999999

  So we use as workaround: 
  Overwrite the rounding function with the help of decimal

  from decimal import *
  def rounding(f, r):
  if not r:
  return f
  #return round(f / r) * r
  return float(Decimal(str(round(float(Decimal(str(f)) / Decimal(str(r)))))) * Decimal(str(r)))

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1082047/+subscriptions


References