Browse Source

Merge pull request #484 from Eficent/11.0-afr-trial_balance_level

[11.0][account_financial_report][IMP] Refactoring
pull/493/head
Jordi Ballester Alomar 6 years ago
committed by GitHub
parent
commit
3a55c31f20
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 79
      account_financial_report/README.rst
  2. 3
      account_financial_report/__manifest__.py
  3. 19
      account_financial_report/readme/CONTRIBUTORS.rst
  4. 16
      account_financial_report/readme/DESCRIPTION.rst
  5. 6
      account_financial_report/readme/HISTORY.rst
  6. 23
      account_financial_report/report/abstract_report_xlsx.py
  7. 361
      account_financial_report/report/general_ledger.py
  8. 51
      account_financial_report/report/general_ledger_xlsx.py
  9. 4
      account_financial_report/report/open_items.py
  10. 2
      account_financial_report/report/open_items_xlsx.py
  11. 26
      account_financial_report/report/templates/general_ledger.xml
  12. 4
      account_financial_report/report/templates/open_items.xml
  13. 34
      account_financial_report/report/templates/trial_balance.xml
  14. 42
      account_financial_report/report/trial_balance.py
  15. 11
      account_financial_report/report/trial_balance_xlsx.py
  16. 446
      account_financial_report/static/description/index.html
  17. 41
      account_financial_report/tests/test_general_ledger.py
  18. 4
      account_financial_report/tests/test_open_items.py
  19. 20
      account_financial_report/tests/test_trial_balance.py
  20. 3
      account_financial_report/wizard/aged_partner_balance_wizard.py
  21. 12
      account_financial_report/wizard/aged_partner_balance_wizard_view.xml
  22. 13
      account_financial_report/wizard/general_ledger_wizard.py
  23. 27
      account_financial_report/wizard/general_ledger_wizard_view.xml
  24. 9
      account_financial_report/wizard/journal_ledger_wizard.py
  25. 9
      account_financial_report/wizard/open_items_wizard.py
  26. 13
      account_financial_report/wizard/open_items_wizard_view.xml
  27. 17
      account_financial_report/wizard/trial_balance_wizard.py
  28. 15
      account_financial_report/wizard/trial_balance_wizard_view.xml

79
account_financial_report/README.rst

@ -1,10 +1,29 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html
=========================
Account Financial Reports
=========================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-reporting/tree/11.0/account_financial_report
:alt: OCA/account-financial-reporting
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-reporting-11-0/account-financial-reporting-11-0-account_financial_report
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/91/11.0
:alt: Try me on Runbot
======================
QWeb Financial Reports
======================
|badge1| |badge2| |badge3| |badge4| |badge5|
This module adds a set of financial reports. They are accessible under This module adds a set of financial reports. They are accessible under
Accounting / Reporting / OCA Reports. Accounting / Reporting / OCA Reports.
@ -14,6 +33,7 @@ Accounting / Reporting / OCA Reports.
- Open Items - Open Items
- Aged Partner Balance - Aged Partner Balance
- VAT Report - VAT Report
- Journal Ledger
Currently General ledger, Trial Balance and Open Items are fully compatible with a foreign Currently General ledger, Trial Balance and Open Items are fully compatible with a foreign
currency set up in account in order to display balances. Moreover, any foreign currency set up in account in order to display balances. Moreover, any foreign
@ -22,29 +42,44 @@ currency used in account move lines is properly shown.
In case that in an account has not been configured a second currency foreign In case that in an account has not been configured a second currency foreign
currency balances are not available. currency balances are not available.
**Table of contents**
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/91/11.0
.. contents::
:local:
Changelog
=========
11.0.2.3.1 (2018-11-29)
~~~~~~~~~~~~~~~~~~~~~~~
* In the Trial Balance you can apply a filter by hierarchy levels
* In the General Ledger you can apply a filter by Analytic Tag
* In the Journal Ledger the field 'Journal' is now optional
Bug Tracker Bug Tracker
=========== ===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/account-financial-reporting/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-reporting/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-reporting/issues/new?body=module:%20account_financial_report%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits Credits
======= =======
Images
------
Authors
~~~~~~~
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
* Camptocamp SA
* initOS GmbH
* redCOR AG
* Eficent
Contributors Contributors
------------
~~~~~~~~~~~~
* Jordi Ballester <jordi.ballester@eficient.com> * Jordi Ballester <jordi.ballester@eficient.com>
* Yannick Vaucher <yannick.vaucher@camptocamp.com> * Yannick Vaucher <yannick.vaucher@camptocamp.com>
@ -66,17 +101,19 @@ Contributors
Much of the work in this module was done at a sprint in Sorrento, Italy in Much of the work in this module was done at a sprint in Sorrento, Italy in
April 2016. April 2016.
Maintainer
----------
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png .. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association :alt: Odoo Community Association
:target: https://odoo-community.org :target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.
This module is part of the `OCA/account-financial-reporting <https://github.com/OCA/account-financial-reporting/tree/11.0/account_financial_report>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

3
account_financial_report/__manifest__.py

@ -4,12 +4,13 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
'name': 'Account Financial Reports', 'name': 'Account Financial Reports',
'version': '11.0.2.2.2',
'version': '11.0.2.3.1',
'category': 'Reporting', 'category': 'Reporting',
'summary': 'OCA Financial Reports', 'summary': 'OCA Financial Reports',
'author': 'Camptocamp SA,' 'author': 'Camptocamp SA,'
'initOS GmbH,' 'initOS GmbH,'
'redCOR AG,' 'redCOR AG,'
'Eficent,'
'Odoo Community Association (OCA)', 'Odoo Community Association (OCA)',
"website": "https://odoo-community.org/", "website": "https://odoo-community.org/",
'depends': [ 'depends': [

19
account_financial_report/readme/CONTRIBUTORS.rst

@ -0,0 +1,19 @@
* Jordi Ballester <jordi.ballester@eficient.com>
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
* Simone Orsi <simone.orsi@abstract.com>
* Leonardo Pistone <leonardo.pistone@camptocamp.com>
* Damien Crier <damien.crier@camptocamp.com>
* Andrea Stirpe <a.stirpe@onestein.nl>
* Thomas Rehn <thomas.rehn@initos.com>
* Andrea Gallina <4everamd@gmail.com>
* Robert Rottermann <robert@redcor.ch>
* Ciro Urselli <c.urselli@apuliasoftware.it>
* Francesco Apruzzese <opencode@e-ware.org>
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
* Julien Coux <julien.coux@camptocamp.com>
* Akim Juillerat <akim.juillerat@camptocamp.com>
* Alexis de Lattre <alexis@via.ecp.fr>
* Mihai Fekete <feketemihai@gmail.com>
Much of the work in this module was done at a sprint in Sorrento, Italy in
April 2016.

16
account_financial_report/readme/DESCRIPTION.rst

@ -0,0 +1,16 @@
This module adds a set of financial reports. They are accessible under
Accounting / Reporting / OCA Reports.
- General ledger
- Trial Balance
- Open Items
- Aged Partner Balance
- VAT Report
- Journal Ledger
Currently General ledger, Trial Balance and Open Items are fully compatible with a foreign
currency set up in account in order to display balances. Moreover, any foreign
currency used in account move lines is properly shown.
In case that in an account has not been configured a second currency foreign
currency balances are not available.

6
account_financial_report/readme/HISTORY.rst

@ -0,0 +1,6 @@
11.0.2.3.1 (2018-11-29)
~~~~~~~~~~~~~~~~~~~~~~~
* In the Trial Balance you can apply a filter by hierarchy levels
* In the General Ledger you can apply a filter by Analytic Tag
* In the Journal Ledger the field 'Journal' is now optional

23
account_financial_report/report/abstract_report_xlsx.py

@ -103,6 +103,9 @@ class AbstractReportXslx(models.AbstractModel):
self.format_amount = workbook.add_format() self.format_amount = workbook.add_format()
self.format_amount.set_num_format( self.format_amount.set_num_format(
'#,##0.'+'0'*currency_id.decimal_places) '#,##0.'+'0'*currency_id.decimal_places)
self.format_amount_bold = workbook.add_format({'bold': True})
self.format_amount_bold.set_num_format(
'#,##0.' + '0' * currency_id.decimal_places)
self.format_percent_bold_italic = workbook.add_format( self.format_percent_bold_italic = workbook.add_format(
{'bold': True, 'italic': True} {'bold': True, 'italic': True}
) )
@ -190,10 +193,20 @@ class AbstractReportXslx(models.AbstractModel):
self.sheet.write_string( self.sheet.write_string(
self.row_pos, col_pos, value.name or '', self.format_right) self.row_pos, col_pos, value.name or '', self.format_right)
elif cell_type == 'string': elif cell_type == 'string':
if hasattr(line_object, 'account_group_id') and \
line_object.account_group_id:
self.sheet.write_string(self.row_pos, col_pos, value or '',
self.format_bold)
else:
self.sheet.write_string(self.row_pos, col_pos, value or '') self.sheet.write_string(self.row_pos, col_pos, value or '')
elif cell_type == 'amount': elif cell_type == 'amount':
if hasattr(line_object, 'account_group_id') and \
line_object.account_group_id:
cell_format = self.format_amount_bold
else:
cell_format = self.format_amount
self.sheet.write_number( self.sheet.write_number(
self.row_pos, col_pos, float(value), self.format_amount
self.row_pos, col_pos, float(value), cell_format
) )
elif cell_type == 'amount_currency': elif cell_type == 'amount_currency':
if line_object.currency_id: if line_object.currency_id:
@ -291,10 +304,16 @@ class AbstractReportXslx(models.AbstractModel):
def _get_currency_amt_format(self, line_object): def _get_currency_amt_format(self, line_object):
""" Return amount format specific for each currency. """ """ Return amount format specific for each currency. """
if hasattr(line_object, 'account_group_id') and \
line_object.account_group_id:
format_amt = getattr(self, 'format_amount_bold')
field_prefix = 'format_amount_bold'
else:
format_amt = getattr(self, 'format_amount') format_amt = getattr(self, 'format_amount')
field_prefix = 'format_amount'
if line_object.currency_id: if line_object.currency_id:
field_name = \ field_name = \
'format_amount_%s' % line_object.currency_id.name
'%s_%s' % (field_prefix, line_object.currency_id.name)
if hasattr(self, field_name): if hasattr(self, field_name):
format_amt = getattr(self, field_name) format_amt = getattr(self, field_name)
else: else:

361
account_financial_report/report/general_ledger.py

@ -29,14 +29,18 @@ class GeneralLedgerReport(models.TransientModel):
date_to = fields.Date() date_to = fields.Date()
fy_start_date = fields.Date() fy_start_date = fields.Date()
only_posted_moves = fields.Boolean() only_posted_moves = fields.Boolean()
hide_account_balance_at_0 = fields.Boolean()
hide_account_at_0 = fields.Boolean()
foreign_currency = fields.Boolean() foreign_currency = fields.Boolean()
show_analytic_tags = fields.Boolean()
company_id = fields.Many2one(comodel_name='res.company') company_id = fields.Many2one(comodel_name='res.company')
filter_account_ids = fields.Many2many(comodel_name='account.account') filter_account_ids = fields.Many2many(comodel_name='account.account')
filter_partner_ids = fields.Many2many(comodel_name='res.partner') filter_partner_ids = fields.Many2many(comodel_name='res.partner')
filter_cost_center_ids = fields.Many2many( filter_cost_center_ids = fields.Many2many(
comodel_name='account.analytic.account' comodel_name='account.analytic.account'
) )
filter_analytic_tag_ids = fields.Many2many(
comodel_name='account.analytic.tag',
)
filter_journal_ids = fields.Many2many( filter_journal_ids = fields.Many2many(
comodel_name='account.journal', comodel_name='account.journal',
) )
@ -194,6 +198,7 @@ class GeneralLedgerReportMoveLine(models.TransientModel):
partner = fields.Char() partner = fields.Char()
label = fields.Char() label = fields.Char()
cost_center = fields.Char() cost_center = fields.Char()
tags = fields.Char()
matching_number = fields.Char() matching_number = fields.Char()
debit = fields.Float(digits=(16, 2)) debit = fields.Float(digits=(16, 2))
credit = fields.Float(digits=(16, 2)) credit = fields.Float(digits=(16, 2))
@ -278,6 +283,10 @@ class GeneralLedgerReportCompute(models.TransientModel):
if self.centralize: if self.centralize:
self._inject_line_centralized_values() self._inject_line_centralized_values()
if self.show_analytic_tags:
# Compute analytic tags
self._compute_analytic_tags()
# Refresh cache because all data are computed with SQL requests # Refresh cache because all data are computed with SQL requests
self.invalidate_cache() self.invalidate_cache()
@ -336,6 +345,11 @@ class GeneralLedgerReportCompute(models.TransientModel):
ml.analytic_account_id = aa.id ml.analytic_account_id = aa.id
AND aa.id IN %s AND aa.id IN %s
""" """
if self.filter_analytic_tag_ids:
sub_subquery_sum_amounts += """
INNER JOIN
move_lines_on_tags ON ml.id = move_lines_on_tags.ml_id
"""
sub_subquery_sum_amounts += """ sub_subquery_sum_amounts += """
LEFT JOIN LEFT JOIN
res_currency c ON a.currency_id = c.id res_currency c ON a.currency_id = c.id
@ -392,7 +406,11 @@ WITH
FROM FROM
account_account a account_account a
""" """
if self.filter_partner_ids or self.filter_cost_center_ids:
if (
self.filter_partner_ids or
self.filter_cost_center_ids or
self.filter_analytic_tag_ids
):
query_inject_account += """ query_inject_account += """
INNER JOIN INNER JOIN
account_move_line ml ON a.id = ml.account_id account_move_line ml ON a.id = ml.account_id
@ -410,6 +428,17 @@ WITH
ml.analytic_account_id = aa.id ml.analytic_account_id = aa.id
AND aa.id IN %s AND aa.id IN %s
""" """
if self.filter_analytic_tag_ids:
query_inject_account += """
INNER JOIN
account_analytic_tag_account_move_line_rel atml
ON atml.account_move_line_id = ml.id
INNER JOIN
account_analytic_tag aat
ON
atml.account_analytic_tag_id = aat.id
AND aat.id IN %s
"""
query_inject_account += """ query_inject_account += """
WHERE WHERE
a.company_id = %s a.company_id = %s
@ -425,11 +454,40 @@ WITH
AND AND
p.id IN %s p.id IN %s
""" """
if self.filter_partner_ids or self.filter_cost_center_ids:
if (
self.filter_partner_ids or
self.filter_cost_center_ids or
self.filter_analytic_tag_ids
):
query_inject_account += """ query_inject_account += """
GROUP BY GROUP BY
a.id a.id
""" """
query_inject_account += """
),
"""
if self.filter_analytic_tag_ids:
query_inject_account += """
move_lines_on_tags AS
(
SELECT
DISTINCT ml.id AS ml_id
FROM
accounts a
INNER JOIN
account_move_line ml
ON a.id = ml.account_id
INNER JOIN
account_analytic_tag_account_move_line_rel atml
ON atml.account_move_line_id = ml.id
INNER JOIN
account_analytic_tag aat
ON
atml.account_analytic_tag_id = aat.id
WHERE
aat.id IN %s
),
"""
init_subquery = self._get_final_account_sub_subquery_sum_amounts( init_subquery = self._get_final_account_sub_subquery_sum_amounts(
date_included=False date_included=False
@ -439,7 +497,6 @@ WITH
) )
query_inject_account += """ query_inject_account += """
),
initial_sum_amounts AS ( """ + init_subquery + """ ), initial_sum_amounts AS ( """ + init_subquery + """ ),
final_sum_amounts AS ( """ + final_subquery + """ ) final_sum_amounts AS ( """ + final_subquery + """ )
INSERT INTO INSERT INTO
@ -497,7 +554,7 @@ WHERE
OR f.balance IS NOT NULL AND f.balance != 0 OR f.balance IS NOT NULL AND f.balance != 0
) )
""" """
if self.hide_account_balance_at_0:
if self.hide_account_at_0:
query_inject_account += """ query_inject_account += """
AND AND
f.balance IS NOT NULL AND f.balance != 0 f.balance IS NOT NULL AND f.balance != 0
@ -507,6 +564,10 @@ AND
query_inject_account_params += ( query_inject_account_params += (
tuple(self.filter_cost_center_ids.ids), tuple(self.filter_cost_center_ids.ids),
) )
if self.filter_analytic_tag_ids:
query_inject_account_params += (
tuple(self.filter_analytic_tag_ids.ids),
)
query_inject_account_params += ( query_inject_account_params += (
self.company_id.id, self.company_id.id,
self.unaffected_earnings_account.id, self.unaffected_earnings_account.id,
@ -519,6 +580,10 @@ AND
query_inject_account_params += ( query_inject_account_params += (
tuple(self.filter_partner_ids.ids), tuple(self.filter_partner_ids.ids),
) )
if self.filter_analytic_tag_ids:
query_inject_account_params += (
tuple(self.filter_analytic_tag_ids.ids),
)
query_inject_account_params += ( query_inject_account_params += (
self.date_from, self.date_from,
self.fy_start_date, self.fy_start_date,
@ -619,6 +684,11 @@ AND
ml.analytic_account_id = aa.id ml.analytic_account_id = aa.id
AND aa.id IN %s AND aa.id IN %s
""" """
if self.filter_analytic_tag_ids:
sub_subquery_sum_amounts += """
INNER JOIN
move_lines_on_tags ON ml.id = move_lines_on_tags.ml_id
"""
sub_subquery_sum_amounts += """ sub_subquery_sum_amounts += """
GROUP BY GROUP BY
ap.account_id, ap.partner_id, c.id ap.account_id, ap.partner_id, c.id
@ -706,6 +776,17 @@ WITH
ml.analytic_account_id = aa.id ml.analytic_account_id = aa.id
AND aa.id IN %s AND aa.id IN %s
""" """
if self.filter_analytic_tag_ids:
query_inject_partner += """
INNER JOIN
account_analytic_tag_account_move_line_rel atml
ON atml.account_move_line_id = ml.id
INNER JOIN
account_analytic_tag aat
ON
atml.account_analytic_tag_id = aat.id
AND aat.id IN %s
"""
query_inject_partner += """ query_inject_partner += """
WHERE WHERE
ra.report_id = %s ra.report_id = %s
@ -750,6 +831,31 @@ WITH
p.id, p.id,
at.include_initial_balance at.include_initial_balance
), ),
"""
if self.filter_analytic_tag_ids:
query_inject_partner += """
move_lines_on_tags AS
(
SELECT
DISTINCT ml.id AS ml_id
FROM
accounts_partners ap
INNER JOIN
account_move_line ml
ON ap.account_id = ml.account_id
INNER JOIN
account_analytic_tag_account_move_line_rel atml
ON atml.account_move_line_id = ml.id
INNER JOIN
account_analytic_tag aat
ON
atml.account_analytic_tag_id = aat.id
WHERE
aat.id IN %s
),
"""
query_inject_partner += """
initial_sum_amounts AS ( """ + init_subquery + """ ), initial_sum_amounts AS ( """ + init_subquery + """ ),
final_sum_amounts AS ( """ + final_subquery + """ ) final_sum_amounts AS ( """ + final_subquery + """ )
INSERT INTO INSERT INTO
@ -829,7 +935,7 @@ WHERE
OR f.balance IS NOT NULL AND f.balance != 0 OR f.balance IS NOT NULL AND f.balance != 0
) )
""" """
if self.hide_account_balance_at_0:
if self.hide_account_at_0:
query_inject_partner += """ query_inject_partner += """
AND AND
f.balance IS NOT NULL AND f.balance != 0 f.balance IS NOT NULL AND f.balance != 0
@ -839,6 +945,10 @@ AND
query_inject_partner_params += ( query_inject_partner_params += (
tuple(self.filter_cost_center_ids.ids), tuple(self.filter_cost_center_ids.ids),
) )
if self.filter_analytic_tag_ids:
query_inject_partner_params += (
tuple(self.filter_analytic_tag_ids.ids),
)
query_inject_partner_params += ( query_inject_partner_params += (
self.id, self.id,
) )
@ -846,6 +956,10 @@ AND
query_inject_partner_params += ( query_inject_partner_params += (
tuple(self.filter_partner_ids.ids), tuple(self.filter_partner_ids.ids),
) )
if self.filter_analytic_tag_ids:
query_inject_partner_params += (
tuple(self.filter_analytic_tag_ids.ids),
)
query_inject_partner_params += ( query_inject_partner_params += (
self.date_from, self.date_from,
self.fy_start_date, self.fy_start_date,
@ -898,7 +1012,45 @@ AND
The "only_empty_partner_line" value is used The "only_empty_partner_line" value is used
to compute data without partner. to compute data without partner.
""" """
query_inject_move_line = """
query_inject_move_line = ""
if self.filter_analytic_tag_ids:
query_inject_move_line += """
WITH
move_lines_on_tags AS
(
SELECT
DISTINCT ml.id AS ml_id
FROM
"""
if is_account_line:
query_inject_move_line += """
report_general_ledger_account ra
"""
elif is_partner_line:
query_inject_move_line += """
report_general_ledger_partner rp
INNER JOIN
report_general_ledger_account ra
ON rp.report_account_id = ra.id
"""
query_inject_move_line += """
INNER JOIN
account_move_line ml
ON ra.account_id = ml.account_id
INNER JOIN
account_analytic_tag_account_move_line_rel atml
ON atml.account_move_line_id = ml.id
INNER JOIN
account_analytic_tag aat
ON
atml.account_analytic_tag_id = aat.id
WHERE
ra.report_id = %s
AND
aat.id IN %s
)
"""
query_inject_move_line += """
INSERT INTO INSERT INTO
report_general_ledger_move_line report_general_ledger_move_line
( (
@ -1072,6 +1224,11 @@ INNER JOIN
LEFT JOIN LEFT JOIN
account_analytic_account aa ON ml.analytic_account_id = aa.id account_analytic_account aa ON ml.analytic_account_id = aa.id
""" """
if self.filter_analytic_tag_ids:
query_inject_move_line += """
INNER JOIN
move_lines_on_tags ON ml.id = move_lines_on_tags.ml_id
"""
query_inject_move_line += """ query_inject_move_line += """
WHERE WHERE
ra.report_id = %s ra.report_id = %s
@ -1132,7 +1289,13 @@ ORDER BY
a.code, ml.date, ml.id a.code, ml.date, ml.id
""" """
query_inject_move_line_params = (
query_inject_move_line_params = ()
if self.filter_analytic_tag_ids:
query_inject_move_line_params += (
self.id,
tuple(self.filter_analytic_tag_ids.ids),
)
query_inject_move_line_params += (
self.env.uid, self.env.uid,
) )
if self.filter_cost_center_ids: if self.filter_cost_center_ids:
@ -1164,8 +1327,36 @@ ORDER BY
Only centralized accounts are computed. Only centralized accounts are computed.
""" """
if self.filter_analytic_tag_ids:
query_inject_move_line_centralized = """
WITH
move_lines_on_tags AS
(
SELECT
DISTINCT ml.id AS ml_id
FROM
report_general_ledger_account ra
INNER JOIN
account_move_line ml
ON ra.account_id = ml.account_id
INNER JOIN
account_analytic_tag_account_move_line_rel atml
ON atml.account_move_line_id = ml.id
INNER JOIN
account_analytic_tag aat
ON
atml.account_analytic_tag_id = aat.id
WHERE
ra.report_id = %s
AND
aat.id IN %s
),
"""
else:
query_inject_move_line_centralized = """ query_inject_move_line_centralized = """
WITH WITH
"""
query_inject_move_line_centralized += """
move_lines AS move_lines AS
( (
SELECT SELECT
@ -1196,6 +1387,11 @@ WITH
ml.analytic_account_id = aa.id ml.analytic_account_id = aa.id
AND aa.id IN %s AND aa.id IN %s
""" """
if self.filter_analytic_tag_ids:
query_inject_move_line_centralized += """
INNER JOIN
move_lines_on_tags ON ml.id = move_lines_on_tags.ml_id
"""
query_inject_move_line_centralized += """ query_inject_move_line_centralized += """
WHERE WHERE
ra.report_id = %s ra.report_id = %s
@ -1267,6 +1463,11 @@ ORDER BY
""" """
query_inject_move_line_centralized_params = () query_inject_move_line_centralized_params = ()
if self.filter_analytic_tag_ids:
query_inject_move_line_centralized_params += (
self.id,
tuple(self.filter_analytic_tag_ids.ids),
)
if self.filter_cost_center_ids: if self.filter_cost_center_ids:
query_inject_move_line_centralized_params += ( query_inject_move_line_centralized_params += (
tuple(self.filter_cost_center_ids.ids), tuple(self.filter_cost_center_ids.ids),
@ -1287,6 +1488,76 @@ ORDER BY
query_inject_move_line_centralized_params query_inject_move_line_centralized_params
) )
def _compute_analytic_tags(self):
""" Compute "tags" column"""
query_update_analytic_tags = """
UPDATE
report_general_ledger_move_line
SET
tags = tags_values.tags
FROM
(
(
SELECT
rml.id AS report_id,
array_to_string(array_agg(t.name ORDER BY t.name), ',') AS tags
FROM
account_move_line ml
INNER JOIN
report_general_ledger_move_line rml
ON ml.id = rml.move_line_id
INNER JOIN
report_general_ledger_account ra
ON rml.report_account_id = ra.id
INNER JOIN
account_analytic_tag_account_move_line_rel tml
ON ml.id = tml.account_move_line_id
INNER JOIN
account_analytic_tag t
ON tml.account_analytic_tag_id = t.id
WHERE
ra.report_id = %(report_id)s
GROUP BY
rml.id,
ml.id
)
UNION
(
SELECT
rml.id AS report_id,
array_to_string(array_agg(t.name ORDER BY t.name), ',') AS tags
FROM
account_move_line ml
INNER JOIN
report_general_ledger_move_line rml
ON ml.id = rml.move_line_id
INNER JOIN
report_general_ledger_partner rp
ON rml.report_partner_id = rp.id
INNER JOIN
report_general_ledger_account ra
ON rp.report_account_id = ra.id
INNER JOIN
account_analytic_tag_account_move_line_rel tml
ON ml.id = tml.account_move_line_id
INNER JOIN
account_analytic_tag t
ON tml.account_analytic_tag_id = t.id
WHERE
ra.report_id = %(report_id)s
GROUP BY
rml.id,
ml.id
)
) AS tags_values
WHERE
report_general_ledger_move_line.id = tags_values.report_id
"""
params = {
'report_id': self.id,
}
self.env.cr.execute(query_update_analytic_tags, params)
def _inject_unaffected_earnings_account_values(self): def _inject_unaffected_earnings_account_values(self):
"""Inject the report values of the unaffected earnings account """Inject the report values of the unaffected earnings account
for report_general_ledger_account.""" for report_general_ledger_account."""
@ -1310,12 +1581,39 @@ ORDER BY
'date_to': fy_start_date, 'date_to': fy_start_date,
'company_id': self.company_id.id, 'company_id': self.company_id.id,
'account_ids': tuple(unaffected_earnings_account_ids), 'account_ids': tuple(unaffected_earnings_account_ids),
'analytic_tag_ids': tuple(self.filter_analytic_tag_ids.ids),
} }
query_select_previous_fy_unaffected_earnings = """
SELECT sum(aml.balance) as balance
FROM account_move_line as aml
query_select_previous_fy_unaffected_earnings = ''
q_analytic_tags = ''
if self.filter_analytic_tag_ids:
q_analytic_tags = """
WITH move_lines_on_tags AS
(
SELECT
DISTINCT ml.id AS ml_id
FROM
account_account a
INNER JOIN
account_move_line ml
ON a.id = ml.account_id
INNER JOIN
account_analytic_tag_account_move_line_rel atml
ON atml.account_move_line_id = ml.id
INNER JOIN
account_analytic_tag aat
ON
atml.account_analytic_tag_id = aat.id
WHERE
aat.id IN %(analytic_tag_ids)s
)
"""
query_select_previous_fy_unaffected_earnings += q_analytic_tags
query_select_previous_fy_unaffected_earnings += """
SELECT sum(ml.balance) as balance
FROM account_move_line as ml
INNER JOIN account_move as am INNER JOIN account_move as am
ON am.id = aml.move_id
ON am.id = ml.move_id
INNER JOIN account_journal j INNER JOIN account_journal j
ON am.journal_id = j.id ON am.journal_id = j.id
""" """
@ -1327,11 +1625,15 @@ ORDER BY
""" """
query_select_previous_fy_unaffected_earnings_params[ query_select_previous_fy_unaffected_earnings_params[
'cost_center_ids'] = tuple(self.filter_cost_center_ids.ids) 'cost_center_ids'] = tuple(self.filter_cost_center_ids.ids)
if self.filter_analytic_tag_ids:
query_select_previous_fy_unaffected_earnings += """ query_select_previous_fy_unaffected_earnings += """
WHERE aml.date < %(date_to)s
AND aml.company_id = %(company_id)s
AND aml.account_id IN %(account_ids)s
INNER JOIN move_lines_on_tags ON ml.id =
move_lines_on_tags.ml_id
"""
query_select_previous_fy_unaffected_earnings += """
WHERE ml.date < %(date_to)s
AND ml.company_id = %(company_id)s
AND ml.account_id IN %(account_ids)s
""" """
if self.filter_journal_ids: if self.filter_journal_ids:
query_select_previous_fy_unaffected_earnings += """ query_select_previous_fy_unaffected_earnings += """
@ -1355,15 +1657,19 @@ ORDER BY
'date_to': self.date_to, 'date_to': self.date_to,
'company_id': self.company_id.id, 'company_id': self.company_id.id,
'unaffected_earnings_id': self.unaffected_earnings_account.id, 'unaffected_earnings_id': self.unaffected_earnings_account.id,
'analytic_tag_ids': tuple(self.filter_analytic_tag_ids.ids),
} }
query_select_period_unaffected_earnings = """
query_select_period_unaffected_earnings = ''
if self.filter_analytic_tag_ids:
query_select_period_unaffected_earnings += q_analytic_tags
query_select_period_unaffected_earnings += """
SELECT SELECT
sum(aml.debit) as sum_debit,
sum(aml.credit) as sum_credit,
sum(aml.balance) as balance
FROM account_move_line as aml
sum(ml.debit) as sum_debit,
sum(ml.credit) as sum_credit,
sum(ml.balance) as balance
FROM account_move_line as ml
INNER JOIN account_move as am INNER JOIN account_move as am
ON am.id = aml.move_id
ON am.id = ml.move_id
INNER JOIN account_journal j INNER JOIN account_journal j
ON am.journal_id = j.id ON am.journal_id = j.id
""" """
@ -1375,11 +1681,16 @@ ORDER BY
""" """
query_select_period_unaffected_earnings_params[ query_select_period_unaffected_earnings_params[
'cost_center_ids'] = tuple(self.filter_cost_center_ids.ids) 'cost_center_ids'] = tuple(self.filter_cost_center_ids.ids)
if self.filter_analytic_tag_ids:
query_select_period_unaffected_earnings += """
INNER JOIN move_lines_on_tags
ON ml.id = move_lines_on_tags.ml_id
"""
query_select_period_unaffected_earnings += """ query_select_period_unaffected_earnings += """
WHERE am.date >= %(date_from)s WHERE am.date >= %(date_from)s
AND aml.date <= %(date_to)s
AND aml.company_id = %(company_id)s
AND aml.account_id = %(unaffected_earnings_id)s
AND ml.date <= %(date_to)s
AND ml.company_id = %(company_id)s
AND ml.account_id = %(unaffected_earnings_id)s
""" """
if self.filter_journal_ids: if self.filter_journal_ids:
query_select_period_unaffected_earnings += """ query_select_period_unaffected_earnings += """

51
account_financial_report/report/general_ledger_xlsx.py

@ -28,20 +28,23 @@ class GeneralLedgerXslx(models.AbstractModel):
7: {'header': _('Cost center'), 7: {'header': _('Cost center'),
'field': 'cost_center', 'field': 'cost_center',
'width': 15}, 'width': 15},
8: {'header': _('Rec.'), 'field': 'matching_number', 'width': 5},
9: {'header': _('Debit'),
8: {'header': _('Tags'),
'field': 'tags',
'width': 10},
9: {'header': _('Rec.'), 'field': 'matching_number', 'width': 5},
10: {'header': _('Debit'),
'field': 'debit', 'field': 'debit',
'field_initial_balance': 'initial_debit', 'field_initial_balance': 'initial_debit',
'field_final_balance': 'final_debit', 'field_final_balance': 'final_debit',
'type': 'amount', 'type': 'amount',
'width': 14}, 'width': 14},
10: {'header': _('Credit'),
11: {'header': _('Credit'),
'field': 'credit', 'field': 'credit',
'field_initial_balance': 'initial_credit', 'field_initial_balance': 'initial_credit',
'field_final_balance': 'final_credit', 'field_final_balance': 'final_credit',
'type': 'amount', 'type': 'amount',
'width': 14}, 'width': 14},
11: {'header': _('Cumul. Bal.'),
12: {'header': _('Cumul. Bal.'),
'field': 'cumul_balance', 'field': 'cumul_balance',
'field_initial_balance': 'initial_balance', 'field_initial_balance': 'initial_balance',
'field_final_balance': 'final_balance', 'field_final_balance': 'final_balance',
@ -50,11 +53,11 @@ class GeneralLedgerXslx(models.AbstractModel):
} }
if report.foreign_currency: if report.foreign_currency:
foreign_currency = { foreign_currency = {
12: {'header': _('Cur.'),
13: {'header': _('Cur.'),
'field': 'currency_id', 'field': 'currency_id',
'field_currency_balance': 'currency_id', 'field_currency_balance': 'currency_id',
'type': 'many2one', 'width': 7}, 'type': 'many2one', 'width': 7},
13: {'header': _('Amount cur.'),
14: {'header': _('Amount cur.'),
'field': 'amount_currency', 'field': 'amount_currency',
'field_initial_balance': 'field_initial_balance':
'initial_balance_foreign_currency', 'initial_balance_foreign_currency',
@ -68,17 +71,31 @@ class GeneralLedgerXslx(models.AbstractModel):
def _get_report_filters(self, report): def _get_report_filters(self, report):
return [ return [
[_('Date range filter'),
_('From: %s To: %s') % (report.date_from, report.date_to)],
[_('Target moves filter'),
_('All posted entries') if report.only_posted_moves else _(
'All entries')],
[_('Account balance at 0 filter'),
_('Hide') if report.hide_account_balance_at_0 else _('Show')],
[_('Centralize filter'),
_('Yes') if report.centralize else _('No')],
[_('Show foreign currency'),
_('Yes') if report.foreign_currency else _('No')],
[
_('Date range filter'),
_('From: %s To: %s') % (report.date_from, report.date_to),
],
[
_('Target moves filter'),
_('All posted entries') if report.only_posted_moves
else _('All entries'),
],
[
_('Account balance at 0 filter'),
_('Hide') if report.hide_account_at_0 else _('Show'),
],
[
_('Centralize filter'),
_('Yes') if report.centralize else _('No'),
],
[
_('Show analytic tags'),
_('Yes') if report.show_analytic_tags else _('No'),
],
[
_('Show foreign currency'),
_('Yes') if report.foreign_currency else _('No')
],
] ]
def _get_col_count_filter_name(self): def _get_col_count_filter_name(self):

4
account_financial_report/report/open_items.py

@ -22,7 +22,7 @@ class OpenItemsReport(models.TransientModel):
# Filters fields, used for data computation # Filters fields, used for data computation
date_at = fields.Date() date_at = fields.Date()
only_posted_moves = fields.Boolean() only_posted_moves = fields.Boolean()
hide_account_balance_at_0 = fields.Boolean()
hide_account_at_0 = fields.Boolean()
foreign_currency = fields.Boolean() foreign_currency = fields.Boolean()
company_id = fields.Many2one(comodel_name='res.company') company_id = fields.Many2one(comodel_name='res.company')
filter_account_ids = fields.Many2many(comodel_name='account.account') filter_account_ids = fields.Many2many(comodel_name='account.account')
@ -188,7 +188,7 @@ class OpenItemsReportCompute(models.TransientModel):
self._inject_line_values(only_empty_partner_line=True) self._inject_line_values(only_empty_partner_line=True)
self._clean_partners_and_accounts() self._clean_partners_and_accounts()
self._compute_partners_and_accounts_cumul() self._compute_partners_and_accounts_cumul()
if self.hide_account_balance_at_0:
if self.hide_account_at_0:
self._clean_partners_and_accounts( self._clean_partners_and_accounts(
only_delete_account_balance_at_0=True only_delete_account_balance_at_0=True
) )

2
account_financial_report/report/open_items_xlsx.py

@ -59,7 +59,7 @@ class OpenItemsXslx(models.AbstractModel):
_('All posted entries') if report.only_posted_moves else _( _('All posted entries') if report.only_posted_moves else _(
'All entries')], 'All entries')],
[_('Account balance at 0 filter'), [_('Account balance at 0 filter'),
_('Hide') if report.hide_account_balance_at_0 else _('Show')],
_('Hide') if report.hide_account_at_0 else _('Show')],
[_('Show foreign currency'), [_('Show foreign currency'),
_('Yes') if report.foreign_currency else _('No')], _('Yes') if report.foreign_currency else _('No')],
] ]

26
account_financial_report/report/templates/general_ledger.xml

@ -13,6 +13,7 @@
<template id="report_general_ledger_base"> <template id="report_general_ledger_base">
<!-- Saved flag fields into variables, used to define columns display --> <!-- Saved flag fields into variables, used to define columns display -->
<t t-set="show_analytic_tags" t-value="o.show_analytic_tags"/>
<t t-set="show_cost_center" t-value="o.show_cost_center"/> <t t-set="show_cost_center" t-value="o.show_cost_center"/>
<t t-set="foreign_currency" t-value="o.foreign_currency"/> <t t-set="foreign_currency" t-value="o.foreign_currency"/>
<!-- Defines global variables used by internal layout --> <!-- Defines global variables used by internal layout -->
@ -81,6 +82,7 @@
<div class="act_as_cell">Target moves filter</div> <div class="act_as_cell">Target moves filter</div>
<div class="act_as_cell">Account balance at 0 filter</div> <div class="act_as_cell">Account balance at 0 filter</div>
<div class="act_as_cell">Centralize filter</div> <div class="act_as_cell">Centralize filter</div>
<div class="act_as_cell">Show analytic tags</div>
</div> </div>
<div class="act_as_row"> <div class="act_as_row">
<div class="act_as_cell"> <div class="act_as_cell">
@ -91,13 +93,17 @@
<t t-if="not o.only_posted_moves">All entries</t> <t t-if="not o.only_posted_moves">All entries</t>
</div> </div>
<div class="act_as_cell"> <div class="act_as_cell">
<t t-if="o.hide_account_balance_at_0">Hide</t>
<t t-if="not o.hide_account_balance_at_0">Show</t>
<t t-if="o.hide_account_at_0">Hide</t>
<t t-if="not o.hide_account_at_0">Show</t>
</div> </div>
<div class="act_as_cell"> <div class="act_as_cell">
<t t-if="o.centralize">Yes</t> <t t-if="o.centralize">Yes</t>
<t t-if="not o.centralize">No</t> <t t-if="not o.centralize">No</t>
</div> </div>
<div class="act_as_cell">
<t t-if="o.show_analytic_tags">Yes</t>
<t t-if="not o.show_analytic_tags">No</t>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -130,6 +136,10 @@
<div class="act_as_cell" style="width: 8.03%;">Cost <div class="act_as_cell" style="width: 8.03%;">Cost
center</div> center</div>
</t> </t>
<t t-if="show_analytic_tags">
<!--## analytic tags-->
<div class="act_as_cell" style="width: 4.75%;">Tags</div>
</t>
<!--## matching_number--> <!--## matching_number-->
<div class="act_as_cell" style="width: 2.41%;">Rec.</div> <div class="act_as_cell" style="width: 2.41%;">Rec.</div>
<!--## debit--> <!--## debit-->
@ -167,6 +177,10 @@
<!--## cost_center--> <!--## cost_center-->
<div class="act_as_cell"/> <div class="act_as_cell"/>
</t> </t>
<t t-if="show_analytic_tags">
<!--## analytic tags-->
<div class="act_as_cell"></div>
</t>
<!--## matching_number--> <!--## matching_number-->
<div class="act_as_cell"/> <div class="act_as_cell"/>
<!--## debit--> <!--## debit-->
@ -381,6 +395,10 @@
</span> </span>
</div> </div>
</t> </t>
<t t-if="show_analytic_tags">
<!--## analytic tags-->
<div class="act_as_cell left"><span t-field="line.tags"/></div>
</t>
<!--## matching_number--> <!--## matching_number-->
<div class="act_as_cell"> <div class="act_as_cell">
<t t-set="res_model" t-value="'account.full.reconcile'"/> <t t-set="res_model" t-value="'account.full.reconcile'"/>
@ -475,6 +493,10 @@
<!--## cost_center--> <!--## cost_center-->
<div class="act_as_cell" style="width: 8.03%"/> <div class="act_as_cell" style="width: 8.03%"/>
</t> </t>
<t t-if="show_analytic_tags">
<!--## analytic tags-->
<div class="act_as_cell" style="width: 4.75%;"></div>
</t>
<!--## matching_number--> <!--## matching_number-->
<div class="act_as_cell" style="width: 2.41%;"/> <div class="act_as_cell" style="width: 2.41%;"/>
<!--## debit--> <!--## debit-->

4
account_financial_report/report/templates/open_items.xml

@ -80,8 +80,8 @@
<t t-if="not o.only_posted_moves">All entries</t> <t t-if="not o.only_posted_moves">All entries</t>
</div> </div>
<div class="act_as_cell"> <div class="act_as_cell">
<t t-if="o.hide_account_balance_at_0">Hide</t>
<t t-if="not o.hide_account_balance_at_0">Show</t>
<t t-if="o.hide_account_at_0">Hide</t>
<t t-if="not o.hide_account_at_0">Show</t>
</div> </div>
</div> </div>
</div> </div>

34
account_financial_report/report/templates/trial_balance.xml

@ -18,6 +18,8 @@
<!-- Defines global variables used by internal layout --> <!-- Defines global variables used by internal layout -->
<t t-set="title">Trial Balance</t> <t t-set="title">Trial Balance</t>
<t t-set="company_name" t-value="o.company_id.name"/> <t t-set="company_name" t-value="o.company_id.name"/>
<t t-set="res_company" t-value="o.company_id"/>
<div class="page"> <div class="page">
<!-- Display filters --> <!-- Display filters -->
<t t-call="account_financial_report.report_trial_balance_filters"/> <t t-call="account_financial_report.report_trial_balance_filters"/>
@ -30,7 +32,7 @@
<t t-call="account_financial_report.report_trial_balance_lines_header"/> <t t-call="account_financial_report.report_trial_balance_lines_header"/>
<!-- Display each lines --> <!-- Display each lines -->
<t t-foreach="o.account_ids" t-as="line">
<t t-foreach="o.account_ids.filtered(lambda a: not a.hide_line)" t-as="line">
<t t-set="type" t-value='"account_type"'/> <t t-set="type" t-value='"account_type"'/>
<!-- Adapt --> <!-- Adapt -->
<t t-set="style" t-value="'font-size:8px;'"/> <t t-set="style" t-value="'font-size:8px;'"/>
@ -38,7 +40,7 @@
<t t-if="o.hide_account_at_0"> <t t-if="o.hide_account_at_0">
<t t-set="style" t-value="'font-size: 14px;'"/> <t t-set="style" t-value="'font-size: 14px;'"/>
</t> </t>
<t t-if="not o.hide_account_at_0">
<t t-if="o.hierarchy_on != 'none'">
<t t-set="style" t-value="'font-size: ' + str(14 - line.level) + 'px; margin-left: ' + str(line.level * 4) + 'px;'"/> <t t-set="style" t-value="'font-size: ' + str(14 - line.level) + 'px; margin-left: ' + str(line.level * 4) + 'px;'"/>
</t> </t>
<t t-if="line.account_group_id"> <t t-if="line.account_group_id">
@ -106,7 +108,8 @@
<div class="act_as_row labels"> <div class="act_as_row labels">
<div class="act_as_cell">Date range filter</div> <div class="act_as_cell">Date range filter</div>
<div class="act_as_cell">Target moves filter</div> <div class="act_as_cell">Target moves filter</div>
<div class="act_as_cell">Account balance at 0 filter</div>
<div class="act_as_cell">Account at 0 filter</div>
<div class="act_as_cell">Limit hierarchy levels</div>
</div> </div>
<div class="act_as_row"> <div class="act_as_row">
<div class="act_as_cell"> <div class="act_as_cell">
@ -120,6 +123,14 @@
<t t-if="o.hide_account_at_0">Hide</t> <t t-if="o.hide_account_at_0">Hide</t>
<t t-if="not o.hide_account_at_0">Show</t> <t t-if="not o.hide_account_at_0">Show</t>
</div> </div>
<div class="act_as_cell">
<t t-if="o.limit_hierarchy_level">
Level <span t-field="o.show_hierarchy_level"/>
</t>
<t t-if="not o.limit_hierarchy_level">
No limit
</t>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -132,12 +143,12 @@
<!--## Code--> <!--## Code-->
<div class="act_as_cell" style="width: 8.86%;">Code</div> <div class="act_as_cell" style="width: 8.86%;">Code</div>
<!--## Account--> <!--## Account-->
<div class="act_as_cell" style="width: 52.58%;">Account
<div class="act_as_cell" style="width: 37.58%;">Account
</div> </div>
</t> </t>
<t t-if="show_partner_details"> <t t-if="show_partner_details">
<!--## Partner--> <!--## Partner-->
<div class="act_as_cell" style="width: 61.44%;">Partner
<div class="act_as_cell" style="width: 46.44%;">Partner
</div> </div>
</t> </t>
<!--## Initial balance--> <!--## Initial balance-->
@ -381,6 +392,19 @@
<t t-att-style="style" t-raw="line.period_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a> <t t-att-style="style" t-raw="line.period_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span> </span>
</t> </t>
<t t-if="line.account_group_id">
<t t-set="domain"
t-value="[('account_id', 'in', line.compute_account_ids.ids),
('date', '&gt;=', line.report_id.date_from),
('date', '&lt;=', line.report_id.date_to)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.period_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</t> </t>
<t t-if="type == 'partner_type'"> <t t-if="type == 'partner_type'">
<t t-set="domain" <t t-set="domain"

42
account_financial_report/report/trial_balance.py

@ -44,7 +44,9 @@ class TrialBalanceReport(models.TransientModel):
No hierarchy: Use to display just the accounts, without any grouping. No hierarchy: Use to display just the accounts, without any grouping.
""", """,
) )
limit_hierarchy_level = fields.Boolean('Limit hierarchy levels')
show_hierarchy_level = fields.Integer('Hierarchy Levels to display',
default=1)
# General Ledger Report Data fields, # General Ledger Report Data fields,
# used as base for compute the data reports # used as base for compute the data reports
general_ledger_id = fields.Many2one( general_ledger_id = fields.Many2one(
@ -68,10 +70,10 @@ class TrialBalanceReportAccount(models.TransientModel):
ondelete='cascade', ondelete='cascade',
index=True index=True
) )
hide_line = fields.Boolean(compute='_compute_hide_line')
# Data fields, used to keep link with real object # Data fields, used to keep link with real object
sequence = fields.Integer(index=True, default=0)
level = fields.Integer(index=True, default=0)
sequence = fields.Integer(index=True, default=1)
level = fields.Integer(index=True, default=1)
# Data fields, used to keep link with real object # Data fields, used to keep link with real object
account_id = fields.Many2one( account_id = fields.Many2one(
@ -112,6 +114,21 @@ class TrialBalanceReportAccount(models.TransientModel):
inverse_name='report_account_id' inverse_name='report_account_id'
) )
@api.multi
def _compute_hide_line(self):
for rec in self:
report = rec.report_id
rec.hide_line = False
if report.hide_account_at_0 and (
not rec.initial_balance and
not rec.final_balance and
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
class TrialBalanceReportPartner(models.TransientModel): class TrialBalanceReportPartner(models.TransientModel):
_name = 'report_trial_balance_partner' _name = 'report_trial_balance_partner'
@ -243,15 +260,6 @@ class TrialBalanceReportCompute(models.TransientModel):
else: else:
for line in self.account_ids: for line in self.account_ids:
line.write({'level': 0}) line.write({'level': 0})
if self.hide_account_at_0:
self.env.cr.execute("""
DELETE FROM report_trial_balance_account
WHERE report_id=%s
AND (initial_balance IS NULL OR initial_balance = 0)
AND (debit IS NULL OR debit = 0)
AND (credit IS NULL OR credit = 0)
AND (final_balance IS NULL OR final_balance = 0)
""", [self.id])
def _inject_account_values(self, account_ids): def _inject_account_values(self, account_ids):
"""Inject report values for report_trial_balance_account""" """Inject report values for report_trial_balance_account"""
@ -398,7 +406,7 @@ FROM
WITH computed AS (WITH RECURSIVE cte AS ( WITH computed AS (WITH RECURSIVE cte AS (
SELECT account_group_id, code, account_group_id AS parent_id, SELECT account_group_id, code, account_group_id AS parent_id,
initial_balance, initial_balance_foreign_currency, debit, credit, initial_balance, initial_balance_foreign_currency, debit, credit,
final_balance, final_balance_foreign_currency
period_balance, final_balance, final_balance_foreign_currency
FROM report_trial_balance_account FROM report_trial_balance_account
WHERE report_id = %s WHERE report_id = %s
GROUP BY report_trial_balance_account.id GROUP BY report_trial_balance_account.id
@ -406,7 +414,7 @@ WITH computed AS (WITH RECURSIVE cte AS (
UNION ALL UNION ALL
SELECT c.account_group_id, c.code, p.account_group_id, SELECT c.account_group_id, c.code, p.account_group_id,
p.initial_balance, p.initial_balance_foreign_currency, p.debit, p.credit, p.initial_balance, p.initial_balance_foreign_currency, p.debit, p.credit,
p.final_balance, p.final_balance_foreign_currency
p.period_balance, p.final_balance, p.final_balance_foreign_currency
FROM cte c FROM cte c
JOIN report_trial_balance_account p USING (parent_id) JOIN report_trial_balance_account p USING (parent_id)
WHERE p.report_id = %s WHERE p.report_id = %s
@ -416,6 +424,7 @@ SELECT account_group_id, code,
sum(initial_balance_foreign_currency) AS initial_balance_foreign_currency, sum(initial_balance_foreign_currency) AS initial_balance_foreign_currency,
sum(debit) AS debit, sum(debit) AS debit,
sum(credit) AS credit, sum(credit) AS credit,
sum(debit) - sum(credit) AS period_balance,
sum(final_balance) AS final_balance, sum(final_balance) AS final_balance,
sum(final_balance_foreign_currency) AS final_balance_foreign_currency sum(final_balance_foreign_currency) AS final_balance_foreign_currency
FROM cte FROM cte
@ -428,6 +437,7 @@ SET initial_balance = computed.initial_balance,
computed.initial_balance_foreign_currency, computed.initial_balance_foreign_currency,
debit = computed.debit, debit = computed.debit,
credit = computed.credit, credit = computed.credit,
period_balance = computed.period_balance,
final_balance = computed.final_balance, final_balance = computed.final_balance,
final_balance_foreign_currency = final_balance_foreign_currency =
computed.final_balance_foreign_currency computed.final_balance_foreign_currency
@ -491,6 +501,7 @@ WITH RECURSIVE accgroup AS
as initial_balance_foreign_currency, as initial_balance_foreign_currency,
sum(coalesce(ra.debit, 0)) as debit, sum(coalesce(ra.debit, 0)) as debit,
sum(coalesce(ra.credit, 0)) as credit, sum(coalesce(ra.credit, 0)) as credit,
sum(coalesce(ra.debit, 0)) - sum(coalesce(ra.credit, 0)) as period_balance,
sum(coalesce(ra.final_balance, 0)) as final_balance, sum(coalesce(ra.final_balance, 0)) as final_balance,
sum(coalesce(ra.final_balance_foreign_currency, 0)) sum(coalesce(ra.final_balance_foreign_currency, 0))
as final_balance_foreign_currency as final_balance_foreign_currency
@ -509,6 +520,7 @@ SET initial_balance = accgroup.initial_balance,
accgroup.initial_balance_foreign_currency, accgroup.initial_balance_foreign_currency,
debit = accgroup.debit, debit = accgroup.debit,
credit = accgroup.credit, credit = accgroup.credit,
period_balance = accgroup.period_balance,
final_balance = accgroup.final_balance, final_balance = accgroup.final_balance,
final_balance_foreign_currency = final_balance_foreign_currency =
accgroup.final_balance_foreign_currency accgroup.final_balance_foreign_currency

11
account_financial_report/report/trial_balance_xlsx.py

@ -82,15 +82,15 @@ class TrialBalanceXslx(models.AbstractModel):
} }
if report.foreign_currency: if report.foreign_currency:
foreign_currency = { foreign_currency = {
5: {'header': _('Cur.'),
6: {'header': _('Cur.'),
'field': 'currency_id', 'field': 'currency_id',
'field_currency_balance': 'currency_id', 'field_currency_balance': 'currency_id',
'type': 'many2one', 'width': 7}, 'type': 'many2one', 'width': 7},
6: {'header': _('Initial balance'),
7: {'header': _('Initial balance'),
'field': 'initial_balance_foreign_currency', 'field': 'initial_balance_foreign_currency',
'type': 'amount_currency', 'type': 'amount_currency',
'width': 14}, 'width': 14},
7: {'header': _('Ending balance'),
8: {'header': _('Ending balance'),
'field': 'final_balance_foreign_currency', 'field': 'final_balance_foreign_currency',
'type': 'amount_currency', 'type': 'amount_currency',
'width': 14}, 'width': 14},
@ -109,6 +109,9 @@ class TrialBalanceXslx(models.AbstractModel):
_('Hide') if report.hide_account_at_0 else _('Show')], _('Hide') if report.hide_account_at_0 else _('Show')],
[_('Show foreign currency'), [_('Show foreign currency'),
_('Yes') if report.foreign_currency else _('No')], _('Yes') if report.foreign_currency else _('No')],
[_('Limit hierarchy levels'),
_('Level %s' % report.show_hierarchy_level) if
report.limit_hierarchy_level else _('No limit')],
] ]
def _get_col_count_filter_name(self): def _get_col_count_filter_name(self):
@ -124,7 +127,7 @@ class TrialBalanceXslx(models.AbstractModel):
self.write_array_header() self.write_array_header()
# For each account # For each account
for account in report.account_ids:
for account in report.account_ids.filtered(lambda a: not a.hide_line):
if not report.show_partner_details: if not report.show_partner_details:
# Display account lines # Display account lines
self.write_line(account, 'account') self.write_line(account, 'account')

446
account_financial_report/static/description/index.html

@ -0,0 +1,446 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.12: http://docutils.sourceforge.net/" />
<title>Account Financial Reports</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7614 2013-02-21 15:55:51Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="account-financial-reports">
<h1 class="title">Account Financial Reports</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/account-financial-reporting/tree/11.0/account_financial_report"><img alt="OCA/account-financial-reporting" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--reporting-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-reporting-11-0/account-financial-reporting-11-0-account_financial_report"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/91/11.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module adds a set of financial reports. They are accessible under
Accounting / Reporting / OCA Reports.</p>
<ul class="simple">
<li>General ledger</li>
<li>Trial Balance</li>
<li>Open Items</li>
<li>Aged Partner Balance</li>
<li>VAT Report</li>
<li>Journal Ledger</li>
</ul>
<p>Currently General ledger, Trial Balance and Open Items are fully compatible with a foreign
currency set up in account in order to display balances. Moreover, any foreign
currency used in account move lines is properly shown.</p>
<p>In case that in an account has not been configured a second currency foreign
currency balances are not available.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#changelog" id="id2">Changelog</a><ul>
<li><a class="reference internal" href="#id1" id="id3">11.0.2.3.1 (2018-11-29)</a></li>
</ul>
</li>
<li><a class="reference internal" href="#bug-tracker" id="id4">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id5">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id6">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id7">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id8">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="changelog">
<h1><a class="toc-backref" href="#id2">Changelog</a></h1>
<div class="section" id="id1">
<h2><a class="toc-backref" href="#id3">11.0.2.3.1 (2018-11-29)</a></h2>
<ul class="simple">
<li>In the Trial Balance you can apply a filter by hierarchy levels</li>
<li>In the General Ledger you can apply a filter by Analytic Tag</li>
<li>In the Journal Ledger the field ‘Journal’ is now optional</li>
</ul>
</div>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id4">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-reporting/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/account-financial-reporting/issues/new?body=module:%20account_financial_report%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id5">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id6">Authors</a></h2>
<ul class="simple">
<li>Camptocamp SA</li>
<li>initOS GmbH</li>
<li>redCOR AG</li>
<li>Eficent</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id7">Contributors</a></h2>
<ul class="simple">
<li>Jordi Ballester &lt;<a class="reference external" href="mailto:jordi.ballester&#64;eficient.com">jordi.ballester&#64;eficient.com</a>&gt;</li>
<li>Yannick Vaucher &lt;<a class="reference external" href="mailto:yannick.vaucher&#64;camptocamp.com">yannick.vaucher&#64;camptocamp.com</a>&gt;</li>
<li>Simone Orsi &lt;<a class="reference external" href="mailto:simone.orsi&#64;abstract.com">simone.orsi&#64;abstract.com</a>&gt;</li>
<li>Leonardo Pistone &lt;<a class="reference external" href="mailto:leonardo.pistone&#64;camptocamp.com">leonardo.pistone&#64;camptocamp.com</a>&gt;</li>
<li>Damien Crier &lt;<a class="reference external" href="mailto:damien.crier&#64;camptocamp.com">damien.crier&#64;camptocamp.com</a>&gt;</li>
<li>Andrea Stirpe &lt;<a class="reference external" href="mailto:a.stirpe&#64;onestein.nl">a.stirpe&#64;onestein.nl</a>&gt;</li>
<li>Thomas Rehn &lt;<a class="reference external" href="mailto:thomas.rehn&#64;initos.com">thomas.rehn&#64;initos.com</a>&gt;</li>
<li>Andrea Gallina &lt;<a class="reference external" href="mailto:4everamd&#64;gmail.com">4everamd&#64;gmail.com</a>&gt;</li>
<li>Robert Rottermann &lt;<a class="reference external" href="mailto:robert&#64;redcor.ch">robert&#64;redcor.ch</a>&gt;</li>
<li>Ciro Urselli &lt;<a class="reference external" href="mailto:c.urselli&#64;apuliasoftware.it">c.urselli&#64;apuliasoftware.it</a>&gt;</li>
<li>Francesco Apruzzese &lt;<a class="reference external" href="mailto:opencode&#64;e-ware.org">opencode&#64;e-ware.org</a>&gt;</li>
<li>Lorenzo Battistini &lt;<a class="reference external" href="mailto:lorenzo.battistini&#64;agilebg.com">lorenzo.battistini&#64;agilebg.com</a>&gt;</li>
<li>Julien Coux &lt;<a class="reference external" href="mailto:julien.coux&#64;camptocamp.com">julien.coux&#64;camptocamp.com</a>&gt;</li>
<li>Akim Juillerat &lt;<a class="reference external" href="mailto:akim.juillerat&#64;camptocamp.com">akim.juillerat&#64;camptocamp.com</a>&gt;</li>
<li>Alexis de Lattre &lt;<a class="reference external" href="mailto:alexis&#64;via.ecp.fr">alexis&#64;via.ecp.fr</a>&gt;</li>
<li>Mihai Fekete &lt;<a class="reference external" href="mailto:feketemihai&#64;gmail.com">feketemihai&#64;gmail.com</a>&gt;</li>
</ul>
<p>Much of the work in this module was done at a sprint in Sorrento, Italy in
April 2016.</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-reporting/tree/11.0/account_financial_report">OCA/account-financial-reporting</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

41
account_financial_report/tests/test_general_ledger.py

@ -39,19 +39,48 @@ class TestGeneralLedger(a_t_f_c.AbstractTestForeignCurrency):
} }
def _getAdditionalFiltersToBeTested(self): def _getAdditionalFiltersToBeTested(self):
return [
additional_filters = [
{'only_posted_moves': True}, {'only_posted_moves': True},
{'hide_account_balance_at_0': True},
{'hide_account_at_0': True},
{'centralize': True}, {'centralize': True},
{'only_posted_moves': True, 'hide_account_balance_at_0': True},
{'only_posted_moves': True, 'hide_account_at_0': True},
{'only_posted_moves': True, 'centralize': True}, {'only_posted_moves': True, 'centralize': True},
{'hide_account_balance_at_0': True, 'centralize': True},
{'hide_account_at_0': True, 'centralize': True},
{ {
'only_posted_moves': True, 'only_posted_moves': True,
'hide_account_balance_at_0': True,
'hide_account_at_0': True,
'centralize': True 'centralize': True
}, },
] ]
# Add `show_analytic_tags` filter on each cases
additional_filters_with_show_tags = []
for additional_filter in additional_filters:
additional_filter['show_analytic_tags'] = True
additional_filters_with_show_tags.append(
additional_filter
)
additional_filters += additional_filters_with_show_tags
# Add `filter_analytic_tag_ids` filter on each cases
analytic_tag = self.env['account.analytic.tag'].create({
'name': 'TEST tag'
})
# Define all move lines on this tag
# (this test just check with the all filters, all works technically)
move_lines = self.env['account.move.line'].search([])
move_lines.write({
'analytic_tag_ids': [(6, False, analytic_tag.ids)],
})
additional_filters_with_filter_tags = []
for additional_filter in additional_filters:
additional_filter['filter_analytic_tag_ids'] = [
(6, False, analytic_tag.ids)
]
additional_filters_with_filter_tags.append(
additional_filter
)
additional_filters += additional_filters_with_filter_tags
return additional_filters
class TestGeneralLedgerReport(common.TransactionCase): class TestGeneralLedgerReport(common.TransactionCase):
@ -120,7 +149,7 @@ class TestGeneralLedgerReport(common.TransactionCase):
'date_from': self.fy_date_start, 'date_from': self.fy_date_start,
'date_to': self.fy_date_end, 'date_to': self.fy_date_end,
'only_posted_moves': True, 'only_posted_moves': True,
'hide_account_balance_at_0': False,
'hide_account_at_0': False,
'company_id': company.id, 'company_id': company.id,
'fy_start_date': self.fy_date_start, 'fy_start_date': self.fy_date_start,
}) })

4
account_financial_report/tests/test_open_items.py

@ -36,6 +36,6 @@ class TestOpenItems(a_t_f_c.AbstractTestForeignCurrency):
def _getAdditionalFiltersToBeTested(self): def _getAdditionalFiltersToBeTested(self):
return [ return [
{'only_posted_moves': True}, {'only_posted_moves': True},
{'hide_account_balance_at_0': True},
{'only_posted_moves': True, 'hide_account_balance_at_0': True},
{'hide_account_at_0': True},
{'only_posted_moves': True, 'hide_account_at_0': True},
] ]

20
account_financial_report/tests/test_trial_balance.py

@ -41,20 +41,20 @@ class TestTrialBalance(a_t_f_c.AbstractTestForeignCurrency):
def _getAdditionalFiltersToBeTested(self): def _getAdditionalFiltersToBeTested(self):
return [ return [
{'only_posted_moves': True}, {'only_posted_moves': True},
{'hide_account_balance_at_0': True},
{'hide_account_at_0': True},
{'show_partner_details': True}, {'show_partner_details': True},
{'hierarchy_on': 'computed'}, {'hierarchy_on': 'computed'},
{'hierarchy_on': 'relation'}, {'hierarchy_on': 'relation'},
{'only_posted_moves': True, 'hide_account_balance_at_0': True,
{'only_posted_moves': True, 'hide_account_at_0': True,
'hierarchy_on': 'computed'}, 'hierarchy_on': 'computed'},
{'only_posted_moves': True, 'hide_account_balance_at_0': True,
{'only_posted_moves': True, 'hide_account_at_0': True,
'hierarchy_on': 'relation'}, 'hierarchy_on': 'relation'},
{'only_posted_moves': True, 'hide_account_balance_at_0': True},
{'only_posted_moves': True, 'hide_account_at_0': True},
{'only_posted_moves': True, 'show_partner_details': True}, {'only_posted_moves': True, 'show_partner_details': True},
{'hide_account_balance_at_0': True, 'show_partner_details': True},
{'hide_account_at_0': True, 'show_partner_details': True},
{ {
'only_posted_moves': True, 'only_posted_moves': True,
'hide_account_balance_at_0': True,
'hide_account_at_0': True,
'show_partner_details': True 'show_partner_details': True
}, },
] ]
@ -170,7 +170,7 @@ class TestTrialBalanceReport(common.TransactionCase):
'date_from': self.date_start, 'date_from': self.date_start,
'date_to': self.date_end, 'date_to': self.date_end,
'only_posted_moves': True, 'only_posted_moves': True,
'hide_account_balance_at_0': False,
'hide_account_at_0': False,
'hierarchy_on': hierarchy_on, 'hierarchy_on': hierarchy_on,
'company_id': company.id, 'company_id': company.id,
'fy_start_date': self.fy_date_start, 'fy_start_date': self.fy_date_start,
@ -528,7 +528,7 @@ class TestTrialBalanceReport(common.TransactionCase):
'date_from': self.date_start, 'date_from': self.date_start,
'date_to': self.date_end, 'date_to': self.date_end,
'only_posted_moves': True, 'only_posted_moves': True,
'hide_account_balance_at_0': False,
'hide_account_at_0': False,
'hierarchy_on': 'none', 'hierarchy_on': 'none',
'company_id': company.id, 'company_id': company.id,
'fy_start_date': self.fy_date_start, 'fy_start_date': self.fy_date_start,
@ -570,7 +570,7 @@ class TestTrialBalanceReport(common.TransactionCase):
'date_from': self.date_start, 'date_from': self.date_start,
'date_to': self.date_end, 'date_to': self.date_end,
'only_posted_moves': True, 'only_posted_moves': True,
'hide_account_balance_at_0': False,
'hide_account_at_0': False,
'hierarchy_on': 'none', 'hierarchy_on': 'none',
'company_id': company.id, 'company_id': company.id,
'fy_start_date': self.fy_date_start, 'fy_start_date': self.fy_date_start,
@ -613,7 +613,7 @@ class TestTrialBalanceReport(common.TransactionCase):
'date_from': self.date_start, 'date_from': self.date_start,
'date_to': self.date_end, 'date_to': self.date_end,
'only_posted_moves': True, 'only_posted_moves': True,
'hide_account_balance_at_0': False,
'hide_account_at_0': False,
'hierarchy_on': 'none', 'hierarchy_on': 'none',
'company_id': company.id, 'company_id': company.id,
'fy_start_date': self.fy_date_start, 'fy_start_date': self.fy_date_start,

3
account_financial_report/wizard/aged_partner_balance_wizard.py

@ -3,7 +3,6 @@
# Copyright 2016 Camptocamp SA, Onestein B.V. # Copyright 2016 Camptocamp SA, Onestein B.V.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import datetime
from odoo import api, fields, models from odoo import api, fields, models
from odoo.tools.safe_eval import safe_eval from odoo.tools.safe_eval import safe_eval
from odoo.tools import pycompat from odoo.tools import pycompat
@ -21,7 +20,7 @@ class AgedPartnerBalanceWizard(models.TransientModel):
string='Company' string='Company'
) )
date_at = fields.Date(required=True, date_at = fields.Date(required=True,
default=fields.Date.to_string(datetime.today()))
default=fields.Date.context_today)
target_move = fields.Selection([('posted', 'All Posted Entries'), target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All Entries')], ('all', 'All Entries')],
string='Target Moves', string='Target Moves',

12
account_financial_report/wizard/aged_partner_balance_wizard_view.xml

@ -19,15 +19,17 @@
<field name="show_move_line_details"/> <field name="show_move_line_details"/>
</group> </group>
</group> </group>
<group name="partner_filter" col="1">
<label for="partner_ids"/> <label for="partner_ids"/>
<field name="partner_ids" nolabel="1" options="{'no_create': True}"/>
<group/>
<label for="account_ids"/>
<group col="4">
<field name="partner_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}"/>
</group>
<group name="account_filter" col="4">
<label for="account_ids" colspan="4"/>
<field name="receivable_accounts_only"/> <field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/> <field name="payable_accounts_only"/>
<field name="account_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}" colspan="4"/>
</group> </group>
<field name="account_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
<field name="account_ids" nolabel="1" options="{'no_create': True}"/>
<footer> <footer>
<button name="button_export_html" string="View" <button name="button_export_html" string="View"
type="object" default_focus="1" class="oe_highlight"/> type="object" default_focus="1" class="oe_highlight"/>

13
account_financial_report/wizard/general_ledger_wizard.py

@ -41,19 +41,26 @@ class GeneralLedgerReportWizard(models.TransientModel):
) )
centralize = fields.Boolean(string='Activate centralization', centralize = fields.Boolean(string='Activate centralization',
default=True) default=True)
hide_account_balance_at_0 = fields.Boolean(
hide_account_at_0 = fields.Boolean(
string='Hide account ending balance at 0', string='Hide account ending balance at 0',
help='Use this filter to hide an account or a partner ' help='Use this filter to hide an account or a partner '
'with an ending balance at 0. ' 'with an ending balance at 0. '
'If partners are filtered, ' 'If partners are filtered, '
'debits and credits totals will not match the trial balance.' 'debits and credits totals will not match the trial balance.'
) )
show_analytic_tags = fields.Boolean(
string='Show analytic tags',
)
receivable_accounts_only = fields.Boolean() receivable_accounts_only = fields.Boolean()
payable_accounts_only = fields.Boolean() payable_accounts_only = fields.Boolean()
partner_ids = fields.Many2many( partner_ids = fields.Many2many(
comodel_name='res.partner', comodel_name='res.partner',
string='Filter partners', string='Filter partners',
) )
analytic_tag_ids = fields.Many2many(
comodel_name='account.analytic.tag',
string='Filter accounts',
)
account_journal_ids = fields.Many2many( account_journal_ids = fields.Many2many(
comodel_name='account.journal', comodel_name='account.journal',
string='Filter journals', string='Filter journals',
@ -156,12 +163,14 @@ class GeneralLedgerReportWizard(models.TransientModel):
'date_from': self.date_from, 'date_from': self.date_from,
'date_to': self.date_to, 'date_to': self.date_to,
'only_posted_moves': self.target_move == 'posted', 'only_posted_moves': self.target_move == 'posted',
'hide_account_balance_at_0': self.hide_account_balance_at_0,
'hide_account_at_0': self.hide_account_at_0,
'foreign_currency': self.foreign_currency, 'foreign_currency': self.foreign_currency,
'show_analytic_tags': self.show_analytic_tags,
'company_id': self.company_id.id, 'company_id': self.company_id.id,
'filter_account_ids': [(6, 0, self.account_ids.ids)], 'filter_account_ids': [(6, 0, self.account_ids.ids)],
'filter_partner_ids': [(6, 0, self.partner_ids.ids)], 'filter_partner_ids': [(6, 0, self.partner_ids.ids)],
'filter_cost_center_ids': [(6, 0, self.cost_center_ids.ids)], 'filter_cost_center_ids': [(6, 0, self.cost_center_ids.ids)],
'filter_analytic_tag_ids': [(6, 0, self.analytic_tag_ids.ids)],
'filter_journal_ids': [(6, 0, self.account_journal_ids.ids)], 'filter_journal_ids': [(6, 0, self.account_journal_ids.ids)],
'centralize': self.centralize, 'centralize': self.centralize,
'fy_start_date': self.fy_start_date, 'fy_start_date': self.fy_start_date,

27
account_financial_report/wizard/general_ledger_wizard_view.xml

@ -21,24 +21,29 @@
<group name="other_filters"> <group name="other_filters">
<field name="target_move" widget="radio"/> <field name="target_move" widget="radio"/>
<field name="centralize"/> <field name="centralize"/>
<field name="hide_account_balance_at_0"/>
<field name="hide_account_at_0"/>
<field name="foreign_currency"/> <field name="foreign_currency"/>
<field name="show_analytic_tags"/>
</group> </group>
</group> </group>
<label for="cost_center_ids" groups="analytic.group_analytic_accounting"/>
<field name="cost_center_ids" nolabel="1" options="{'no_create': True}" groups="analytic.group_analytic_accounting"/>
<group/>
<label for="partner_ids"/>
<field name="partner_ids" nolabel="1" options="{'no_create': True}"/>
<label for="account_journal_ids"/>
<field name="account_journal_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
<group/>
<label for="account_ids"/>
<notebook>
<page string="Filter accounts">
<group col="4"> <group col="4">
<field name="receivable_accounts_only"/> <field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/> <field name="payable_accounts_only"/>
</group> </group>
<field name="account_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
<field name="account_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}"/>
</page>
<page string="Filter partners">
<field name="partner_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}"/>
</page>
<page string="Filter cost centers" groups="analytic.group_analytic_accounting">
<field name="cost_center_ids" nolabel="1" options="{'no_create': True}" groups="analytic.group_analytic_accounting"/>
</page>
<page string="Filter analytic tags">
<field name="analytic_tag_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
</page>
</notebook>
</div> </div>
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}"> <div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}">
<field name="not_only_one_unaffected_earnings_account" invisible="1"/> <field name="not_only_one_unaffected_earnings_account" invisible="1"/>

9
account_financial_report/wizard/journal_ledger_wizard.py

@ -38,7 +38,7 @@ class JournalLedgerReportWizard(models.TransientModel):
comodel_name='account.journal', comodel_name='account.journal',
string="Journals", string="Journals",
domain="[('company_id', '=', company_id)]", domain="[('company_id', '=', company_id)]",
required=True,
required=False,
) )
move_target = fields.Selection( move_target = fields.Selection(
selection='_get_move_targets', selection='_get_move_targets',
@ -121,13 +121,18 @@ class JournalLedgerReportWizard(models.TransientModel):
@api.multi @api.multi
def _prepare_report_journal_ledger(self): def _prepare_report_journal_ledger(self):
self.ensure_one() self.ensure_one()
journals = self.journal_ids
if not journals:
# Not selecting a journal means that we'll display all journals
journals = self.env['account.journal'].search(
[('company_id', '=', self.company_id.id)])
return { return {
'date_from': self.date_from, 'date_from': self.date_from,
'date_to': self.date_to, 'date_to': self.date_to,
'move_target': self.move_target, 'move_target': self.move_target,
'foreign_currency': self.foreign_currency, 'foreign_currency': self.foreign_currency,
'company_id': self.company_id.id, 'company_id': self.company_id.id,
'journal_ids': [(6, 0, self.journal_ids.ids)],
'journal_ids': [(6, 0, journals.ids)],
'sort_option': self.sort_option, 'sort_option': self.sort_option,
'group_option': self.group_option, 'group_option': self.group_option,
'with_account_name': self.with_account_name, 'with_account_name': self.with_account_name,

9
account_financial_report/wizard/open_items_wizard.py

@ -3,7 +3,6 @@
# Copyright 2016 Camptocamp SA # Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import datetime
from odoo import models, fields, api from odoo import models, fields, api
from odoo.tools.safe_eval import safe_eval from odoo.tools.safe_eval import safe_eval
from odoo.tools import pycompat from odoo.tools import pycompat
@ -21,7 +20,7 @@ class OpenItemsReportWizard(models.TransientModel):
string='Company' string='Company'
) )
date_at = fields.Date(required=True, date_at = fields.Date(required=True,
default=fields.Date.to_string(datetime.today()))
default=fields.Date.context_today)
target_move = fields.Selection([('posted', 'All Posted Entries'), target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All Entries')], ('all', 'All Entries')],
string='Target Moves', string='Target Moves',
@ -32,8 +31,8 @@ class OpenItemsReportWizard(models.TransientModel):
string='Filter accounts', string='Filter accounts',
domain=[('reconcile', '=', True)], domain=[('reconcile', '=', True)],
) )
hide_account_balance_at_0 = fields.Boolean(
string='Hide account ending balance at 0',
hide_account_at_0 = fields.Boolean(
string='Hide account ending balance at 0', default=True,
help='Use this filter to hide an account or a partner ' help='Use this filter to hide an account or a partner '
'with an ending balance at 0. ' 'with an ending balance at 0. '
'If partners are filtered, ' 'If partners are filtered, '
@ -102,7 +101,7 @@ class OpenItemsReportWizard(models.TransientModel):
return { return {
'date_at': self.date_at, 'date_at': self.date_at,
'only_posted_moves': self.target_move == 'posted', 'only_posted_moves': self.target_move == 'posted',
'hide_account_balance_at_0': self.hide_account_balance_at_0,
'hide_account_at_0': self.hide_account_at_0,
'foreign_currency': self.foreign_currency, 'foreign_currency': self.foreign_currency,
'company_id': self.company_id.id, 'company_id': self.company_id.id,
'filter_account_ids': [(6, 0, self.account_ids.ids)], 'filter_account_ids': [(6, 0, self.account_ids.ids)],

13
account_financial_report/wizard/open_items_wizard_view.xml

@ -16,19 +16,20 @@
</group> </group>
<group name="other_filters"> <group name="other_filters">
<field name="target_move" widget="radio"/> <field name="target_move" widget="radio"/>
<field name="hide_account_balance_at_0"/>
<field name="hide_account_at_0"/>
<field name="foreign_currency"/> <field name="foreign_currency"/>
</group> </group>
</group> </group>
<group name="partner_filter" col="1">
<label for="partner_ids"/> <label for="partner_ids"/>
<field name="partner_ids" nolabel="1" options="{'no_create': True}"/>
<group/>
<label for="account_ids"/>
<group col="4">
<field name="partner_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}"/>
</group>
<group name="account_filter" col="4">
<label for="account_ids" colspan="4"/>
<field name="receivable_accounts_only"/> <field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/> <field name="payable_accounts_only"/>
<field name="account_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}" colspan="4"/>
</group> </group>
<field name="account_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
<footer> <footer>
<button name="button_export_html" string="View" <button name="button_export_html" string="View"
type="object" default_focus="1" class="oe_highlight"/> type="object" default_focus="1" class="oe_highlight"/>

17
account_financial_report/wizard/trial_balance_wizard.py

@ -1,11 +1,13 @@
# Author: Julien Coux # Author: Julien Coux
# Copyright 2016 Camptocamp SA # Copyright 2016 Camptocamp SA
# Copyright 2017 Akretion - Alexis de Lattre # Copyright 2017 Akretion - Alexis de Lattre
# Copyright 2018 Eficent Business and IT Consuting Services, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api
from odoo import api, fields, models, _
from odoo.tools.safe_eval import safe_eval from odoo.tools.safe_eval import safe_eval
from odoo.tools import pycompat from odoo.tools import pycompat
from odoo.exceptions import UserError
class TrialBalanceReportWizard(models.TransientModel): class TrialBalanceReportWizard(models.TransientModel):
@ -44,6 +46,9 @@ class TrialBalanceReportWizard(models.TransientModel):
No hierarchy: Use to display just the accounts, without any grouping. No hierarchy: Use to display just the accounts, without any grouping.
""", """,
) )
limit_hierarchy_level = fields.Boolean('Limit hierarchy levels')
show_hierarchy_level = fields.Integer('Hierarchy Levels to display',
default=1)
account_ids = fields.Many2many( account_ids = fields.Many2many(
comodel_name='account.account', comodel_name='account.account',
string='Filter accounts', string='Filter accounts',
@ -77,6 +82,14 @@ class TrialBalanceReportWizard(models.TransientModel):
'will display initial and final balance in that currency.' 'will display initial and final balance in that currency.'
) )
@api.multi
@api.constrains('hierarchy_on', 'show_hierarchy_level')
def _check_show_hierarchy_level(self):
for rec in self:
if rec.hierarchy_on != 'none' and rec.show_hierarchy_level <= 0:
raise UserError(_('The hierarchy level to filter on must be '
'greater than 0.'))
@api.depends('date_from') @api.depends('date_from')
def _compute_fy_start_date(self): def _compute_fy_start_date(self):
for wiz in self.filtered('date_from'): for wiz in self.filtered('date_from'):
@ -168,6 +181,8 @@ class TrialBalanceReportWizard(models.TransientModel):
'filter_journal_ids': [(6, 0, self.journal_ids.ids)], 'filter_journal_ids': [(6, 0, self.journal_ids.ids)],
'fy_start_date': self.fy_start_date, 'fy_start_date': self.fy_start_date,
'hierarchy_on': self.hierarchy_on, 'hierarchy_on': self.hierarchy_on,
'limit_hierarchy_level': self.limit_hierarchy_level,
'show_hierarchy_level': self.show_hierarchy_level,
'show_partner_details': self.show_partner_details, 'show_partner_details': self.show_partner_details,
} }

15
account_financial_report/wizard/trial_balance_wizard_view.xml

@ -23,20 +23,25 @@
<field name="hide_account_at_0"/> <field name="hide_account_at_0"/>
<field name="show_partner_details"/> <field name="show_partner_details"/>
<field name="hierarchy_on" widget="radio" attrs="{'invisible':[('show_partner_details','=',True)]}"/> <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="foreign_currency"/> <field name="foreign_currency"/>
</group> </group>
</group> </group>
<label for="partner_ids" attrs="{'invisible':[('show_partner_details','!=',True)]}"/>
<field name="partner_ids" nolabel="1" options="{'no_create': True}" attrs="{'invisible':[('show_partner_details','!=',True)]}"/>
<group name="partner_filter" attrs="{'invisible':[('show_partner_details','!=',True)]}" col="1">
<label for="partner_ids"/>
<field name="partner_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}"/>
</group>
<label for="journal_ids"/> <label for="journal_ids"/>
<field name="journal_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/> <field name="journal_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
<group attrs="{'invisible':[('show_partner_details','!=',True)]}"/> <group attrs="{'invisible':[('show_partner_details','!=',True)]}"/>
<label for="account_ids"/>
<group col="4">
<div/>
<group name="account_filter" col="4">
<label for="account_ids" colspan="4"/>
<field name="receivable_accounts_only"/> <field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/> <field name="payable_accounts_only"/>
<field name="account_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}" colspan="4"/>
</group> </group>
<field name="account_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
</div> </div>
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}"> <div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}">
<field name="not_only_one_unaffected_earnings_account" invisible="1"/> <field name="not_only_one_unaffected_earnings_account" invisible="1"/>

Loading…
Cancel
Save