Issue 10236

Title
In a one2many, you can mark multiple times a record to delete
Priority
bug
Status
chatting
Nosy list
ced, juanjogp, pokoli
Assigned to
Keywords

Created on 2021-03-30.11:07:37 by juanjogp, last changed 1 week ago by ced.

Messages

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-03-31.19:20:08

This is because we use a list for record_deleted and record_removed so the record can be added multiple times. I do not think it will be good to use a set because I think it is good to keep the order of the user operation.
Even if there is no error raised, I think we should prevent adding multiple times because unremove remove only one instance and remove toggle only one instance from one list to the other. So we can end up having a record to remove and delete at the same time.

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-03-30.11:09:51

Is there any error raised on the server or which is the problem? Just that the record is deleted three times?

Did you test usin tryton, sao or both?

Author: [hidden] (juanjogp)
Date: 2021-03-30.11:07:36

(Tested in develop branch)
For the example we will use the field address in the party model (any one2many will have the same behavior):
1. Create an address (using the form view)
2. Now if we press the delete button (without switching the view of the address to list), we can see that we can continue pressing the delete button, in this case, we press the delete button three times.
3. Save the party
4. If we have the verbose activated in the server console, we can see:

30380 140062888007424 [2021-03-30 08:42:05,814] DEBUG trytond.protocols.dispatcher <class 'trytond.pool.party.party'>.write(*([3], {'addresses': [['delete', [5, 5, 5]]]}, {'client': '59cc3a5a-3792-46cf-b312-0f06fee7535e', 'company': 1, 'company.rec_name': 'TEST', 'language': 'en', 'language_direction': 'ltr', 'groups': [6, 7, 1, 4, 2, 5, 3, 8], 'locale': {'date': '%m/%d/%Y', 'grouping': [3, 3, 0], 'decimal_point': '.', 'thousands_sep': ','}, '_timestamp': {'party.party,3': '1617093634.382613', 'party.address,5': '1617093634.382613'}}), **{}) from <admin@127.0.0.1>/tryton_test/
  1. As we can see in the log, Tryton trying delete the same address 3 times , as many times as we press the button.
History
Date User Action Args
2021-03-31 19:20:08cedsetmessages: + msg65954
nosy: + ced
2021-03-30 11:09:51pokolisetcomponent: + tryton, sao, - party
messages: + msg65935
nosy: + pokoli
status: unread -> chatting
2021-03-30 11:07:37juanjogpcreate

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