changeset 323525c3df4c in modules/stock_supply_production:5.2
details:
https://hg.tryton.org/modules/stock_supply_production?cmd=changeset;node=323525c3df4c
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 2b5f3f1790d9 -r 323525c3df4c production.py
--- a/production.py Mon May 06 15:18:10 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