From 8a1cbdb707ff0dd141a18c208ce29c5344c89fb4 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Mon, 12 May 2014 22:49:36 +0200 Subject: [PATCH] report_xls timezone fix --- report_xls/__init__.py | 4 ++-- report_xls/__openerp__.py | 6 +++--- report_xls/report_xls.py | 5 +++-- report_xls/utils.py | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/report_xls/__init__.py b/report_xls/__init__.py index 835cd44c..1f5df8f6 100644 --- a/report_xls/__init__.py +++ b/report_xls/__init__.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # -# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved. +# Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -16,7 +16,7 @@ # 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 . +# along with this program. If not, see . # ############################################################################## diff --git a/report_xls/__openerp__.py b/report_xls/__openerp__.py index 5e85adac..7e505828 100644 --- a/report_xls/__openerp__.py +++ b/report_xls/__openerp__.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # -# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved. +# Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -16,7 +16,7 @@ # 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 . +# along with this program. If not, see . # ############################################################################## { @@ -67,7 +67,7 @@ the creation XLS reports in OpenERP. Development assistance '''''''''''''''''''''' -Contact info@noviat.com for help with the development of Excel reports in OpenERP, . +Contact info@noviat.com for help with the development of Excel reports in OpenERP. """, 'depends': ['base'], diff --git a/report_xls/report_xls.py b/report_xls/report_xls.py index 5e19c859..707fc34b 100644 --- a/report_xls/report_xls.py +++ b/report_xls/report_xls.py @@ -24,6 +24,7 @@ import xlwt from xlwt.Style import default_style import cStringIO from datetime import datetime +from openerp.osv.fields import datetime as datetime_field from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT import inspect from types import CodeType @@ -58,7 +59,6 @@ class report_xls(report_sxw): # TO DO: move parameters infra to configurable data # header/footer - DT_FORMAT = '%Y-%m-%d %H:%M:%S' hf_params = { 'font_size': 8, 'font_style': 'I', # B: Bold, I: Italic, U: Underline @@ -120,8 +120,9 @@ class report_xls(report_sxw): self.xls_headers = { 'standard': '', } + report_date = datetime_field.context_timestamp(cr, uid, datetime.now(), context).strftime(DEFAULT_SERVER_DATETIME_FORMAT) self.xls_footers = { - 'standard': ('&L&%(font_size)s&%(font_style)s' + datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT) + + 'standard': ('&L&%(font_size)s&%(font_style)s' + report_date + '&R&%(font_size)s&%(font_style)s&P / &N') % self.hf_params, } self.generate_xls_report(_p, _xs, data, objs, wb) diff --git a/report_xls/utils.py b/report_xls/utils.py index e4f3d878..f21644ca 100644 --- a/report_xls/utils.py +++ b/report_xls/utils.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # -# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved. +# Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -16,7 +16,7 @@ # 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 . +# along with this program. If not, see . # ##############################################################################