[IMP] unlink ir.action.todo which are related to actions which will be deleted.
This commit is contained in:
@@ -57,6 +57,13 @@ class actions(osv.osv):
|
|||||||
'usage': lambda *a: False,
|
'usage': lambda *a: False,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def unlink(self, cr, uid, ids, context=None):
|
||||||
|
"""unlink ir.action.todo which are related to actions which will be deleted.
|
||||||
|
NOTE: ondelete cascade will not work on ir.actions.actions so we will need to do it manually."""
|
||||||
|
todo_obj = self.pool.get('ir.actions.todo')
|
||||||
|
todo_ids = todo_obj.search(cr, uid, [('action_id', 'in', ids)], context=context)
|
||||||
|
todo_obj.unlink(cr, uid, todo_ids, context=context)
|
||||||
|
return super(actions, self).unlink(cr, uid, ids, context=context)
|
||||||
|
|
||||||
class ir_actions_report_xml(osv.osv):
|
class ir_actions_report_xml(osv.osv):
|
||||||
|
|
||||||
|
|||||||
@@ -312,9 +312,13 @@ class ir_ui_menu(osv.osv):
|
|||||||
menu_ref = [menu_ref]
|
menu_ref = [menu_ref]
|
||||||
model_data_obj = self.pool.get('ir.model.data')
|
model_data_obj = self.pool.get('ir.model.data')
|
||||||
for menu_data in menu_ref:
|
for menu_data in menu_ref:
|
||||||
model, id = model_data_obj.get_object_reference(cr, uid, menu_data.split('.')[0], menu_data.split('.')[1])
|
try:
|
||||||
if (model == 'ir.ui.menu'):
|
model, id = model_data_obj.get_object_reference(cr, uid, menu_data.split('.')[0], menu_data.split('.')[1])
|
||||||
menu_ids.add(id)
|
if (model == 'ir.ui.menu'):
|
||||||
|
menu_ids.add(id)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
menu_ids = list(menu_ids)
|
menu_ids = list(menu_ids)
|
||||||
|
|
||||||
for menu in self.browse(cr, uid, menu_ids, context=context):
|
for menu in self.browse(cr, uid, menu_ids, context=context):
|
||||||
|
|||||||
Reference in New Issue
Block a user