Browse Source

account_financial_report: add option to hide parent hierarchy levels

pull/541/head
Jordi Ballester Alomar 6 years ago
parent
commit
3ff743c589
  1. 6
      account_financial_report/README.rst
  2. 2
      account_financial_report/__manifest__.py
  3. 5
      account_financial_report/readme/HISTORY.rst
  4. 15
      account_financial_report/report/trial_balance.py
  5. 3
      account_financial_report/wizard/trial_balance_wizard.py
  6. 1
      account_financial_report/wizard/trial_balance_wizard_view.xml

6
account_financial_report/README.rst

@ -50,6 +50,12 @@ currency balances are not available.
Changelog
=========
11.0.2.5.0 (2019-04-26)
~~~~~~~~~~~~~~~~~~~~~~~
* In the Trial Balance you have an option to hide parent hierarchy levels
11.0.2.4.1 (2019-01-08)
~~~~~~~~~~~~~~~~~~~~~~~

2
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.3',
'version': '11.0.2.5.0',
'category': 'Reporting',
'summary': 'OCA Financial Reports',
'author': 'Camptocamp SA,'

5
account_financial_report/readme/HISTORY.rst

@ -1,3 +1,8 @@
11.0.2.5.0 (2019-04-26)
~~~~~~~~~~~~~~~~~~~~~~~
* In the Trial Balance you have an option to hide parent hierarchy levels
11.0.2.4.1 (2019-01-08)
~~~~~~~~~~~~~~~~~~~~~~~

15
account_financial_report/report/trial_balance.py

@ -48,6 +48,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(
@ -136,9 +138,16 @@ class TrialBalanceReportAccount(models.TransientModel):
and float_is_zero(rec.debit, precision_rounding=r)
and float_is_zero(rec.credit, precision_rounding=r)):
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):

3
account_financial_report/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',
@ -230,6 +232,7 @@ class TrialBalanceReportWizard(models.TransientModel):
'hierarchy_on': self.hierarchy_on,
'limit_hierarchy_level': self.limit_hierarchy_level,
'show_hierarchy_level': self.show_hierarchy_level,
'hide_parent_hierarchy_level': self.hide_parent_hierarchy_level,
'show_partner_details': self.show_partner_details,
}

1
account_financial_report/wizard/trial_balance_wizard_view.xml

@ -25,6 +25,7 @@
<field name="hierarchy_on" widget="radio" attrs="{'invisible':[('show_partner_details','=',True)]}"/>
<field name="limit_hierarchy_level" attrs="{'invisible':['|', ('hierarchy_on','=','none'),('show_partner_details','=',True)]}"/>
<field name="show_hierarchy_level" attrs="{'invisible':[('limit_hierarchy_level','=', False)]}"/>
<field name="hide_parent_hierarchy_level" attrs="{'invisible':[('limit_hierarchy_level','=', False)]}"/>
<field name="foreign_currency"/>
</group>
</group>

Loading…
Cancel
Save