def unlink_values(self, cr, uid, id, context=None): """ Only remove link in ir.values, not the report """ doc = self.browse(cr, uid, id, context=context) for v in self.action_values(cr, uid, doc.report_id.id, context=context): ir.ir_del(cr, uid, v) return True
def _do_action(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) report = pool.get(data['model']).browse(cr, uid, data['id'], context=context) res = ir.ir_get(cr, uid, 'action', 'client_print_multi', [report.model]) id = filter(lambda r: r[1]==report.report_name, res)[0][0] res = ir.ir_del(cr, uid, id) return {}
def unsubscribe(self, cr, uid, ids, *args): """ Unsubscribe Auditing Rule on object @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Auddittrail Rule’s IDs. @return: True """ obj_action = self.pool.get('ir.actions.act_window') val_obj = self.pool.get('ir.values') value='' #start Loop for thisrule in self.browse(cr, uid, ids): if thisrule.id in self.__functions: for function in self.__functions[thisrule.id]: setattr(function[0], function[1], function[2]) w_id = obj_action.search(cr, uid, [('name', '=', 'View Log'), ('res_model', '=', 'audittrail.log'), ('src_model', '=', thisrule.object_id.model)]) if w_id: obj_action.unlink(cr, uid, w_id) value = "ir.actions.act_window" + ',' + str(w_id[0]) val_id = val_obj.search(cr, uid, [('model', '=', thisrule.object_id.model), ('value', '=', value)]) if val_id: res = ir.ir_del(cr, uid, val_id[0]) self.write(cr, uid, [thisrule.id], {"state": "draft"}) #End Loop return True
def unsubscribe(self, cr, uid, ids, *args): """ Unsubscribe Auditing Rule on object @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Auddittrail Rule’s IDs. @return: True """ obj_action = self.pool.get('ir.actions.act_window') val_obj = self.pool.get('ir.values') value = '' #start Loop for thisrule in self.browse(cr, uid, ids): if thisrule.id in self.__functions: for function in self.__functions[thisrule.id]: setattr(function[0], function[1], function[2]) w_id = obj_action.search( cr, uid, [('name', '=', 'View Log'), ('res_model', '=', 'audittrail.log'), ('src_model', '=', thisrule.object_id.model)]) if w_id: obj_action.unlink(cr, uid, w_id) value = "ir.actions.act_window" + ',' + str(w_id[0]) val_id = val_obj.search(cr, uid, [('model', '=', thisrule.object_id.model), ('value', '=', value)]) if val_id: res = ir.ir_del(cr, uid, val_id[0]) self.write(cr, uid, [thisrule.id], {"state": "draft"}) #End Loop return True
def unsubscribe(self, cr, uid, ids, *args): for thisrule in self.browse(cr, uid, ids): if thisrule.id in self.__functions : for function in self.__functions[thisrule.id]: setattr(function[0], function[1], function[2]) w_id=self.pool.get('ir.actions.act_window').search(cr, uid, [('name','=','View Log'),('res_model','=','audittrail.log'),('src_model','=',thisrule.object_id.model)]) self.pool.get('ir.actions.act_window').unlink(cr, uid,w_id ) val_obj=self.pool.get('ir.values') value="ir.actions.act_window"+','+str(w_id[0]) val_id=val_obj.search(cr, uid, [('model','=',thisrule.object_id.model),('value','=',value)]) if val_id: res = ir.ir_del(cr, uid, val_id[0]) self.write(cr, uid, [thisrule.id], {"state": "draft"}) return True
def exp_ir_del(self, cr, uid, id): res = ir.ir_del(cr,uid, id) return res