← Back to team overview

openerp-india team mailing list archive

[Bug 1082047] [NEW] Rounding Problem on Delivery Orders

 

Public bug reported:


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)))

** Affects: openobject-addons
     Importance: Undecided
         Status: New

** Attachment added: "Error Message"
   https://bugs.launchpad.net/bugs/1082047/+attachment/3441216/+files/error.png

-- 
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):
  New

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


Follow ups

References