Browse Source

[FIX] mass_editing: Allow to remove sidebar action

As 65a1579 did for the creation, this commit does for the unlink,
allowing to non admin users to remove the sidebar action.
pull/509/merge
Pedro M. Baeza 8 years ago
parent
commit
25a3c4bc30
  1. 13
      mass_editing/models/mass_object.py

13
mass_editing/models/mass_object.py

@ -2,7 +2,6 @@
# © 2016 Serpent Consulting Services Pvt. Ltd. (support@serpentcs.com) # © 2016 Serpent Consulting Services Pvt. Ltd. (support@serpentcs.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp.exceptions import UserError
from openerp import api, fields, models, _ from openerp import api, fields, models, _
@ -81,14 +80,10 @@ class MassObject(models.Model):
@api.multi @api.multi
def unlink_action(self): 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 return True
@api.multi @api.multi

Loading…
Cancel
Save