diff --git a/CHANGELOG b/CHANGELOG index 7ca0302abb..1bbed0167b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add delete_all action on One2Many field * Read, write, create, delete permission on record rules * Add reset_default method to ir.default * Doesn't append '%' to "like", "ilike" clauses diff --git a/trytond/model/fields/one2many.py b/trytond/model/fields/one2many.py index e9dae187f4..977171d673 100644 --- a/trytond/model/fields/one2many.py +++ b/trytond/model/fields/one2many.py @@ -79,6 +79,7 @@ class One2Many(Field): (``create``, ``{: value}``), (``write``, ````, ``{: value}``), (``delete``, ````), + (``delete_all``), (``unlink``, ````), (``add``, ````), (``unlink_all``), @@ -97,6 +98,11 @@ class One2Many(Field): model.write(cursor, user, act[1] , act[2], context=context) elif act[0] == 'delete': model.delete(cursor, user, act[1], context=context) + elif act[0] == 'delete_all': + ids = model.search(cursor, user, [ + (self.field, '=', record_id), + ], context=context) + model.delete(cursor, user, ids, context=context) elif act[0] == 'unlink': if isinstance(act[1], (int, long)): ids = [act[1]]