Issue 10496

Title
Duplicate records when deleting multiple sales
Priority
bug
Status
resolved
Nosy list
pokoli, resteve, reviewbot, roundup-bot
Assigned to
pokoli
Keywords
review

Created on 2021-06-09.12:46:39 by pokoli, last changed 3 months ago by roundup-bot.

Messages

New changeset 1361b4f271f3 by Sergi Almacellas Abellana in branch '6.0':
Avoid processing duplicate opportunities
https://hg.tryton.org/modules/sale_opportunity/rev/1361b4f271f3

New changeset f4cc6ddaa89d by Sergi Almacellas Abellana in branch '5.8':
Avoid processing duplicate opportunities
https://hg.tryton.org/modules/sale_opportunity/rev/f4cc6ddaa89d

New changeset dba7cf050312 by Sergi Almacellas Abellana in branch '5.0':
Avoid processing duplicate opportunities
https://hg.tryton.org/modules/sale_opportunity/rev/dba7cf050312
New changeset 89597a1ea4cb by Sergi Almacellas Abellana in branch 'default':
Avoid processing duplicate opportunities
https://hg.tryton.org/tryton-env/rev/89597a1ea4cb
New changeset d1009566d314 by Sergi Almacellas Abellana in branch 'default':
Avoid processing duplicate opportunities
https://hg.tryton.org/modules/sale_opportunity/rev/d1009566d314
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-06-09.12:46:39

When deleting two sales that are linked to the same opportunity I get the following traceback:

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 45, in rpc
    return methods.get(request.rpc_method, _dispatch)(
  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/modules/sale_opportunity/sale.py", line 19, in wrapper
    func(cls, sales)
  File "/trytond/modules/sale_opportunity/sale.py", line 35, in delete
    super(Sale, cls).delete(sales)
  File "/trytond/modules/sale/sale.py", line 805, in delete
    cls.cancel(sales)
  File "/trytond/modules/sale_opportunity/sale.py", line 21, in wrapper
    Opportunity.process(opportunities)
  File "/trytond/modules/sale_opportunity/opportunity.py", line 424, in process
    cls.lost(lost)
  File "/trytond/model/modelview.py", line 643, in wrapper
    assert len(records) == len(set(records)), "Duplicate records"
AssertionError: Duplicate records

I found this on 5.0 series.

History
Date User Action Args
2021-06-23 23:00:14roundup-botsetkeyword: - backport
messages: + msg68400
2021-06-11 09:44:45roundup-botsetmessages: + msg68212
2021-06-11 09:44:42roundup-botsetmessages: + msg68211
nosy: + roundup-bot
status: testing -> resolved
2021-06-09 13:35:01reviewbotsetmessages: + msg68170
2021-06-09 13:02:30reviewbotsetmessages: + msg68167
nosy: + reviewbot
2021-06-09 12:58:08restevesetnosy: + resteve
2021-06-09 12:51:02pokolisetkeyword: + review
reviews: 338311002
status: in-progress -> testing
2021-06-09 12:46:39pokolicreate

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