diff --git a/mass_editing/models/mass_object.py b/mass_editing/models/mass_object.py index 94abce72a..f9ff47ef2 100644 --- a/mass_editing/models/mass_object.py +++ b/mass_editing/models/mass_object.py @@ -2,7 +2,6 @@ # © 2016 Serpent Consulting Services Pvt. Ltd. (support@serpentcs.com) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp.exceptions import UserError from openerp import api, fields, models, _ @@ -81,14 +80,10 @@ class MassObject(models.Model): @api.multi def unlink_action(self): - for mass in self: - try: - if mass.ref_ir_act_window_id: - mass.ref_ir_act_window_id.unlink() - if mass.ref_ir_value_id: - mass.ref_ir_value_id.unlink() - except: - raise UserError(_("Deletion of the action record failed.")) + # We make sudo as any user with rights in this model should be able + # to delete the action, not only admin + self.mapped('ref_ir_act_window_id').sudo().unlink() + self.mapped('ref_ir_value_id').sudo().unlink() return True @api.multi