changeset 7a3b7f794c8c in modules/stock_supply_production:4.8
details: 
https://hg.tryton.org/modules/stock_supply_production?cmd=changeset;node=7a3b7f794c8c
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 dc975ad79af8 -r 7a3b7f794c8c production.py
--- a/production.py     Tue Feb 19 23:04:54 2019 +0100
+++ b/production.py     Wed Mar 27 23:18:12 2019 +0100
@@ -135,6 +135,8 @@
             date = today
         else:
             date -= datetime.timedelta(1)
+        uom = product.default_uom
+        quantity = uom.ceil(quantity)
         return cls(
             planned_date=date,
             company=company,
@@ -142,7 +144,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