From d155db5b278e35b5855d5d062296d7f3a1156be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Wed, 22 Feb 2017 13:58:38 +0100 Subject: [PATCH] [10.0] report_xlsx: Allow to define options for workbook creation (#98) * Allow to define options for workbook creation --- report_xlsx/__manifest__.py | 2 +- report_xlsx/report/report_xlsx.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/report_xlsx/__manifest__.py b/report_xlsx/__manifest__.py index a5ba63a53d..2d8368b3cf 100644 --- a/report_xlsx/__manifest__.py +++ b/report_xlsx/__manifest__.py @@ -10,7 +10,7 @@ 'Odoo Community Association (OCA)', 'website': "http://acsone.eu", 'category': 'Reporting', - 'version': '10.0.1.0.0', + 'version': '10.0.1.0.1', 'license': 'AGPL-3', 'external_dependencies': {'python': ['xlsxwriter']}, 'depends': [ diff --git a/report_xlsx/report/report_xlsx.py b/report_xlsx/report/report_xlsx.py index a989120526..a199beb51b 100644 --- a/report_xlsx/report/report_xlsx.py +++ b/report_xlsx/report/report_xlsx.py @@ -35,11 +35,14 @@ def create_xlsx_report(self, ids, data, report): self.env.cr, self.env.uid, ids, self.env.context) self.parser_instance.set_context(objs, data, ids, 'xlsx') file_data = StringIO() - workbook = xlsxwriter.Workbook(file_data) + workbook = xlsxwriter.Workbook(file_data, self.get_workbook_options()) self.generate_xlsx_report(workbook, data, objs) workbook.close() file_data.seek(0) return (file_data.read(), 'xlsx') + def get_workbook_options(self): + return {} + def generate_xlsx_report(self, workbook, data, objs): raise NotImplementedError()