Tryton - Issues

 

Issue8354

Title Can't remove a product when is not in the list
Priority bug Status resolved
Superseder Nosy List ced, pokoli, resteve, reviewbot, roundup-bot
Type crash Components stock_supply_production
Assigned To Keywords review
Reviews 267421002
View: 267421002

Created on 2019-05-15.18:10:12 by resteve, last changed by roundup-bot.

Messages
New changeset 323525c3df4c by Sergi Almacellas Abellana in branch '5.2':
Catch error when removing non existant products
https://hg.tryton.org/modules/stock_supply_production/rev/323525c3df4c

New changeset be6fcd46487c by Sergi Almacellas Abellana in branch '5.0':
Catch error when removing non existant products
https://hg.tryton.org/modules/stock_supply_production/rev/be6fcd46487c

New changeset 643a32f0b136 by Sergi Almacellas Abellana in branch '4.8':
Catch error when removing non existant products
https://hg.tryton.org/modules/stock_supply_production/rev/643a32f0b136

New changeset 0cc833fbe2bf by Sergi Almacellas Abellana in branch '4.6':
Catch error when removing non existant products
https://hg.tryton.org/modules/stock_supply_production/rev/0cc833fbe2bf

New changeset 7e80e571164b by Sergi Almacellas Abellana in branch '4.4':
Catch error when removing non existant products
https://hg.tryton.org/modules/stock_supply_production/rev/7e80e571164b
New changeset 625fadea2617 by Sergi Almacellas Abellana in branch 'default':
Catch error when removing non existant products
https://hg.tryton.org/tryton-env/rev/625fadea2617
New changeset e0301c4cc765 by Sergi Almacellas Abellana in branch 'default':
Catch error when removing non existant products
https://hg.tryton.org/modules/stock_supply_production/rev/e0301c4cc765
review267421002 updated at https://codereview.tryton.org/267421002/#ps269651002
review267421002 updated at https://codereview.tryton.org/267421002/#ps283451002
review267421002 updated at https://codereview.tryton.org/267421002/#ps267431002
msg50022 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2019-06-05.10:36:25
Here is review267421002 which implements msg49967
msg49967 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-06-04.12:21:25
I think the traceback can happen if the product is filtered out by [1] but products_period is computed for all the products. In get_shortage the removal of product_ids is based on the products_period list.
So I think we can safely catch the ValueError in this case.

[1] http://hg.tryton.org/modules/stock_supply_production/file/5e784eac0797/production.py#l105
msg49806 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2019-05-22.15:11:20
Yes, I understand the traceback but I'm wondering why the product removed is not present. That's why I'm asking on some steps to reproduce the issue as it seems it's only raised with some data values (not always)
msg49805 (view) Author: [hidden] (resteve) Date: 2019-05-22.15:09:32
Module stock_supply_production:

The traceback remove in the list a product_id that not found.
msg49802 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2019-05-22.11:45:59
Could you provide some sample steps to reproduce the issue on a fresh database?
msg49728 (view) Author: [hidden] (resteve) Date: 2019-05-15.18:10:11
Get a traceback when "Supply Stock" menu and "stock_supply_production" module installed.

Traceback (most recent call last):
  File "/trytond/wsgi.py", line 73, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 46, in rpc
    request, database_name, *request.rpc_params)
  File "/trytond/wsgi.py", line 44, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 122, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 176, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/wizard/wizard.py", line 287, in execute
    return wizard._execute(state_name)
  File "/trytond/wizard/wizard.py", line 318, in _execute
    result = self._execute(transition())
  File "/trytond/modules/stock_supply_production/stock.py", line 96, in transition_create_
    return super(StockSupply, self).transition_create_()
  File "/trytond/modules/stock_supply/stock.py", line 72, in transition_create_
    created |= bool(getattr(self, 'generate_%s' % type_)(first))
  File "/trytond/modules/stock_supply_production/stock.py", line 106, in generate_production
    clean=clean, **self._production_parameters)
  File "/trytond/modules/stock_supply_production/production.py", line 109, in generate_requests
    quantities, products_period, product2ops)
  File "/trytond/modules/stock_supply_production/production.py", line 200, in get_shortage
    product_ids.remove(product.id)
ValueError: list.remove(x): x not in list

Detected in v5.0
History
Date User Action Args
2019-06-17 22:01:04roundup-botsetmessages: + msg50299
2019-06-06 19:22:54roundup-botsetmessages: + msg50121
2019-06-06 19:22:49roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg50120
2019-06-05 12:19:05reviewbotsetmessages: + msg50038
2019-06-05 11:39:37reviewbotsetmessages: + msg50033
2019-06-05 10:42:36reviewbotsetnosy: + reviewbot
messages: + msg50024
2019-06-05 10:36:25pokolisetstatus: chatting -> testing
reviews: 267421002
messages: + msg50022
keyword: + review
2019-06-04 12:21:26cedsetnosy: + ced
messages: + msg49967
2019-05-22 15:11:21pokolisetmessages: + msg49806
2019-05-22 15:09:32restevesetmessages: + msg49805

Showing 10 items. Show all history (warning: this could be VERY long)