changeset 2818ea8a378f in modules/stock_supply_production:4.4
details: 
https://hg.tryton.org/modules/stock_supply_production?cmd=changeset;node=2818ea8a378f
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 ada28055b103 -r 2818ea8a378f production.py
--- a/production.py     Tue Aug 08 18:35:14 2017 +0200
+++ 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',
             )

Reply via email to