From f403480d3367583ebc9adf0258f114972133cf34 Mon Sep 17 00:00:00 2001 From: chaule97 Date: Mon, 18 Nov 2024 16:48:37 +0700 Subject: [PATCH] [MIG] account_financial_report: Migration to 18.0 --- account_financial_report/README.rst | 11 +- account_financial_report/__manifest__.py | 5 +- account_financial_report/models/account.py | 2 +- .../account_age_report_configuration.py | 10 +- .../models/account_group.py | 2 +- account_financial_report/readme/CONFIGURE.md | 2 +- .../readme/CONTRIBUTORS.md | 3 +- account_financial_report/readme/CREDITS.md | 1 + account_financial_report/report/__init__.py | 6 +- .../report/abstract_report.py | 4 +- .../report/abstract_report_xlsx.py | 6 +- .../report/aged_partner_balance.py | 36 +++--- .../report/aged_partner_balance_xlsx.py | 60 ++++----- .../report/general_ledger.py | 34 +++-- .../report/general_ledger_xlsx.py | 6 +- .../report/journal_ledger.py | 4 +- .../report/journal_ledger_xlsx.py | 2 +- account_financial_report/report/open_items.py | 2 +- .../report/open_items_xlsx.py | 2 +- .../report/templates/layouts.xml | 12 +- .../report/trial_balance.py | 15 +-- .../report/trial_balance_xlsx.py | 2 +- account_financial_report/report/vat_report.py | 12 +- .../report/vat_report_xlsx.py | 2 +- .../static/description/index.html | 15 ++- .../static/src/css/report_html.css | 7 -- .../static/src/js/report.esm.js | 3 +- .../static/src/js/report_action.esm.js | 1 - .../src/{css/report.css => scss/report.scss} | 116 +++++++++++------- .../static/src/scss/report_html.scss | 10 ++ account_financial_report/tests/__init__.py | 2 +- .../tests/test_general_ledger.py | 6 +- .../tests/test_journal_ledger.py | 7 +- .../tests/test_open_items.py | 4 +- .../tests/test_trial_balance.py | 23 ++-- .../tests/test_vat_report.py | 9 +- ...account_age_report_configuration_views.xml | 12 +- .../wizard/aged_partner_balance_wizard.py | 10 +- .../wizard/general_ledger_wizard.py | 10 +- .../wizard/journal_ledger_wizard.py | 12 +- .../wizard/open_items_wizard.py | 2 +- .../wizard/trial_balance_wizard.py | 18 +-- .../wizard/vat_report_wizard.py | 4 +- 43 files changed, 292 insertions(+), 220 deletions(-) create mode 100644 account_financial_report/readme/CREDITS.md delete mode 100644 account_financial_report/static/src/css/report_html.css rename account_financial_report/static/src/{css/report.css => scss/report.scss} (51%) create mode 100644 account_financial_report/static/src/scss/report_html.scss diff --git a/account_financial_report/README.rst b/account_financial_report/README.rst index b7224f9e6cfa..1a68eb294294 100644 --- a/account_financial_report/README.rst +++ b/account_financial_report/README.rst @@ -75,7 +75,7 @@ Example of configuration inferior limit: It means the first interval is from 0 to 15, the second from 16 to 30, and the third is 61+. -Go on 'Invoicing' -> 'Reports' -> 'OCA accounting reports' -> 'Aged +Go on 'Invoicing' -> 'Reporting' -> 'OCA accounting reports' -> 'Aged Partner Balance' When wizard is open, you need to select your interval configuration and @@ -167,7 +167,7 @@ Contributors - Pedro M. Baeza - Sergio Teruel - Ernesto Tejeda - - Jo??o Marques + - João Marques - Alexandre D. D??az - V??ctor Mart??nez - Carolina Fernandez @@ -180,10 +180,17 @@ Contributors - Lois Rilo - Saran Lim. - Omar Casti??eira +- Chau Le Much of the work in this module was done at a sprint in Sorrento, Italy in April 2016. +Other credits +------------- + +The migration of this module from 17.0 to 18.0 was financially supported +by Camptocamp. + Maintainers ----------- diff --git a/account_financial_report/__manifest__.py b/account_financial_report/__manifest__.py index 2a0ffae5322a..ce9ee3736d43 100644 --- a/account_financial_report/__manifest__.py +++ b/account_financial_report/__manifest__.py @@ -2,11 +2,11 @@ # Author: Julien Coux # Copyright 2016 Camptocamp SA # Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com) -# Copyright 2021 Tecnativa - Jo??o Marques +# Copyright 2021 Tecnativa - João Marques # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Account Financial Reports", - "version": "17.0.1.5.0", + "version": "18.0.0.1.0", "category": "Reporting", "summary": "OCA Financial Reports", "author": "Camptocamp," @@ -47,6 +47,7 @@ "assets": { "web.assets_backend": [ "account_financial_report/static/src/js/*", + "account_financial_report/static/src/scss/*", "account_financial_report/static/src/xml/**/*", ], }, diff --git a/account_financial_report/models/account.py b/account_financial_report/models/account.py index 7a56bc172064..6f649b3d535f 100644 --- a/account_financial_report/models/account.py +++ b/account_financial_report/models/account.py @@ -1,4 +1,4 @@ -# ?? 2011 Guewen Baconnier (Camptocamp) +# © 2011 Guewen Baconnier (Camptocamp) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).- from odoo import fields, models diff --git a/account_financial_report/models/account_age_report_configuration.py b/account_financial_report/models/account_age_report_configuration.py index 9d69d5a1abba..7dfd159f4b22 100644 --- a/account_financial_report/models/account_age_report_configuration.py +++ b/account_financial_report/models/account_age_report_configuration.py @@ -1,7 +1,7 @@ # Copyright 2023 Ernesto García # Copyright 2023 Carolina Fernandez # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import ValidationError @@ -21,7 +21,7 @@ class AccountAgeReportConfiguration(models.Model): def _check_line_ids(self): for rec in self: if not rec.line_ids: - raise ValidationError(_("Must complete Configuration Lines")) + raise ValidationError(self.env._("Must complete Configuration Lines")) class AccountAgeReportConfigurationLine(models.Model): @@ -36,12 +36,14 @@ class AccountAgeReportConfigurationLine(models.Model): def _check_inferior_limit(self): for rec in self: if rec.inferior_limit <= 0: - raise ValidationError(_("Inferior Limit must be greather than zero")) + raise ValidationError( + self.env._("Inferior Limit must be greather than zero") + ) _sql_constraints = [ ( "unique_name_config_combination", "UNIQUE(name,account_age_report_config_id)", - _("Name must be unique per report configuration"), + "Name must be unique per report configuration", ) ] diff --git a/account_financial_report/models/account_group.py b/account_financial_report/models/account_group.py index 1f6f2eea317a..f922663d1329 100644 --- a/account_financial_report/models/account_group.py +++ b/account_financial_report/models/account_group.py @@ -1,4 +1,4 @@ -# ?? 2018 Forest and Biomass Romania SA +# © 2018 Forest and Biomass Romania SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models diff --git a/account_financial_report/readme/CONFIGURE.md b/account_financial_report/readme/CONFIGURE.md index 74205bfd4342..a4ddb1a5e536 100644 --- a/account_financial_report/readme/CONFIGURE.md +++ b/account_financial_report/readme/CONFIGURE.md @@ -16,7 +16,7 @@ Example of configuration inferior limit: It means the first interval is from 0 to 15, the second from 16 to 30, and the third is 61+. -Go on 'Invoicing' -> 'Reports' -> 'OCA accounting reports' -> 'Aged Partner Balance' +Go on 'Invoicing' -> 'Reporting' -> 'OCA accounting reports' -> 'Aged Partner Balance' When wizard is open, you need to select your interval configuration and print report. diff --git a/account_financial_report/readme/CONTRIBUTORS.md b/account_financial_report/readme/CONTRIBUTORS.md index e305417e1818..e16fb6e2f09c 100644 --- a/account_financial_report/readme/CONTRIBUTORS.md +++ b/account_financial_report/readme/CONTRIBUTORS.md @@ -20,7 +20,7 @@ - Pedro M. Baeza - Sergio Teruel - Ernesto Tejeda - - Jo??o Marques + - João Marques - Alexandre D. D??az - V??ctor Mart??nez - Carolina Fernandez @@ -30,6 +30,7 @@ - Lois Rilo \<\> - Saran Lim. \<\> - Omar Casti??eira \<\> +- Chau Le \<\> 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/CREDITS.md b/account_financial_report/readme/CREDITS.md new file mode 100644 index 000000000000..83b3ec91f7d5 --- /dev/null +++ b/account_financial_report/readme/CREDITS.md @@ -0,0 +1 @@ +The migration of this module from 17.0 to 18.0 was financially supported by Camptocamp. diff --git a/account_financial_report/report/__init__.py b/account_financial_report/report/__init__.py index d0581b03127e..ae2ee3d54a48 100644 --- a/account_financial_report/report/__init__.py +++ b/account_financial_report/report/__init__.py @@ -1,6 +1,6 @@ -# ?? 2015 Yannick Vaucher (Camptocamp) -# ?? 2016 Damien Crier (Camptocamp) -# ?? 2016 Julien Coux (Camptocamp) +# © 2015 Yannick Vaucher (Camptocamp) +# © 2016 Damien Crier (Camptocamp) +# © 2016 Julien Coux (Camptocamp) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).- from . import abstract_report diff --git a/account_financial_report/report/abstract_report.py b/account_financial_report/report/abstract_report.py index c133ca86bd72..b97d035492f0 100644 --- a/account_financial_report/report/abstract_report.py +++ b/account_financial_report/report/abstract_report.py @@ -143,7 +143,9 @@ def _get_accounts_data(self, accounts_ids): return accounts_data def _get_journals_data(self, journals_ids): - journals = self.env["account.journal"].browse(journals_ids) + journals = self.env["account.journal"].search_fetch( + [("id", "in", journals_ids)], ["code"] + ) journals_data = {} for journal in journals: journals_data.update({journal.id: {"id": journal.id, "code": journal.code}}) diff --git a/account_financial_report/report/abstract_report_xlsx.py b/account_financial_report/report/abstract_report_xlsx.py index 75c606b0eb4f..d4050151a245 100644 --- a/account_financial_report/report/abstract_report_xlsx.py +++ b/account_financial_report/report/abstract_report_xlsx.py @@ -1,6 +1,6 @@ # Author: Julien Coux # Copyright 2016 Camptocamp SA -# Copyright 2021 Tecnativa - Jo??o Marques +# Copyright 2021 Tecnativa - João Marques # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import models @@ -571,7 +571,7 @@ def _get_currency_amt_header_format(self, line_object, report_data): """Return amount header format for each currency.""" format_amt = report_data["formats"]["format_header_amount"] if line_object.currency_id: - field_name = "format_header_amount_%s" % line_object.currency_id.name + field_name = f"format_header_amount_{line_object.currency_id.name}" if hasattr(self, field_name): format_amt = getattr(self, field_name) else: @@ -589,7 +589,7 @@ def _get_currency_amt_header_format_dict(self, line_object, report_data): """Return amount header format for each currency.""" format_amt = report_data["formats"]["format_header_amount"] if line_object["currency_id"]: - field_name = "format_header_amount_%s" % line_object["currency_name"] + field_name = f"format_header_amount_{line_object['currency_name']}" if hasattr(self, field_name): format_amt = getattr(self, field_name) else: diff --git a/account_financial_report/report/aged_partner_balance.py b/account_financial_report/report/aged_partner_balance.py index ed425f167c70..312e1f42d901 100644 --- a/account_financial_report/report/aged_partner_balance.py +++ b/account_financial_report/report/aged_partner_balance.py @@ -1,4 +1,4 @@ -# ?? 2016 Julien Coux (Camptocamp) +# © 2016 Julien Coux (Camptocamp) # Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -72,25 +72,21 @@ def _calculate_amounts( else: ag_pb_data[acc_id]["older"] += residual ag_pb_data[acc_id][prt_id]["older"] += residual - if due_date: - days_difference = abs((today - due_date).days) - for index, line in enumerate(interval_lines): - lower_limit = ( - 0 if not index else interval_lines[index - 1].inferior_limit - ) - next_line = ( - interval_lines[index] if index < len(interval_lines) else None - ) - interval_range = self._get_values_for_range_intervals( - lower_limit, next_line.inferior_limit - ) - if ( - days_difference in interval_range - or days_difference == line.inferior_limit - ): - ag_pb_data[acc_id][line] += residual - ag_pb_data[acc_id][prt_id][line] += residual - break + + days_difference = abs((today - due_date).days) + for index, line in enumerate(interval_lines): + lower_limit = 0 if not index else interval_lines[index - 1].inferior_limit + next_line = interval_lines[index] if index < len(interval_lines) else None + interval_range = self._get_values_for_range_intervals( + lower_limit, next_line.inferior_limit + ) + if ( + days_difference in interval_range + or days_difference == line.inferior_limit + ): + ag_pb_data[acc_id][line] += residual + ag_pb_data[acc_id][prt_id][line] += residual + break return ag_pb_data def _get_values_for_range_intervals(self, num1, num2): diff --git a/account_financial_report/report/aged_partner_balance_xlsx.py b/account_financial_report/report/aged_partner_balance_xlsx.py index c6e44c83b1c8..17d5906f1be6 100644 --- a/account_financial_report/report/aged_partner_balance_xlsx.py +++ b/account_financial_report/report/aged_partner_balance_xlsx.py @@ -1,9 +1,9 @@ # Author: Julien Coux # Copyright 2016 Camptocamp SA -# Copyright 2021 Tecnativa - Jo??o Marques +# Copyright 2021 Tecnativa - João Marques # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import _, models +from odoo import models class AgedPartnerBalanceXslx(models.AbstractModel): @@ -13,7 +13,7 @@ class AgedPartnerBalanceXslx(models.AbstractModel): def _get_report_name(self, report, data=False): company_id = data.get("company_id", False) - report_name = _("Aged Partner Balance") + report_name = self.env._("Aged Partner Balance") if company_id: company = self.env["res.company"].browse(company_id) suffix = f" - {company.name} - {company.currency_id.name}" @@ -22,16 +22,16 @@ def _get_report_name(self, report, data=False): def _get_report_columns_without_move_line_details(self, report, column_index): report_columns = { - 0: {"header": _("Partner"), "field": "name", "width": 70}, + 0: {"header": self.env._("Partner"), "field": "name", "width": 70}, 1: { - "header": _("Residual"), + "header": self.env._("Residual"), "field": "residual", "field_footer_total": "residual", "type": "amount", "width": 14, }, 2: { - "header": _("Current"), + "header": self.env._("Current"), "field": "current", "field_footer_total": "current", "field_footer_percent": "percent_current", @@ -43,7 +43,7 @@ def _get_report_columns_without_move_line_details(self, report, column_index): report_columns.update( { 3: { - "header": _("Age ≤ 30 d."), + "header": self.env._("Age ≤ 30 d."), "field": "30_days", "field_footer_total": "30_days", "field_footer_percent": "percent_30_days", @@ -51,7 +51,7 @@ def _get_report_columns_without_move_line_details(self, report, column_index): "width": 14, }, 4: { - "header": _("Age ≤ 60 d."), + "header": self.env._("Age ≤ 60 d."), "field": "60_days", "field_footer_total": "60_days", "field_footer_percent": "percent_60_days", @@ -59,7 +59,7 @@ def _get_report_columns_without_move_line_details(self, report, column_index): "width": 14, }, 5: { - "header": _("Age ≤ 90 d."), + "header": self.env._("Age ≤ 90 d."), "field": "90_days", "field_footer_total": "90_days", "field_footer_percent": "percent_90_days", @@ -67,7 +67,7 @@ def _get_report_columns_without_move_line_details(self, report, column_index): "width": 14, }, 6: { - "header": _("Age ≤ 120 d."), + "header": self.env._("Age ≤ 120 d."), "field": "120_days", "field_footer_total": "120_days", "field_footer_percent": "percent_120_days", @@ -75,7 +75,7 @@ def _get_report_columns_without_move_line_details(self, report, column_index): "width": 14, }, 7: { - "header": _("Older"), + "header": self.env._("Older"), "field": "older", "field_footer_total": "older", "field_footer_percent": "percent_older", @@ -98,15 +98,15 @@ def _get_report_columns_without_move_line_details(self, report, column_index): def _get_report_columns_with_move_line_details(self, report, column_index): report_columns = { - 0: {"header": _("Date"), "field": "date", "width": 11}, - 1: {"header": _("Entry"), "field": "entry", "width": 18}, - 2: {"header": _("Journal"), "field": "journal", "width": 8}, - 3: {"header": _("Account"), "field": "account", "width": 9}, - 4: {"header": _("Partner"), "field": "partner", "width": 25}, - 5: {"header": _("Ref - Label"), "field": "ref_label", "width": 40}, - 6: {"header": _("Due date"), "field": "due_date", "width": 11}, + 0: {"header": self.env._("Date"), "field": "date", "width": 11}, + 1: {"header": self.env._("Entry"), "field": "entry", "width": 18}, + 2: {"header": self.env._("Journal"), "field": "journal", "width": 8}, + 3: {"header": self.env._("Account"), "field": "account", "width": 9}, + 4: {"header": self.env._("Partner"), "field": "partner", "width": 25}, + 5: {"header": self.env._("Ref - Label"), "field": "ref_label", "width": 40}, + 6: {"header": self.env._("Due date"), "field": "due_date", "width": 11}, 7: { - "header": _("Residual"), + "header": self.env._("Residual"), "field": "residual", "field_footer_total": "residual", "field_final_balance": "residual", @@ -114,7 +114,7 @@ def _get_report_columns_with_move_line_details(self, report, column_index): "width": 14, }, 8: { - "header": _("Current"), + "header": self.env._("Current"), "field": "current", "field_footer_total": "current", "field_footer_percent": "percent_current", @@ -127,7 +127,7 @@ def _get_report_columns_with_move_line_details(self, report, column_index): report_columns.update( { 9: { - "header": _("Age ≤ 30 d."), + "header": self.env._("Age ≤ 30 d."), "field": "30_days", "field_footer_total": "30_days", "field_footer_percent": "percent_30_days", @@ -136,7 +136,7 @@ def _get_report_columns_with_move_line_details(self, report, column_index): "width": 14, }, 10: { - "header": _("Age ≤ 60 d."), + "header": self.env._("Age ≤ 60 d."), "field": "60_days", "field_footer_total": "60_days", "field_footer_percent": "percent_60_days", @@ -145,7 +145,7 @@ def _get_report_columns_with_move_line_details(self, report, column_index): "width": 14, }, 11: { - "header": _("Age ≤ 90 d."), + "header": self.env._("Age ≤ 90 d."), "field": "90_days", "field_footer_total": "90_days", "field_footer_percent": "percent_90_days", @@ -154,7 +154,7 @@ def _get_report_columns_with_move_line_details(self, report, column_index): "width": 14, }, 12: { - "header": _("Age ≤ 120 d."), + "header": self.env._("Age ≤ 120 d."), "field": "120_days", "field_footer_total": "120_days", "field_footer_percent": "percent_120_days", @@ -163,7 +163,7 @@ def _get_report_columns_with_move_line_details(self, report, column_index): "width": 14, }, 13: { - "header": _("Older"), + "header": self.env._("Older"), "field": "older", "field_footer_total": "older", "field_footer_percent": "percent_older", @@ -194,12 +194,12 @@ def _get_report_columns(self, report): def _get_report_filters(self, report): return [ - [_("Date at filter"), report.date_at.strftime("%d/%m/%Y")], + [self.env._("Date at filter"), report.date_at.strftime("%d/%m/%Y")], [ - _("Target moves filter"), - _("All posted entries") + self.env._("Target moves filter"), + self.env._("All posted entries") if report.target_move == "posted" - else _("All entries"), + else self.env._("All entries"), ], ] @@ -321,7 +321,7 @@ def write_ending_balance_from_dict(self, my_object, report_data): for Aged Partner Balance """ name = None - label = _("Partner cumul aged balance") + label = self.env._("Partner cumul aged balance") return super().write_ending_balance_from_dict( my_object, name, label, report_data ) diff --git a/account_financial_report/report/general_ledger.py b/account_financial_report/report/general_ledger.py index b9c5ccf1e7a2..05f67948b110 100644 --- a/account_financial_report/report/general_ledger.py +++ b/account_financial_report/report/general_ledger.py @@ -1,4 +1,4 @@ -# ?? 2016 Julien Coux (Camptocamp) +# © 2016 Julien Coux (Camptocamp) # Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com) # Copyright 2022 Tecnativa - V??ctor Mart??nez # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -17,14 +17,18 @@ class GeneralLedgerReport(models.AbstractModel): _inherit = "report.account_financial_report.abstract_report" def _get_analytic_data(self, account_ids): - analytic_accounts = self.env["account.analytic.account"].browse(account_ids) + analytic_accounts = self.env["account.analytic.account"].search_fetch( + [("id", "in", account_ids)], ["name"] + ) analytic_data = {} for account in analytic_accounts: analytic_data.update({account.id: {"name": account.name}}) return analytic_data def _get_taxes_data(self, taxes_ids): - taxes = self.env["account.tax"].browse(taxes_ids) + taxes = self.env["account.tax"].search_fetch( + [("id", "in", taxes_ids)], ["amount", "amount_type", "display_name"] + ) taxes_data = {} for tax in taxes: taxes_data.update( @@ -61,7 +65,7 @@ def _get_account_type_domain(self, grouped_by): def _get_acc_prt_accounts_ids(self, company_id, grouped_by): accounts_domain = [ - ("company_id", "=", company_id), + ("company_ids", "in", [company_id]), ] + self._get_account_type_domain(grouped_by) acc_prt_accounts = self.env["account.account"].search(accounts_domain) return acc_prt_accounts.ids @@ -70,7 +74,7 @@ def _get_initial_balances_bs_ml_domain( self, account_ids, company_id, date_from, base_domain, grouped_by, acc_prt=False ): accounts_domain = [ - ("company_id", "=", company_id), + ("company_ids", "in", [company_id]), ("include_initial_balance", "=", True), ] if account_ids: @@ -88,7 +92,7 @@ def _get_initial_balances_pl_ml_domain( self, account_ids, company_id, date_from, fy_start_date, base_domain ): accounts_domain = [ - ("company_id", "=", company_id), + ("company_ids", "in", [company_id]), ("include_initial_balance", "=", False), ] if account_ids: @@ -118,7 +122,7 @@ def _get_initial_balance_fy_pl_ml_domain( self, account_ids, company_id, fy_start_date, base_domain ): accounts_domain = [ - ("company_id", "=", company_id), + ("company_ids", "in", [company_id]), ("include_initial_balance", "=", False), ] if account_ids: @@ -155,7 +159,13 @@ def _get_pl_initial_balance( return pl_initial_balance def _get_gl_initial_acc( - self, account_ids, company_id, date_from, fy_start_date, base_domain, grouped_by + self, + account_ids, + company_id, + date_from, + fy_start_date, + base_domain, + grouped_by, ): initial_domain_bs = self._get_initial_balances_bs_ml_domain( account_ids, company_id, date_from, base_domain, grouped_by @@ -182,7 +192,7 @@ def _prepare_gen_ld_data(self, gl_initial_acc, domain, grouped_by): data[acc_id]["id"] = acc_id if grouped_by: data[acc_id][grouped_by] = False - method = "_prepare_gen_ld_data_group_%s" % grouped_by + method = f"_prepare_gen_ld_data_group_{grouped_by}" if not hasattr(self, method): return data return getattr(self, method)(data, domain, grouped_by) @@ -265,7 +275,7 @@ def _get_initial_balance_data( unaffected_earnings_account = False base_domain = [] if company_id: - base_domain += [("company_id", "=", company_id)] + base_domain += [("company_id", "in", [company_id])] if partner_ids: base_domain += [("partner_id", "in", partner_ids)] if only_posted_moves: @@ -423,7 +433,9 @@ def _prepare_ml_items(self, move_line, grouped_by): res.append({"id": item_id, "name": item_name}) elif move_line["tax_ids"]: for tax_id in move_line["tax_ids"]: - tax_item = self.env["account.tax"].browse(tax_id) + tax_item = self.env["account.tax"].search_fetch( + [("id", "=", tax_id)], ["name"] + ) res.append({"id": tax_item.id, "name": tax_item.name}) else: res.append({"id": 0, "name": "Missing Tax"}) diff --git a/account_financial_report/report/general_ledger_xlsx.py b/account_financial_report/report/general_ledger_xlsx.py index 0b7e37529272..39603f3b8505 100644 --- a/account_financial_report/report/general_ledger_xlsx.py +++ b/account_financial_report/report/general_ledger_xlsx.py @@ -1,7 +1,7 @@ # Author: Damien Crier # Author: Julien Coux # Copyright 2016 Camptocamp SA -# Copyright 2021 Tecnativa - Jo??o Marques +# Copyright 2021 Tecnativa - João Marques # Copyright 2022 Tecnativa - V??ctor Mart??nez # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -203,7 +203,7 @@ def _generate_report_content(self, workbook, report, data, report_data): ) else: analytic_distribution += ( - "%s " % analytic_data[int(account_id)]["name"] + f"{analytic_data[int(account_id)]['name']} " ) line.update( { @@ -313,7 +313,7 @@ def _generate_report_content(self, workbook, report, data, report_data): ) else: analytic_distribution += ( - "%s " % analytic_data[int(account_id)]["name"] + f"{analytic_data[int(account_id)]['name']} " ) line.update( { diff --git a/account_financial_report/report/journal_ledger.py b/account_financial_report/report/journal_ledger.py index 04bbffcec1af..1b22232f7fec 100644 --- a/account_financial_report/report/journal_ledger.py +++ b/account_financial_report/report/journal_ledger.py @@ -264,7 +264,9 @@ def _get_journal_tax_lines(self, wizard, moves_data): journal_id = ml_data["journal_id"] if journal_id not in journals_taxes_data.keys(): journals_taxes_data[journal_id] = {} - taxes = self.env["account.tax"].browse(tax_ids) + taxes = self.env["account.tax"].search_fetch( + [("id", "in", tax_ids)], ["name", "description"] + ) for tax in taxes: if tax.id not in journals_taxes_data[journal_id]: journals_taxes_data[journal_id][tax.id] = { diff --git a/account_financial_report/report/journal_ledger_xlsx.py b/account_financial_report/report/journal_ledger_xlsx.py index 30207d44f420..8c72f4607312 100644 --- a/account_financial_report/report/journal_ledger_xlsx.py +++ b/account_financial_report/report/journal_ledger_xlsx.py @@ -1,7 +1,7 @@ # Author: Damien Crier # Author: Julien Coux # Copyright 2016 Camptocamp SA -# Copyright 2021 Tecnativa - Jo??o Marques +# Copyright 2021 Tecnativa - João Marques # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import _, models diff --git a/account_financial_report/report/open_items.py b/account_financial_report/report/open_items.py index db496be28be4..ae05d32ff69c 100644 --- a/account_financial_report/report/open_items.py +++ b/account_financial_report/report/open_items.py @@ -1,4 +1,4 @@ -# ?? 2016 Julien Coux (Camptocamp) +# © 2016 Julien Coux (Camptocamp) # Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/account_financial_report/report/open_items_xlsx.py b/account_financial_report/report/open_items_xlsx.py index 11f23c58e908..2f7d7a491513 100644 --- a/account_financial_report/report/open_items_xlsx.py +++ b/account_financial_report/report/open_items_xlsx.py @@ -1,6 +1,6 @@ # Author: Julien Coux # Copyright 2016 Camptocamp SA -# Copyright 2021 Tecnativa - Jo??o Marques +# Copyright 2021 Tecnativa - João Marques # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import _, models diff --git a/account_financial_report/report/templates/layouts.xml b/account_financial_report/report/templates/layouts.xml index 6fd62ed312f3..2e607de02283 100644 --- a/account_financial_report/report/templates/layouts.xml +++ b/account_financial_report/report/templates/layouts.xml @@ -1,10 +1,7 @@