From 7eb797ab15a0230303164421167a137ce30a06cc Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 23 Sep 2016 12:29:03 +0200 Subject: [PATCH 1/2] [FIX][account_financial_report_qweb] Fix ImportError. It was happening when `xlsxwriter` python module was not available. Bump version, add external dependencies. --- account_financial_report_qweb/README.rst | 1 + account_financial_report_qweb/__openerp__.py | 9 ++++++--- .../report/abstract_report_xlsx.py | 9 ++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/account_financial_report_qweb/README.rst b/account_financial_report_qweb/README.rst index 443c0fc081a7..efe611c36d2a 100644 --- a/account_financial_report_qweb/README.rst +++ b/account_financial_report_qweb/README.rst @@ -50,6 +50,7 @@ Contributors * Francesco Apruzzese * Lorenzo Battistini * Julien Coux +* Jairo Llopis Much of the work in this module was done at a sprint in Sorrento, Italy in April 2016. diff --git a/account_financial_report_qweb/__openerp__.py b/account_financial_report_qweb/__openerp__.py index 975b62e9c445..f8cc8c27c77a 100644 --- a/account_financial_report_qweb/__openerp__.py +++ b/account_financial_report_qweb/__openerp__.py @@ -5,7 +5,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'QWeb Financial Reports', - 'version': '9.0.1.0.0', + 'version': '9.0.1.0.1', 'category': 'Reporting', 'summary': 'OCA Financial Reports', 'author': 'Camptocamp SA,' @@ -35,8 +35,11 @@ 'report/templates/trial_balance.xml', 'view/account_view.xml' ], - 'test': [ - ], + 'external_dependencies': { + "python": [ + "xlsxwriter", + ], + }, 'installable': True, 'application': True, 'auto_install': False, diff --git a/account_financial_report_qweb/report/abstract_report_xlsx.py b/account_financial_report_qweb/report/abstract_report_xlsx.py index 041d0f051b49..d432f92f61bd 100644 --- a/account_financial_report_qweb/report/abstract_report_xlsx.py +++ b/account_financial_report_qweb/report/abstract_report_xlsx.py @@ -2,9 +2,16 @@ # Author: Julien Coux # Copyright 2016 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +try: + import xlsxwriter +except ImportError: + import logging + _logger = logging.getLogger(__name__) + _logger.info("Missing dependency: xlsxwriter.") + _logger.debug("ImportError details:", exc_info=True) from cStringIO import StringIO -import xlsxwriter + from openerp.addons.report_xlsx.report.report_xlsx import ReportXlsx From 9aa79997fc06fc7071a04753b54f790177b0e375 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Mon, 26 Sep 2016 15:27:35 +0200 Subject: [PATCH 2/2] Avoid coverage errors on an ImportError that will never happen in bots. --- account_financial_report_qweb/report/abstract_report_xlsx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_financial_report_qweb/report/abstract_report_xlsx.py b/account_financial_report_qweb/report/abstract_report_xlsx.py index d432f92f61bd..6384367ff4ac 100644 --- a/account_financial_report_qweb/report/abstract_report_xlsx.py +++ b/account_financial_report_qweb/report/abstract_report_xlsx.py @@ -4,7 +4,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). try: import xlsxwriter -except ImportError: +except ImportError: # pragma: no cover import logging _logger = logging.getLogger(__name__) _logger.info("Missing dependency: xlsxwriter.")