Issue 9969

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

Created on 2020-12-29.09:37:54 by pokoli, last changed 10 months ago by roundup-bot.

Messages

New changeset c321c759028f by Sergi Almacellas Abellana in branch '5.8':
Avoid duplicate records when confirming sale payments
https://hg.tryton.org/modules/sale_payment/rev/c321c759028f

New changeset 31e5970a00e8 by Sergi Almacellas Abellana in branch '5.6':
Avoid duplicate records when confirming sale payments
https://hg.tryton.org/modules/sale_payment/rev/31e5970a00e8

New changeset 8286fffcc8d0 by Sergi Almacellas Abellana in branch '5.0':
Avoid duplicate records when confirming sale payments
https://hg.tryton.org/modules/sale_payment/rev/8286fffcc8d0
New changeset f77cb91694ce by Sergi Almacellas Abellana in branch 'default':
Avoid duplicate records when confirming sale payments
https://hg.tryton.org/tryton-env/rev/f77cb91694ce
New changeset fe5699894b9f by Sergi Almacellas Abellana in branch 'default':
Avoid duplicate records when confirming sale payments
https://hg.tryton.org/modules/sale_payment/rev/fe5699894b9f
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2020-12-29.09:37:54

When running a script that creates multiple payments related to the same sale we get the following error message:

Traceback (most recent call last):
  File "/home/pokoli/projectes/vet/migrations/qvet/migrate.py", line 1728, in <module>
    main(args.database, args.source, args.access, args.config_file)
  File "/home/pokoli/projectes/vet/migrations/qvet/migrate.py", line 1696, in main
    load_payments(source, payment_types)
  File "/home/pokoli/projectes/vet/migrations/qvet/migrate.py", line 1654, in load_payments
    Payment.create(payments, Payment._config.context)
  File "/home/pokoli/.virtualenvs/vet/lib/python3.9/site-packages/proteus/config.py", line 188, in __call__
    result = rpc.result(meth(*args, **kwargs))
  File "/home/pokoli/projectes/vet/payment.py", line 60, in create
    payments = super(Payment, cls).create(vlist)
  File "/home/pokoli/.virtualenvs/vet/lib/python3.9/site-packages/trytond/modules/sale_payment/account.py", line 84, in create
    cls.trigger_authorized([p for p in payments if p.is_authorized])
  File "/home/pokoli/.virtualenvs/vet/lib/python3.9/site-packages/trytond/modules/sale_payment/account.py", line 24, in wrapper
    Sale.payment_confirm(sales)
  File "/home/pokoli/projectes/vet/sale.py", line 401, in payment_confirm
    super(Sale, cls).payment_confirm(sales)
  File "/home/pokoli/.virtualenvs/vet/lib/python3.9/site-packages/trytond/modules/sale_payment/sale.py", line 78, in payment_confirm
    cls.confirm(to_confirm)
  File "/home/pokoli/.virtualenvs/vet/lib/python3.9/site-packages/trytond/model/modelview.py", line 710, in wrapper
    assert len(records) == len(set(records)), "Duplicate records"
AssertionError: Duplicate records

Found on 5.8 series

History
Date User Action Args
2021-01-28 23:00:05roundup-botsetkeyword: - backport
messages: + msg64151
2021-01-25 16:39:44roundup-botsetmessages: + msg64086
2021-01-25 16:39:23roundup-botsetmessages: + msg64085
nosy: + roundup-bot
status: testing -> resolved
2020-12-29 17:46:25cedsetkeyword: + backport
status: in-progress -> testing
2020-12-29 13:48:45reviewbotsetmessages: + msg63693
2020-12-29 10:19:19reviewbotsetmessages: + msg63692
nosy: + reviewbot
2020-12-29 10:19:18reviewbotsetkeyword: + review
reviews: 322971002
2020-12-29 09:37:54pokolicreate

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