From 567d925ada46589ed5a8db9a366fa3f822b2edde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 18 Jun 2009 18:46:48 +0200 Subject: [PATCH] Add delete_all action on One2Many field --- CHANGELOG | 1 + trytond/model/fields/one2many.py | 6 ++++++ 2 files changed, 7 insertions(+) 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]]