changeset 12200b73b22c in modules/stock_supply_production:4.6
details:
https://hg.tryton.org/modules/stock_supply_production?cmd=changeset;node=12200b73b22c
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
(grafted from a084e8f44d6caf39981bf60f5b871e91de27fbae)
diffstat:
production.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diffs (21 lines):
diff -r 426ebbafa441 -r 12200b73b22c production.py
--- a/production.py Mon Oct 30 15:54:55 2017 +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',
)