1
# -*- encoding: utf-8 -*-
6
class wizard_view_log(wizard.interface):
8
form1 = '''<?xml version="1.0"?>
9
<form string="Audit Logs">
10
<field name="from" colspan="4"/>
12
<field name="to" colspan="4"/>
24
'default': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
30
def _log_open_window(self, cr, uid, data, context):
31
mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
32
act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
33
result = mod_obj._get_id(cr, uid, 'audittrail', 'action_audittrail_log_tree')
34
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
35
result = act_obj.read(cr, uid, [id])[0]
36
log_obj= pooler.get_pool(cr.dbname).get(result['res_model'])
37
log_id = log_obj.search(cr, uid, [])
38
log_model=log_obj.read(cr, uid,log_id,['object_id'])
39
if not data['form']['from']:
40
if data['form']['to'] <> time.strftime("%Y-%m-%d %H:%M:%S"):
41
result['domain'] = str([('timestamp', '<',data['form']['to'])])
45
result['domain'] = str([('timestamp', '>',data['form']['from']),('timestamp', '<',data['form']['to'])])
52
'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [('end', 'Cancel'), ('open', 'Open Logs')]}
56
'result': {'type': 'action', 'action':_log_open_window, 'state':'end'}
59
wizard_view_log('audittrail.view.log')
60
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: