From cc41e1e21b384d6699badaa0d33ca252cec0eaa3 Mon Sep 17 00:00:00 2001 From: Jordi Ballester Alomar Date: Thu, 10 Jan 2019 19:11:24 +0100 Subject: [PATCH] [account_financial_report] fix title formatting for all reports --- account_financial_report/__manifest__.py | 2 +- account_financial_report/report/abstract_report_xlsx.py | 7 +++++++ .../report/aged_partner_balance_xlsx.py | 4 ++-- account_financial_report/report/general_ledger_xlsx.py | 4 ++-- account_financial_report/report/journal_ledger_xlsx.py | 4 ++-- account_financial_report/report/open_items_xlsx.py | 4 ++-- account_financial_report/report/trial_balance_xlsx.py | 4 ++-- account_financial_report/report/vat_report_xlsx.py | 4 ++-- 8 files changed, 20 insertions(+), 13 deletions(-) diff --git a/account_financial_report/__manifest__.py b/account_financial_report/__manifest__.py index 1371b92b..2e658839 100644 --- a/account_financial_report/__manifest__.py +++ b/account_financial_report/__manifest__.py @@ -4,7 +4,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'Account Financial Reports', - 'version': '11.0.2.4.1', + 'version': '11.0.2.4.2', 'category': 'Reporting', 'summary': 'OCA Financial Reports', 'author': 'Camptocamp SA,' diff --git a/account_financial_report/report/abstract_report_xlsx.py b/account_financial_report/report/abstract_report_xlsx.py index 4c28d03e..8634823f 100644 --- a/account_financial_report/report/abstract_report_xlsx.py +++ b/account_financial_report/report/abstract_report_xlsx.py @@ -349,6 +349,13 @@ class AbstractReportXslx(models.AbstractModel): """ raise NotImplementedError() + def _get_report_complete_name(self, report, prefix): + if report.company_id: + suffix = ' - %s - %s' % ( + report.company_id.name, report.company_id.currency_id.name) + return prefix + suffix + return prefix + def _get_report_name(self, report): """ Allow to define the report name. diff --git a/account_financial_report/report/aged_partner_balance_xlsx.py b/account_financial_report/report/aged_partner_balance_xlsx.py index ac42c36a..a438cd83 100644 --- a/account_financial_report/report/aged_partner_balance_xlsx.py +++ b/account_financial_report/report/aged_partner_balance_xlsx.py @@ -11,8 +11,8 @@ class AgedPartnerBalanceXslx(models.AbstractModel): _inherit = 'report.account_financial_report.abstract_report_xlsx' def _get_report_name(self, report): - return _('Aged Partner Balance - %s - %s') % ( - report.company_id.name, report.company_id.currency_id.name) + report_name = _('Aged Partner Balance') + return self._get_report_complete_name(report, report_name) def _get_report_columns(self, report): if not report.show_move_line_details: diff --git a/account_financial_report/report/general_ledger_xlsx.py b/account_financial_report/report/general_ledger_xlsx.py index 7db68f9b..1b55d8ce 100644 --- a/account_financial_report/report/general_ledger_xlsx.py +++ b/account_financial_report/report/general_ledger_xlsx.py @@ -12,8 +12,8 @@ class GeneralLedgerXslx(models.AbstractModel): _inherit = 'report.account_financial_report.abstract_report_xlsx' def _get_report_name(self, report): - return _('General Ledger - %s - %s') % ( - report.company_id.name, report.company_id.currency_id.name) + report_name = _('General Ledger') + return self._get_report_complete_name(report, report_name) def _get_report_columns(self, report): res = { diff --git a/account_financial_report/report/journal_ledger_xlsx.py b/account_financial_report/report/journal_ledger_xlsx.py index f5e5a041..0d0bc559 100644 --- a/account_financial_report/report/journal_ledger_xlsx.py +++ b/account_financial_report/report/journal_ledger_xlsx.py @@ -11,8 +11,8 @@ class JournalLedgerXslx(models.AbstractModel): _inherit = 'report.account_financial_report.abstract_report_xlsx' def _get_report_name(self, report): - return _('Journal Ledger - %s - %s') % ( - report.company_id.name, report.company_id.currency_id.name) + report_name = _('Journal Ledger') + return self._get_report_complete_name(report, report_name) def _get_report_columns(self, report): columns = [ diff --git a/account_financial_report/report/open_items_xlsx.py b/account_financial_report/report/open_items_xlsx.py index a1ef4e25..8bb2dcde 100644 --- a/account_financial_report/report/open_items_xlsx.py +++ b/account_financial_report/report/open_items_xlsx.py @@ -10,8 +10,8 @@ class OpenItemsXslx(models.AbstractModel): _inherit = 'report.account_financial_report.abstract_report_xlsx' def _get_report_name(self, report): - return _('Open Items - %s - %s') % ( - report.company_id.name, report.company_id.currency_id.name) + report_name = _('Open Items') + return self._get_report_complete_name(report, report_name) def _get_report_columns(self, report): res = { diff --git a/account_financial_report/report/trial_balance_xlsx.py b/account_financial_report/report/trial_balance_xlsx.py index 31d8c9a2..9f5909ce 100644 --- a/account_financial_report/report/trial_balance_xlsx.py +++ b/account_financial_report/report/trial_balance_xlsx.py @@ -11,8 +11,8 @@ class TrialBalanceXslx(models.AbstractModel): _inherit = 'report.account_financial_report.abstract_report_xlsx' def _get_report_name(self, report): - return _('Trial Balance - %s - %s') % ( - report.company_id.name, report.company_id.currency_id.name) + report_name = _('Trial Balance') + return self._get_report_complete_name(report, report_name) def _get_report_columns(self, report): if not report.show_partner_details: diff --git a/account_financial_report/report/vat_report_xlsx.py b/account_financial_report/report/vat_report_xlsx.py index 5dd1951b..6c4674f2 100644 --- a/account_financial_report/report/vat_report_xlsx.py +++ b/account_financial_report/report/vat_report_xlsx.py @@ -9,8 +9,8 @@ class VATReportXslx(models.AbstractModel): _inherit = 'report.account_financial_report.abstract_report_xlsx' def _get_report_name(self, report): - return _('VAT Report - %s - %s') % ( - report.company_id.name, report.company_id.currency_id.name) + report_name = _('VAT Report') + return self._get_report_complete_name(report, report_name) def _get_report_columns(self, report): return {