diff --git a/addons/audittrail/__terp__.py b/addons/audittrail/__terp__.py
index e7ecd839efb..8718523e7f1 100644
--- a/addons/audittrail/__terp__.py
+++ b/addons/audittrail/__terp__.py
@@ -31,6 +31,7 @@
'depends': ['base'],
'init_xml': [],
'update_xml': [
+ 'wizard/audittrail_view_log_view.xml',
'audittrail_view.xml',
'security/ir.model.access.csv',
'security/audittrail_security.xml'
diff --git a/addons/audittrail/audittrail_view.xml b/addons/audittrail/audittrail_view.xml
index 98a4ecc00e9..536ca78741e 100644
--- a/addons/audittrail/audittrail_view.xml
+++ b/addons/audittrail/audittrail_view.xml
@@ -124,8 +124,8 @@
-
-
+
+
diff --git a/addons/audittrail/wizard/__init__.py b/addons/audittrail/wizard/__init__.py
index c7b5a20d884..9b2af466a01 100644
--- a/addons/audittrail/wizard/__init__.py
+++ b/addons/audittrail/wizard/__init__.py
@@ -19,6 +19,6 @@
#
##############################################################################
-import wizard_view_log
+import audittrail_view_log
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/audittrail/wizard/audittrail_view_log.py b/addons/audittrail/wizard/audittrail_view_log.py
new file mode 100644
index 00000000000..2e170f27200
--- /dev/null
+++ b/addons/audittrail/wizard/audittrail_view_log.py
@@ -0,0 +1,72 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from osv import fields, osv
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class audittrail_view_log(osv.osv_memory):
+
+ _name = "audittrail.view.log"
+ _description = "View Log"
+ _columns ={
+ 'from':fields.datetime('Log From'),
+ 'to':fields.datetime('Log To', required = True)
+ }
+ _defaults = {
+ 'to': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
+ }
+
+ def log_open_window(self, cr, uid, ids, context):
+ """
+ Open Log form from given date range..
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of audittrail view log’s IDs.
+ @return: Dictionary of audittrail log form on given date range.
+ """
+ mod_obj = self.pool.get('ir.model.data')
+ act_obj = self.pool.get('ir.actions.act_window')
+ result = mod_obj._get_id(cr, uid, 'audittrail', 'action_audittrail_log_tree')
+ id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
+ result = act_obj.read(cr, uid, [id])[0]
+ log_obj= self.pool.get(result['res_model'])
+ log_id = log_obj.search(cr, uid, [])
+ log_model=log_obj.read(cr, uid,log_id,['object_id'])
+ for datas in self.read(cr, uid, ids):
+ if not datas['from']:
+ if datas['to'] <> time.strftime("%Y-%m-%d %H:%M:%S"):
+ result['domain'] = str([('timestamp', '<',datas['to'])])
+ else:
+ pass
+ else:
+ result['domain'] = str([('timestamp', '>',datas['from']),('timestamp', '<',datas['to'])])
+ return result
+
+audittrail_view_log()
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/audittrail/wizard/audittrail_view_log_view.xml b/addons/audittrail/wizard/audittrail_view_log_view.xml
new file mode 100644
index 00000000000..87648c7e136
--- /dev/null
+++ b/addons/audittrail/wizard/audittrail_view_log_view.xml
@@ -0,0 +1,34 @@
+
+
+
+
+ audittrail.view.log.form
+ audittrail.view.log
+ form
+
+
+
+
+
+
+ View log
+ audittrail.view.log
+ form
+ tree,form
+
+ new
+
+
+
+
diff --git a/addons/audittrail/wizard/wizard_view_log.py b/addons/audittrail/wizard/wizard_view_log.py
deleted file mode 100644
index 81936bcd54c..00000000000
--- a/addons/audittrail/wizard/wizard_view_log.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import wizard
-import pooler
-import time
-
-class wizard_view_log(wizard.interface):
-
- form1 = '''
- '''
-
- form1_fields = {
- 'from': {
- 'string': 'Log From',
- 'type': 'datetime',
-
- },
- 'to': {
- 'string': 'Log To',
- 'type': 'datetime',
- 'default': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
- 'required':True
- },
- }
-
-
- def _log_open_window(self, cr, uid, data, context):
- mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
- act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
- result = mod_obj._get_id(cr, uid, 'audittrail', 'action_audittrail_log_tree')
- id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
- result = act_obj.read(cr, uid, [id])[0]
- log_obj= pooler.get_pool(cr.dbname).get(result['res_model'])
- log_id = log_obj.search(cr, uid, [])
- log_model=log_obj.read(cr, uid,log_id,['object_id'])
- if not data['form']['from']:
- if data['form']['to'] <> time.strftime("%Y-%m-%d %H:%M:%S"):
- result['domain'] = str([('timestamp', '<',data['form']['to'])])
- else:
- pass
- else:
- result['domain'] = str([('timestamp', '>',data['form']['from']),('timestamp', '<',data['form']['to'])])
-
- return result
-
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [('end', 'Cancel'), ('open', 'Open Logs')]}
- },
- 'open': {
- 'actions': [],
- 'result': {'type': 'action', 'action':_log_open_window, 'state':'end'}
- }
- }
-wizard_view_log('audittrail.view.log')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-