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).
|2017-10-21 19:04:29||ced||set||messageid: <firstname.lastname@example.org>|
+ pokoli, nblock|
|2017-10-21 19:04:29||ced||link||issue4140 messages|