From 08e850b9123d2aebe3f2181d86a4d450ee418103 Mon Sep 17 00:00:00 2001 From: Jordi Ballester Alomar Date: Fri, 26 Apr 2019 07:01:08 +0200 Subject: [PATCH] account_financial_report_qweb: add option to hide parent hierarchy levels --- account_financial_report_qweb/README.rst | 7 ++----- account_financial_report_qweb/__manifest__.py | 2 +- account_financial_report_qweb/readme/HISTORY.rst | 6 ++++++ .../report/trial_balance.py | 15 ++++++++++++--- .../wizard/trial_balance_wizard.py | 3 +++ .../wizard/trial_balance_wizard_view.xml | 1 + 6 files changed, 25 insertions(+), 9 deletions(-) diff --git a/account_financial_report_qweb/README.rst b/account_financial_report_qweb/README.rst index 3f000380..9dc40a39 100644 --- a/account_financial_report_qweb/README.rst +++ b/account_financial_report_qweb/README.rst @@ -50,13 +50,10 @@ currency balances are not available. Changelog ========= -10.0.3.0.0 (2019-01-09) +10.0.3.1.0 (2019-04-26) ~~~~~~~~~~~~~~~~~~~~~~~ -* Improve multicompany related usability. -* Improve performance in the General Ledger. -* The reports now display an improved title that includes report name, - company and currency. +* In the Trial Balance you have an option to hide parent hierarchy levels 10.0.2.0.0 (2018-11-29) diff --git a/account_financial_report_qweb/__manifest__.py b/account_financial_report_qweb/__manifest__.py index 6df46772..8db3dd77 100644 --- a/account_financial_report_qweb/__manifest__.py +++ b/account_financial_report_qweb/__manifest__.py @@ -5,7 +5,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'QWeb Financial Reports', - 'version': '10.0.3.0.1', + 'version': '10.0.3.1.0', 'category': 'Reporting', 'summary': 'OCA Financial Reports', 'author': 'Camptocamp SA,' diff --git a/account_financial_report_qweb/readme/HISTORY.rst b/account_financial_report_qweb/readme/HISTORY.rst index 5df73869..1307dc98 100644 --- a/account_financial_report_qweb/readme/HISTORY.rst +++ b/account_financial_report_qweb/readme/HISTORY.rst @@ -1,3 +1,9 @@ +10.0.3.1.0 (2019-04-26) +~~~~~~~~~~~~~~~~~~~~~~~ + +* In the Trial Balance you have an option to hide parent hierarchy levels + + 10.0.3.0.0 (2019-01-09) ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/account_financial_report_qweb/report/trial_balance.py b/account_financial_report_qweb/report/trial_balance.py index a3d085a6..f76288d1 100644 --- a/account_financial_report_qweb/report/trial_balance.py +++ b/account_financial_report_qweb/report/trial_balance.py @@ -47,6 +47,8 @@ class TrialBalanceReport(models.TransientModel): limit_hierarchy_level = fields.Boolean('Limit hierarchy levels') show_hierarchy_level = fields.Integer('Hierarchy Levels to display', default=1) + hide_parent_hierarchy_level = fields.Boolean( + 'Do not display parent levels', default=False) # General Ledger Report Data fields, # used as base for compute the data reports general_ledger_id = fields.Many2one( @@ -126,9 +128,16 @@ class TrialBalanceReportAccount(models.TransientModel): not rec.debit and not rec.credit): rec.hide_line = True - elif report.limit_hierarchy_level and \ - rec.level > report.show_hierarchy_level: - rec.hide_line = True + elif report.limit_hierarchy_level and report.show_hierarchy_level: + if report.hide_parent_hierarchy_level: + distinct_level = rec.level != report.show_hierarchy_level + if rec.account_group_id and distinct_level: + rec.hide_line = True + elif rec.level and distinct_level: + rec.hide_line = True + elif not report.hide_parent_hierarchy_level and \ + rec.level > report.show_hierarchy_level: + rec.hide_line = True class TrialBalanceReportPartner(models.TransientModel): diff --git a/account_financial_report_qweb/wizard/trial_balance_wizard.py b/account_financial_report_qweb/wizard/trial_balance_wizard.py index 433c326f..7b0ee3ef 100644 --- a/account_financial_report_qweb/wizard/trial_balance_wizard.py +++ b/account_financial_report_qweb/wizard/trial_balance_wizard.py @@ -50,6 +50,8 @@ class TrialBalanceReportWizard(models.TransientModel): limit_hierarchy_level = fields.Boolean('Limit hierarchy levels') show_hierarchy_level = fields.Integer('Hierarchy Levels to display', default=1) + hide_parent_hierarchy_level = fields.Boolean( + 'Do not display parent levels', default=False) account_ids = fields.Many2many( comodel_name='account.account', string='Filter accounts', @@ -231,6 +233,7 @@ class TrialBalanceReportWizard(models.TransientModel): 'fy_start_date': self.fy_start_date, 'hierarchy_on': self.hierarchy_on, 'limit_hierarchy_level': self.limit_hierarchy_level, + 'hide_parent_hierarchy_level': self.hide_parent_hierarchy_level, 'show_hierarchy_level': self.show_hierarchy_level, 'show_partner_details': self.show_partner_details, } diff --git a/account_financial_report_qweb/wizard/trial_balance_wizard_view.xml b/account_financial_report_qweb/wizard/trial_balance_wizard_view.xml index e90b1415..18884fab 100644 --- a/account_financial_report_qweb/wizard/trial_balance_wizard_view.xml +++ b/account_financial_report_qweb/wizard/trial_balance_wizard_view.xml @@ -26,6 +26,7 @@ +