From 3577ef49001c665e4abe99e231ab5c950482abd7 Mon Sep 17 00:00:00 2001 From: "Omar (Comunitea)" Date: Mon, 11 Apr 2022 17:48:01 +0200 Subject: [PATCH] [IMP] account_financial_report: Completes the functionality of hide_parent_hierarchy_level field and fix the level of accounts for trial balance --- account_financial_report/README.rst | 2 ++ account_financial_report/__manifest__.py | 2 +- account_financial_report/readme/CONTRIBUTORS.rst | 2 ++ .../report/templates/trial_balance.xml | 14 ++++++-------- account_financial_report/report/trial_balance.py | 4 +++- .../report/trial_balance_xlsx.py | 13 +++++++------ .../static/description/index.html | 2 ++ 7 files changed, 23 insertions(+), 16 deletions(-) diff --git a/account_financial_report/README.rst b/account_financial_report/README.rst index c4443e84..de22499e 100644 --- a/account_financial_report/README.rst +++ b/account_financial_report/README.rst @@ -138,6 +138,8 @@ Contributors * Valentin Vinagre * Lois Rilo +* Saran Lim. +* Omar Castiñeira Much of the work in this module was done at a sprint in Sorrento, Italy in April 2016. diff --git a/account_financial_report/__manifest__.py b/account_financial_report/__manifest__.py index bfd4da1e..4d55b4dc 100644 --- a/account_financial_report/__manifest__.py +++ b/account_financial_report/__manifest__.py @@ -6,7 +6,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Account Financial Reports", - "version": "15.0.2.2.0", + "version": "15.0.2.3.0", "category": "Reporting", "summary": "OCA Financial Reports", "author": "Camptocamp SA," diff --git a/account_financial_report/readme/CONTRIBUTORS.rst b/account_financial_report/readme/CONTRIBUTORS.rst index 36de804b..f0bb7b8b 100644 --- a/account_financial_report/readme/CONTRIBUTORS.rst +++ b/account_financial_report/readme/CONTRIBUTORS.rst @@ -31,6 +31,8 @@ * Valentin Vinagre * Lois Rilo +* Saran Lim. +* Omar Castiñeira Much of the work in this module was done at a sprint in Sorrento, Italy in April 2016. diff --git a/account_financial_report/report/templates/trial_balance.xml b/account_financial_report/report/templates/trial_balance.xml index 411ccc17..6a3e6cbb 100644 --- a/account_financial_report/report/templates/trial_balance.xml +++ b/account_financial_report/report/templates/trial_balance.xml @@ -46,15 +46,13 @@ - - + + - - + t-call="account_financial_report.report_trial_balance_line" + /> diff --git a/account_financial_report/report/trial_balance.py b/account_financial_report/report/trial_balance.py index 6b0e903b..5b763d1c 100644 --- a/account_financial_report/report/trial_balance.py +++ b/account_financial_report/report/trial_balance.py @@ -544,7 +544,9 @@ class TrialBalanceReport(models.AbstractModel): account_group_relation = {} for account in accounts: accounts_data[account.id]["complete_code"] = ( - account.group_id.complete_code if account.group_id.id else "" + account.group_id.complete_code + " / " + account.code + if account.group_id.id + else "" ) if account.group_id.id: if account.group_id.id not in account_group_relation.keys(): diff --git a/account_financial_report/report/trial_balance_xlsx.py b/account_financial_report/report/trial_balance_xlsx.py index 5622b2ac..a15427e4 100644 --- a/account_financial_report/report/trial_balance_xlsx.py +++ b/account_financial_report/report/trial_balance_xlsx.py @@ -188,6 +188,7 @@ class TrialBalanceXslx(models.AbstractModel): show_hierarchy_level = res_data["show_hierarchy_level"] foreign_currency = res_data["foreign_currency"] limit_hierarchy_level = res_data["limit_hierarchy_level"] + hide_parent_hierarchy_level = res_data["hide_parent_hierarchy_level"] if not show_partner_details: # Display array header for account lines self.write_array_header(report_data) @@ -195,12 +196,12 @@ class TrialBalanceXslx(models.AbstractModel): # For each account if not show_partner_details: for balance in trial_balance: - if show_hierarchy: - if limit_hierarchy_level: - if show_hierarchy_level > balance["level"]: - # Display account lines - self.write_line_from_dict(balance, report_data) - else: + if show_hierarchy and limit_hierarchy_level: + if show_hierarchy_level > balance["level"] and ( + not hide_parent_hierarchy_level + or (show_hierarchy_level - 1) == balance["level"] + ): + # Display account lines self.write_line_from_dict(balance, report_data) else: self.write_line_from_dict(balance, report_data) diff --git a/account_financial_report/static/description/index.html b/account_financial_report/static/description/index.html index 4d964e00..64801c12 100644 --- a/account_financial_report/static/description/index.html +++ b/account_financial_report/static/description/index.html @@ -494,6 +494,8 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Lois Rilo <lois.rilo@forgeflow.com>
  • +
  • Saran Lim. <saranl@ecosoft.co.th>
  • +
  • Omar Castiñeira <omar@comunitea.com>
  • Much of the work in this module was done at a sprint in Sorrento, Italy in April 2016.