Issue 4140

Title
Missing delete in on_change keywords
Priority
feature
Status
resolved
Nosy list
ced, nblock, pokoli, reviewbot, roundup-bot
Assigned to
ced
Keywords
review

Created on 2014-08-28.11:05:41 by ced, last changed 17 months ago by roundup-bot.

Messages

New changeset 6f69c09ec1ff by Cédric Krier in branch 'default':
Support explicit delete and remove for saving and on_change xxx2Many
https://hg.tryton.org/tryton-env/rev/6f69c09ec1ff
New changeset 41f7d6828fcd by Cédric Krier in branch 'default':
Support explicit delete and remove for saving and on_change xxx2Many
https://hg.tryton.org/trytond/rev/41f7d6828fcd
New changeset 1059829e2782 by Cédric Krier in branch 'default':
Support explicit delete and remove for saving and on_change xxx2Many
https://hg.tryton.org/tryton/rev/1059829e2782
New changeset 9583c9484701 by Cédric Krier in branch 'default':
Support explicit delete and remove for saving and on_change xxx2Many
https://hg.tryton.org/sao/rev/9583c9484701
New changeset 366222e2291b by Cédric Krier in branch 'default':
Support explicit delete and remove for saving and on_change xxx2Many
https://hg.tryton.org/proteus/rev/366222e2291b
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2020-04-05.21:59:18
I'm wondering if there is somethign wrong with the sao implementation. See  msg56907 for more details
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-03-21.01:19:57
Here is review291281002
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2017-11-02.12:44:40
For me it makes sense to use delete as default for One2Many as normally records are created instead of linked. For Many2Many the default action is link, so it makes sense to remove (unlink) instead of removing. 

The proposed API looks good to me.
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2017-10-21.19:04:29
I think we should implement the 'delete' on client side for on_change. But also the ModelView._changed_values and ModelStorage._save_values shoud be improved to support it for both One2Many and Many2Many. For that as the API is only attribute assignation, I propose to keep the current behavior of 'remove' for Many2Many as default but use 'delete' for One2Many. So to be able to switch the default behavior, I propose to register in the Model._values the list of records to delete or remove for the relation field. Those records list will be stored as '<field name>:removed' and '<field name>:deleted' (use ':' to avoid any clash with existing field) in Model._values (for performance to avoid creating a new dict). Both methods will have to check those values to change the behavior. To fill those list, I think we should add a method on both fields, ex: One2Many.remove(self, record, records) and Many2Many.delete(self, record, records).
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2017-04-10.13:36:41
Indeed the remove is now a *real* remove (and no more a deletion) since r e40190b28b31.
But indeed we are missing for some cases the 'delete' keyword.
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2016-09-23.18:40:43
I do not agree, the bad naming is still there.
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2016-09-23.18:20:14
Keywords are hidden to the developer now, so for me this is fixed now.
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2014-08-28.11:05:40
The keyword 'remove' is indeed a deletion and there is no real remove.
So I propose to replace the 'remove' by a real remove and add 'delete' for the current 'remove' behavior.
History
Date User Action Args
2020-04-12 23:19:04roundup-botsetmessages: + msg57063
2020-04-12 23:18:58roundup-botsetmessages: + msg57062
2020-04-12 23:18:56roundup-botsetmessages: + msg57061
2020-04-12 23:18:53roundup-botsetmessages: + msg57060
2020-04-12 23:18:45roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg57059
2020-04-05 21:59:18pokolisetmessages: + msg56908
2020-04-01 11:24:33reviewbotsetmessages: + msg56818
2020-04-01 00:49:05reviewbotsetmessages: + msg56813
2020-03-22 16:03:55reviewbotsetmessages: + msg56578
2020-03-21 12:33:19reviewbotsetmessages: + msg56560

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