Issue 9969

Title
Duplicate records error when creating sales
Priority
bug
Status
testing
Nosy list
pokoli, reviewbot
Assigned to
pokoli
Keywords
backport, review

Created on 2020-12-29.09:37:54 by pokoli, last changed 3 weeks ago by ced.

Messages

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
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)