diff --git a/account_financial_report/README.rst b/account_financial_report/README.rst index 92978013..cf1a8f08 100644 --- a/account_financial_report/README.rst +++ b/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 - :alt: License: AGPL-3 - -====================== -QWeb Financial Reports -====================== +========================= +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 +.. |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 + +|badge1| |badge2| |badge3| |badge4| |badge5| This module adds a set of financial reports. They are accessible under Accounting / Reporting / OCA Reports. @@ -14,6 +33,7 @@ Accounting / Reporting / OCA Reports. - 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 @@ -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 currency balances are not available. +**Table of contents** + +.. contents:: + :local: + +Changelog +========= -.. 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 +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 =========== -Bugs are tracked on `GitHub 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 `_. +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 `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* Camptocamp SA +* initOS GmbH +* redCOR AG +* Eficent Contributors ------------- +~~~~~~~~~~~~ * Jordi Ballester * Yannick Vaucher @@ -66,17 +101,19 @@ Contributors Much of the work in this module was done at a sprint in Sorrento, Italy in April 2016. -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/account-financial-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_financial_report/__manifest__.py b/account_financial_report/__manifest__.py index 088a5a5c..cf1dfe4b 100644 --- a/account_financial_report/__manifest__.py +++ b/account_financial_report/__manifest__.py @@ -4,12 +4,13 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'Account Financial Reports', - 'version': '11.0.2.2.2', + 'version': '11.0.2.3.1', 'category': 'Reporting', 'summary': 'OCA Financial Reports', 'author': 'Camptocamp SA,' 'initOS GmbH,' 'redCOR AG,' + 'Eficent,' 'Odoo Community Association (OCA)', "website": "https://odoo-community.org/", 'depends': [ diff --git a/account_financial_report/readme/CONTRIBUTORS.rst b/account_financial_report/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..4604fe42 --- /dev/null +++ b/account_financial_report/readme/CONTRIBUTORS.rst @@ -0,0 +1,19 @@ +* Jordi Ballester +* Yannick Vaucher +* Simone Orsi +* Leonardo Pistone +* Damien Crier +* Andrea Stirpe +* Thomas Rehn +* Andrea Gallina <4everamd@gmail.com> +* Robert Rottermann +* Ciro Urselli +* Francesco Apruzzese +* Lorenzo Battistini +* Julien Coux +* Akim Juillerat +* Alexis de Lattre +* Mihai Fekete + +Much of the work in this module was done at a sprint in Sorrento, Italy in +April 2016. diff --git a/account_financial_report/readme/DESCRIPTION.rst b/account_financial_report/readme/DESCRIPTION.rst new file mode 100644 index 00000000..6dab949f --- /dev/null +++ b/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. diff --git a/account_financial_report/readme/HISTORY.rst b/account_financial_report/readme/HISTORY.rst new file mode 100644 index 00000000..b501c36d --- /dev/null +++ b/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 diff --git a/account_financial_report/report/abstract_report_xlsx.py b/account_financial_report/report/abstract_report_xlsx.py index eacea35d..4fe4933c 100644 --- a/account_financial_report/report/abstract_report_xlsx.py +++ b/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.set_num_format( '#,##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( {'bold': True, 'italic': True} ) @@ -190,10 +193,20 @@ class AbstractReportXslx(models.AbstractModel): self.sheet.write_string( self.row_pos, col_pos, value.name or '', self.format_right) elif cell_type == 'string': - self.sheet.write_string(self.row_pos, col_pos, value or '') + 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 '') 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.row_pos, col_pos, float(value), self.format_amount + self.row_pos, col_pos, float(value), cell_format ) elif cell_type == 'amount_currency': if line_object.currency_id: @@ -291,10 +304,16 @@ class AbstractReportXslx(models.AbstractModel): def _get_currency_amt_format(self, line_object): """ Return amount format specific for each currency. """ - format_amt = getattr(self, 'format_amount') + 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') + field_prefix = 'format_amount' if line_object.currency_id: field_name = \ - 'format_amount_%s' % line_object.currency_id.name + '%s_%s' % (field_prefix, line_object.currency_id.name) if hasattr(self, field_name): format_amt = getattr(self, field_name) else: diff --git a/account_financial_report/report/general_ledger.py b/account_financial_report/report/general_ledger.py index 4feef2ed..7c882aff 100644 --- a/account_financial_report/report/general_ledger.py +++ b/account_financial_report/report/general_ledger.py @@ -29,14 +29,18 @@ class GeneralLedgerReport(models.TransientModel): date_to = fields.Date() fy_start_date = fields.Date() only_posted_moves = fields.Boolean() - hide_account_balance_at_0 = fields.Boolean() + hide_account_at_0 = fields.Boolean() foreign_currency = fields.Boolean() + show_analytic_tags = fields.Boolean() company_id = fields.Many2one(comodel_name='res.company') filter_account_ids = fields.Many2many(comodel_name='account.account') filter_partner_ids = fields.Many2many(comodel_name='res.partner') filter_cost_center_ids = fields.Many2many( comodel_name='account.analytic.account' ) + filter_analytic_tag_ids = fields.Many2many( + comodel_name='account.analytic.tag', + ) filter_journal_ids = fields.Many2many( comodel_name='account.journal', ) @@ -194,6 +198,7 @@ class GeneralLedgerReportMoveLine(models.TransientModel): partner = fields.Char() label = fields.Char() cost_center = fields.Char() + tags = fields.Char() matching_number = fields.Char() debit = fields.Float(digits=(16, 2)) credit = fields.Float(digits=(16, 2)) @@ -278,6 +283,10 @@ class GeneralLedgerReportCompute(models.TransientModel): if self.centralize: 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 self.invalidate_cache() @@ -336,6 +345,11 @@ class GeneralLedgerReportCompute(models.TransientModel): ml.analytic_account_id = aa.id 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 += """ LEFT JOIN res_currency c ON a.currency_id = c.id @@ -392,7 +406,11 @@ WITH FROM 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 += """ INNER JOIN account_move_line ml ON a.id = ml.account_id @@ -410,6 +428,17 @@ WITH ml.analytic_account_id = aa.id 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 += """ WHERE a.company_id = %s @@ -425,11 +454,40 @@ WITH AND 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 += """ GROUP BY 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( date_included=False @@ -439,7 +497,6 @@ WITH ) query_inject_account += """ - ), initial_sum_amounts AS ( """ + init_subquery + """ ), final_sum_amounts AS ( """ + final_subquery + """ ) INSERT INTO @@ -497,7 +554,7 @@ WHERE 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 += """ AND f.balance IS NOT NULL AND f.balance != 0 @@ -507,6 +564,10 @@ AND query_inject_account_params += ( 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 += ( self.company_id.id, self.unaffected_earnings_account.id, @@ -519,6 +580,10 @@ AND query_inject_account_params += ( 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 += ( self.date_from, self.fy_start_date, @@ -619,6 +684,11 @@ AND ml.analytic_account_id = aa.id 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 += """ GROUP BY ap.account_id, ap.partner_id, c.id @@ -706,6 +776,17 @@ WITH ml.analytic_account_id = aa.id 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 += """ WHERE ra.report_id = %s @@ -750,6 +831,31 @@ WITH p.id, 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 + """ ), final_sum_amounts AS ( """ + final_subquery + """ ) INSERT INTO @@ -829,7 +935,7 @@ WHERE 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 += """ AND f.balance IS NOT NULL AND f.balance != 0 @@ -839,6 +945,10 @@ AND query_inject_partner_params += ( 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 += ( self.id, ) @@ -846,6 +956,10 @@ AND query_inject_partner_params += ( 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 += ( self.date_from, self.fy_start_date, @@ -898,7 +1012,45 @@ AND The "only_empty_partner_line" value is used 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 report_general_ledger_move_line ( @@ -1072,6 +1224,11 @@ INNER JOIN LEFT JOIN 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 += """ WHERE ra.report_id = %s @@ -1132,7 +1289,13 @@ ORDER BY 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, ) if self.filter_cost_center_ids: @@ -1164,8 +1327,36 @@ ORDER BY Only centralized accounts are computed. """ - query_inject_move_line_centralized = """ + 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 = """ WITH + """ + query_inject_move_line_centralized += """ move_lines AS ( SELECT @@ -1196,6 +1387,11 @@ WITH ml.analytic_account_id = aa.id 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 += """ WHERE ra.report_id = %s @@ -1267,6 +1463,11 @@ ORDER BY """ 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: query_inject_move_line_centralized_params += ( tuple(self.filter_cost_center_ids.ids), @@ -1287,6 +1488,76 @@ ORDER BY 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): """Inject the report values of the unaffected earnings account for report_general_ledger_account.""" @@ -1310,12 +1581,39 @@ ORDER BY 'date_to': fy_start_date, 'company_id': self.company_id.id, '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 - ON am.id = aml.move_id + ON am.id = ml.move_id INNER JOIN account_journal j ON am.journal_id = j.id """ @@ -1327,11 +1625,15 @@ ORDER BY """ query_select_previous_fy_unaffected_earnings_params[ 'cost_center_ids'] = tuple(self.filter_cost_center_ids.ids) - + if self.filter_analytic_tag_ids: + query_select_previous_fy_unaffected_earnings += """ + INNER JOIN move_lines_on_tags ON ml.id = + move_lines_on_tags.ml_id + """ 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 + 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: query_select_previous_fy_unaffected_earnings += """ @@ -1355,15 +1657,19 @@ ORDER BY 'date_to': self.date_to, 'company_id': self.company_id.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 - 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 - ON am.id = aml.move_id + ON am.id = ml.move_id INNER JOIN account_journal j ON am.journal_id = j.id """ @@ -1375,11 +1681,16 @@ ORDER BY """ query_select_period_unaffected_earnings_params[ '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 += """ 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: query_select_period_unaffected_earnings += """ diff --git a/account_financial_report/report/general_ledger_xlsx.py b/account_financial_report/report/general_ledger_xlsx.py index 01b29abf..d5a20d42 100644 --- a/account_financial_report/report/general_ledger_xlsx.py +++ b/account_financial_report/report/general_ledger_xlsx.py @@ -28,20 +28,23 @@ class GeneralLedgerXslx(models.AbstractModel): 7: {'header': _('Cost center'), 'field': 'cost_center', 'width': 15}, - 8: {'header': _('Rec.'), 'field': 'matching_number', 'width': 5}, - 9: {'header': _('Debit'), - 'field': 'debit', - 'field_initial_balance': 'initial_debit', - 'field_final_balance': 'final_debit', - 'type': 'amount', - 'width': 14}, - 10: {'header': _('Credit'), + 8: {'header': _('Tags'), + 'field': 'tags', + 'width': 10}, + 9: {'header': _('Rec.'), 'field': 'matching_number', 'width': 5}, + 10: {'header': _('Debit'), + 'field': 'debit', + 'field_initial_balance': 'initial_debit', + 'field_final_balance': 'final_debit', + 'type': 'amount', + 'width': 14}, + 11: {'header': _('Credit'), 'field': 'credit', 'field_initial_balance': 'initial_credit', 'field_final_balance': 'final_credit', 'type': 'amount', 'width': 14}, - 11: {'header': _('Cumul. Bal.'), + 12: {'header': _('Cumul. Bal.'), 'field': 'cumul_balance', 'field_initial_balance': 'initial_balance', 'field_final_balance': 'final_balance', @@ -50,11 +53,11 @@ class GeneralLedgerXslx(models.AbstractModel): } if report.foreign_currency: foreign_currency = { - 12: {'header': _('Cur.'), + 13: {'header': _('Cur.'), 'field': 'currency_id', 'field_currency_balance': 'currency_id', 'type': 'many2one', 'width': 7}, - 13: {'header': _('Amount cur.'), + 14: {'header': _('Amount cur.'), 'field': 'amount_currency', 'field_initial_balance': 'initial_balance_foreign_currency', @@ -68,17 +71,31 @@ class GeneralLedgerXslx(models.AbstractModel): def _get_report_filters(self, report): 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): diff --git a/account_financial_report/report/open_items.py b/account_financial_report/report/open_items.py index 8ac07d68..993706b6 100644 --- a/account_financial_report/report/open_items.py +++ b/account_financial_report/report/open_items.py @@ -22,7 +22,7 @@ class OpenItemsReport(models.TransientModel): # Filters fields, used for data computation date_at = fields.Date() only_posted_moves = fields.Boolean() - hide_account_balance_at_0 = fields.Boolean() + hide_account_at_0 = fields.Boolean() foreign_currency = fields.Boolean() company_id = fields.Many2one(comodel_name='res.company') 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._clean_partners_and_accounts() self._compute_partners_and_accounts_cumul() - if self.hide_account_balance_at_0: + if self.hide_account_at_0: self._clean_partners_and_accounts( only_delete_account_balance_at_0=True ) diff --git a/account_financial_report/report/open_items_xlsx.py b/account_financial_report/report/open_items_xlsx.py index b73c6fae..cbe663fa 100644 --- a/account_financial_report/report/open_items_xlsx.py +++ b/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 entries')], [_('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'), _('Yes') if report.foreign_currency else _('No')], ] diff --git a/account_financial_report/report/templates/general_ledger.xml b/account_financial_report/report/templates/general_ledger.xml index 849b5f90..be1004c3 100644 --- a/account_financial_report/report/templates/general_ledger.xml +++ b/account_financial_report/report/templates/general_ledger.xml @@ -13,6 +13,7 @@ @@ -130,6 +136,10 @@
Cost center
+ + +
Tags
+
Rec.
@@ -167,6 +177,10 @@
+ + +
+
@@ -381,6 +395,10 @@
+ + +
+
@@ -475,6 +493,10 @@
+ + +
+
diff --git a/account_financial_report/report/templates/open_items.xml b/account_financial_report/report/templates/open_items.xml index 50e3258b..be5c7d49 100644 --- a/account_financial_report/report/templates/open_items.xml +++ b/account_financial_report/report/templates/open_items.xml @@ -80,8 +80,8 @@ All entries
- Hide - Show + Hide + Show
diff --git a/account_financial_report/report/templates/trial_balance.xml b/account_financial_report/report/templates/trial_balance.xml index d820d48d..bb00109f 100644 --- a/account_financial_report/report/templates/trial_balance.xml +++ b/account_financial_report/report/templates/trial_balance.xml @@ -18,6 +18,8 @@ Trial Balance + +
@@ -30,7 +32,7 @@ - + @@ -38,7 +40,7 @@ - + @@ -106,7 +108,8 @@
Date range filter
Target moves filter
-
Account balance at 0 filter
+
Account at 0 filter
+
Limit hierarchy levels
@@ -120,6 +123,14 @@ Hide Show
+
+ + Level + + + No limit + +
@@ -132,12 +143,12 @@
Code
-
Account +
Account
-
Partner +
Partner
@@ -381,6 +392,19 @@ + + + + + + report.show_hierarchy_level: + rec.hide_line = True + class TrialBalanceReportPartner(models.TransientModel): _name = 'report_trial_balance_partner' @@ -243,15 +260,6 @@ class TrialBalanceReportCompute(models.TransientModel): else: for line in self.account_ids: 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): """Inject report values for report_trial_balance_account""" @@ -398,7 +406,7 @@ FROM WITH computed AS (WITH RECURSIVE cte AS ( SELECT account_group_id, code, account_group_id AS parent_id, 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 WHERE report_id = %s GROUP BY report_trial_balance_account.id @@ -406,7 +414,7 @@ WITH computed AS (WITH RECURSIVE cte AS ( UNION ALL SELECT c.account_group_id, c.code, p.account_group_id, 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 JOIN report_trial_balance_account p USING (parent_id) 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(debit) AS debit, sum(credit) AS credit, + sum(debit) - sum(credit) AS period_balance, sum(final_balance) AS final_balance, sum(final_balance_foreign_currency) AS final_balance_foreign_currency FROM cte @@ -428,6 +437,7 @@ SET initial_balance = computed.initial_balance, computed.initial_balance_foreign_currency, debit = computed.debit, credit = computed.credit, + period_balance = computed.period_balance, final_balance = computed.final_balance, final_balance_foreign_currency = computed.final_balance_foreign_currency @@ -491,6 +501,7 @@ WITH RECURSIVE accgroup AS as initial_balance_foreign_currency, sum(coalesce(ra.debit, 0)) as debit, 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_foreign_currency, 0)) as final_balance_foreign_currency @@ -509,6 +520,7 @@ SET initial_balance = accgroup.initial_balance, accgroup.initial_balance_foreign_currency, debit = accgroup.debit, credit = accgroup.credit, + period_balance = accgroup.period_balance, final_balance = accgroup.final_balance, final_balance_foreign_currency = accgroup.final_balance_foreign_currency diff --git a/account_financial_report/report/trial_balance_xlsx.py b/account_financial_report/report/trial_balance_xlsx.py index 0f213938..57bf27c6 100644 --- a/account_financial_report/report/trial_balance_xlsx.py +++ b/account_financial_report/report/trial_balance_xlsx.py @@ -82,15 +82,15 @@ class TrialBalanceXslx(models.AbstractModel): } if report.foreign_currency: foreign_currency = { - 5: {'header': _('Cur.'), + 6: {'header': _('Cur.'), 'field': 'currency_id', 'field_currency_balance': 'currency_id', 'type': 'many2one', 'width': 7}, - 6: {'header': _('Initial balance'), + 7: {'header': _('Initial balance'), 'field': 'initial_balance_foreign_currency', 'type': 'amount_currency', 'width': 14}, - 7: {'header': _('Ending balance'), + 8: {'header': _('Ending balance'), 'field': 'final_balance_foreign_currency', 'type': 'amount_currency', 'width': 14}, @@ -109,6 +109,9 @@ class TrialBalanceXslx(models.AbstractModel): _('Hide') if report.hide_account_at_0 else _('Show')], [_('Show foreign currency'), _('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): @@ -124,7 +127,7 @@ class TrialBalanceXslx(models.AbstractModel): self.write_array_header() # 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: # Display account lines self.write_line(account, 'account') diff --git a/account_financial_report/static/description/index.html b/account_financial_report/static/description/index.html new file mode 100644 index 00000000..f2e2ea55 --- /dev/null +++ b/account_financial_report/static/description/index.html @@ -0,0 +1,446 @@ + + + + + + +Account Financial Reports + + + +
+

Account Financial Reports

+ + +

Beta License: AGPL-3 OCA/account-financial-reporting Translate me on Weblate Try me on Runbot

+

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.

+

Table of contents

+ +
+

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

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp SA
  • +
  • initOS GmbH
  • +
  • redCOR AG
  • +
  • Eficent
  • +
+
+
+

Contributors

+ +

Much of the work in this module was done at a sprint in Sorrento, Italy in +April 2016.

+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/account-financial-reporting project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_financial_report/tests/test_general_ledger.py b/account_financial_report/tests/test_general_ledger.py index 584069d8..8e0537e5 100644 --- a/account_financial_report/tests/test_general_ledger.py +++ b/account_financial_report/tests/test_general_ledger.py @@ -39,19 +39,48 @@ class TestGeneralLedger(a_t_f_c.AbstractTestForeignCurrency): } def _getAdditionalFiltersToBeTested(self): - return [ + + additional_filters = [ {'only_posted_moves': True}, - {'hide_account_balance_at_0': True}, + {'hide_account_at_0': 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}, - {'hide_account_balance_at_0': True, 'centralize': True}, + {'hide_account_at_0': True, 'centralize': True}, { 'only_posted_moves': True, - 'hide_account_balance_at_0': True, + 'hide_account_at_0': 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): @@ -120,7 +149,7 @@ class TestGeneralLedgerReport(common.TransactionCase): 'date_from': self.fy_date_start, 'date_to': self.fy_date_end, 'only_posted_moves': True, - 'hide_account_balance_at_0': False, + 'hide_account_at_0': False, 'company_id': company.id, 'fy_start_date': self.fy_date_start, }) diff --git a/account_financial_report/tests/test_open_items.py b/account_financial_report/tests/test_open_items.py index 54076daa..197dfb72 100644 --- a/account_financial_report/tests/test_open_items.py +++ b/account_financial_report/tests/test_open_items.py @@ -36,6 +36,6 @@ class TestOpenItems(a_t_f_c.AbstractTestForeignCurrency): def _getAdditionalFiltersToBeTested(self): return [ {'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}, ] diff --git a/account_financial_report/tests/test_trial_balance.py b/account_financial_report/tests/test_trial_balance.py index 324cbcca..0435c81c 100644 --- a/account_financial_report/tests/test_trial_balance.py +++ b/account_financial_report/tests/test_trial_balance.py @@ -41,20 +41,20 @@ class TestTrialBalance(a_t_f_c.AbstractTestForeignCurrency): def _getAdditionalFiltersToBeTested(self): return [ {'only_posted_moves': True}, - {'hide_account_balance_at_0': True}, + {'hide_account_at_0': True}, {'show_partner_details': True}, {'hierarchy_on': 'computed'}, {'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'}, - {'only_posted_moves': True, 'hide_account_balance_at_0': True, + {'only_posted_moves': True, 'hide_account_at_0': True, '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}, - {'hide_account_balance_at_0': True, 'show_partner_details': True}, + {'hide_account_at_0': True, 'show_partner_details': True}, { 'only_posted_moves': True, - 'hide_account_balance_at_0': True, + 'hide_account_at_0': True, 'show_partner_details': True }, ] @@ -170,7 +170,7 @@ class TestTrialBalanceReport(common.TransactionCase): 'date_from': self.date_start, 'date_to': self.date_end, 'only_posted_moves': True, - 'hide_account_balance_at_0': False, + 'hide_account_at_0': False, 'hierarchy_on': hierarchy_on, 'company_id': company.id, 'fy_start_date': self.fy_date_start, @@ -528,7 +528,7 @@ class TestTrialBalanceReport(common.TransactionCase): 'date_from': self.date_start, 'date_to': self.date_end, 'only_posted_moves': True, - 'hide_account_balance_at_0': False, + 'hide_account_at_0': False, 'hierarchy_on': 'none', 'company_id': company.id, 'fy_start_date': self.fy_date_start, @@ -570,7 +570,7 @@ class TestTrialBalanceReport(common.TransactionCase): 'date_from': self.date_start, 'date_to': self.date_end, 'only_posted_moves': True, - 'hide_account_balance_at_0': False, + 'hide_account_at_0': False, 'hierarchy_on': 'none', 'company_id': company.id, 'fy_start_date': self.fy_date_start, @@ -613,7 +613,7 @@ class TestTrialBalanceReport(common.TransactionCase): 'date_from': self.date_start, 'date_to': self.date_end, 'only_posted_moves': True, - 'hide_account_balance_at_0': False, + 'hide_account_at_0': False, 'hierarchy_on': 'none', 'company_id': company.id, 'fy_start_date': self.fy_date_start, diff --git a/account_financial_report/wizard/aged_partner_balance_wizard.py b/account_financial_report/wizard/aged_partner_balance_wizard.py index 498a7814..97d68691 100644 --- a/account_financial_report/wizard/aged_partner_balance_wizard.py +++ b/account_financial_report/wizard/aged_partner_balance_wizard.py @@ -3,7 +3,6 @@ # Copyright 2016 Camptocamp SA, Onestein B.V. # 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.tools.safe_eval import safe_eval from odoo.tools import pycompat @@ -21,7 +20,7 @@ class AgedPartnerBalanceWizard(models.TransientModel): string='Company' ) 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'), ('all', 'All Entries')], string='Target Moves', diff --git a/account_financial_report/wizard/aged_partner_balance_wizard_view.xml b/account_financial_report/wizard/aged_partner_balance_wizard_view.xml index 2b618a4e..a2e3196c 100644 --- a/account_financial_report/wizard/aged_partner_balance_wizard_view.xml +++ b/account_financial_report/wizard/aged_partner_balance_wizard_view.xml @@ -19,15 +19,17 @@ -
diff --git a/account_financial_report/wizard/journal_ledger_wizard.py b/account_financial_report/wizard/journal_ledger_wizard.py index 74a34b3d..bc70430b 100644 --- a/account_financial_report/wizard/journal_ledger_wizard.py +++ b/account_financial_report/wizard/journal_ledger_wizard.py @@ -38,7 +38,7 @@ class JournalLedgerReportWizard(models.TransientModel): comodel_name='account.journal', string="Journals", domain="[('company_id', '=', company_id)]", - required=True, + required=False, ) move_target = fields.Selection( selection='_get_move_targets', @@ -121,13 +121,18 @@ class JournalLedgerReportWizard(models.TransientModel): @api.multi def _prepare_report_journal_ledger(self): 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 { 'date_from': self.date_from, 'date_to': self.date_to, 'move_target': self.move_target, 'foreign_currency': self.foreign_currency, '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, 'group_option': self.group_option, 'with_account_name': self.with_account_name, diff --git a/account_financial_report/wizard/open_items_wizard.py b/account_financial_report/wizard/open_items_wizard.py index 0e6696f6..60f5b7d3 100644 --- a/account_financial_report/wizard/open_items_wizard.py +++ b/account_financial_report/wizard/open_items_wizard.py @@ -3,7 +3,6 @@ # Copyright 2016 Camptocamp SA # 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.tools.safe_eval import safe_eval from odoo.tools import pycompat @@ -21,7 +20,7 @@ class OpenItemsReportWizard(models.TransientModel): string='Company' ) 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'), ('all', 'All Entries')], string='Target Moves', @@ -32,8 +31,8 @@ class OpenItemsReportWizard(models.TransientModel): string='Filter accounts', 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 ' 'with an ending balance at 0. ' 'If partners are filtered, ' @@ -102,7 +101,7 @@ class OpenItemsReportWizard(models.TransientModel): return { 'date_at': self.date_at, '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, 'company_id': self.company_id.id, 'filter_account_ids': [(6, 0, self.account_ids.ids)], diff --git a/account_financial_report/wizard/open_items_wizard_view.xml b/account_financial_report/wizard/open_items_wizard_view.xml index 8e0464b1..3a6122bf 100644 --- a/account_financial_report/wizard/open_items_wizard_view.xml +++ b/account_financial_report/wizard/open_items_wizard_view.xml @@ -16,19 +16,20 @@ - + -