[FIX] AuditTrail : View Logs should only show logs of current object and resources

bzr revid: jvo@tinyerp.com-20091021140619-st7tv6jaytp410kh
This commit is contained in:
Jay (Open ERP) 2009-10-21 19:36:19 +05:30
parent 391807ea8f
commit 4c63801b0d
1 changed files with 20 additions and 20 deletions

View File

@ -63,18 +63,18 @@ class audittrail_rule(osv.osv):
_('WARNING:audittrail is not part of the pool'),
_('Change audittrail depends -- Setting rule as DRAFT'))
self.write(cr, uid, [thisrule.id], {"state": "draft"})
val={
"name":'View Log',
"res_model":'audittrail.log',
"src_model":thisrule.object_id.model,
"domain":"[('res_id', '=', active_id)]"
}
id=self.pool.get('ir.actions.act_window').create(cr, uid, val)
self.write(cr, uid, ids, {"state": "subscribed","action_id":id})
keyword = 'client_action_relate'
value = 'ir.actions.act_window,'+str(id)
res=self.pool.get('ir.model.data').ir_set(cr, uid, 'action', keyword,'View_log_'+thisrule.object_id.model, [thisrule.object_id.model], value, replace=True, isobject=True, xml_id=False)
val={
"name":'View Log',
"res_model":'audittrail.log',
"src_model":thisrule.object_id.model,
"domain":"[('object_id','=',"+str(thisrule.object_id.id)+"),('res_id', '=', active_id)]"
}
id=self.pool.get('ir.actions.act_window').create(cr, uid, val)
self.write(cr, uid, [thisrule.id], {"state": "subscribed","action_id":id})
keyword = 'client_action_relate'
value = 'ir.actions.act_window,'+str(id)
res=self.pool.get('ir.model.data').ir_set(cr, uid, 'action', keyword,'View_log_'+thisrule.object_id.model, [thisrule.object_id.model], value, replace=True, isobject=True, xml_id=False)
return True
@ -84,14 +84,14 @@ class audittrail_rule(osv.osv):
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, ids, {"state": "draft"})
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
audittrail_rule()