changeset ab0a62508de3 in modules/stock_supply_production:5.0
details: 
https://hg.tryton.org/modules/stock_supply_production?cmd=changeset;node=ab0a62508de3
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 c6e8065cc297 -r ab0a62508de3 production.py
--- a/production.py     Tue Feb 19 22:16:03 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',
             )

Reply via email to