Tryton - Issues

 

Issue4140

Title Missing delete in on_change keywords
Priority feature Status chatting
Superseder Nosy List ced, nblock, pokoli
Type behavior Components
Assigned To Keywords
Reviews

Created on 2014-08-28.11:05:41 by ced, last changed by pokoli.

Messages
msg36676 (view) 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.
msg36406 (view) 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).
msg33179 (view) 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.
msg28979 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-09-23.18:40:43
I do not agree, the bad naming is still there.
msg28977 (view) 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.
msg17835 (view) 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
2017-11-02 12:44:40pokolisetmessages: + msg36676
2017-10-21 19:04:29cedsetmessages: + msg36406
2017-04-10 14:26:49nblocksetnosy: + nblock
2017-04-10 13:37:30cedlinkissue6430 superseder
2017-04-10 13:36:41cedsetmessages: + msg33179
title: Consistency in on_change keywords -> Missing delete in on_change keywords
2016-09-23 18:40:44cedsetstatus: closed -> chatting
messages: + msg28979
2016-09-23 18:20:14pokolisetstatus: unread -> closed
nosy: + pokoli
messages: + msg28977
2014-08-28 11:05:41cedcreate

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