changeset a084e8f44d6c in modules/stock_supply_production:default
details:
https://hg.tryton.org/modules/stock_supply_production?cmd=changeset;node=a084e8f44d6c
description:
Ceil quantity of production with the default UoM
The computation of shortage as it adds float number (even rounded) can
introduce float precision error. So we must ceil it to pass the digits
validation.
issue8058
review287151002
diffstat:
production.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diffs (21 lines):
diff -r 434d64e2376c -r a084e8f44d6c production.py
--- a/production.py Fri Mar 22 15:33:44 2019 +0100
+++ b/production.py Wed Mar 27 23:18:12 2019 +0100
@@ -133,6 +133,8 @@
date = today
else:
date -= datetime.timedelta(1)
+ uom = product.default_uom
+ quantity = uom.ceil(quantity)
return cls(
planned_date=date,
company=company,
@@ -140,7 +142,7 @@
location=warehouse.production_location,
product=product,
bom=product.boms[0].bom if product.boms else None,
- uom=product.default_uom,
+ uom=uom,
quantity=quantity,
state='request',
)