openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #18263
[Bug 1082047] Re: Rounding Problem on Delivery Orders
** Changed in: openobject-addons
Importance: Undecided => Medium
** Changed in: openobject-addons
Status: New => Confirmed
** Changed in: openobject-addons
Assignee: (unassigned) => OpenERP R&D Addons Team 2 (openerp-dev-addons2)
--
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