changeset 7e80e571164b in modules/stock_supply_production:4.4
details: 
https://hg.tryton.org/modules/stock_supply_production?cmd=changeset;node=7e80e571164b
description:
        Catch error when removing non existant products

        It should not fail when the product has been removed by get_shortage
        issue8354
        review267421002
        (grafted from e0301c4cc7654f961bcf157d39d382d8c4e8f37b)
diffstat:

 production.py |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (16 lines):

diff -r 6f547d96d226 -r 7e80e571164b production.py
--- a/production.py     Mon Apr 22 10:52:48 2019 +0200
+++ b/production.py     Thu Jun 06 19:22:13 2019 +0200
@@ -197,7 +197,11 @@
             while (products_period
                     and products_period[0][0] <= (current_date - date)):
                 _, product = products_period.pop(0)
-                product_ids.remove(product.id)
+                try:
+                    product_ids.remove(product.id)
+                except ValueError:
+                    # product may have been already removed on get_shortages
+                    pass
             current_date += datetime.timedelta(1)
 
             # Update current quantities with next moves

Reply via email to