diff --git a/account_financial_report/models/__init__.py b/account_financial_report/models/__init__.py index b5fef1fe..789507c9 100644 --- a/account_financial_report/models/__init__.py +++ b/account_financial_report/models/__init__.py @@ -1,3 +1,4 @@ from . import account from . import account_group from . import account_move_line +from . import ir_actions_report diff --git a/account_financial_report/models/ir_actions_report.py b/account_financial_report/models/ir_actions_report.py new file mode 100644 index 00000000..83c1435b --- /dev/null +++ b/account_financial_report/models/ir_actions_report.py @@ -0,0 +1,27 @@ +# Copyright 2020 Onestein () +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class IrActionsReport(models.Model): + _inherit = "ir.actions.report" + + @api.model + def _prepare_account_financial_report_context(self, data): + lang = data.get("account_financial_report_lang") + return dict(self.env.context or {}, lang=lang) if lang else self.env.context + + @api.model + def render_qweb_html(self, docids, data=None): + return super( + IrActionsReport, + self.with_context(self._prepare_account_financial_report_context(data)), + ).render_qweb_html(docids, data) + + @api.model + def render_xlsx(self, docids, data): + return super( + IrActionsReport, + self.with_context(self._prepare_account_financial_report_context(data)), + ).render_xlsx(docids, data) diff --git a/account_financial_report/wizard/aged_partner_balance_wizard.py b/account_financial_report/wizard/aged_partner_balance_wizard.py index c609a820..fd33abdd 100644 --- a/account_financial_report/wizard/aged_partner_balance_wizard.py +++ b/account_financial_report/wizard/aged_partner_balance_wizard.py @@ -159,6 +159,7 @@ class AgedPartnerBalanceWizard(models.TransientModel): "account_ids": self.account_ids.ids, "partner_ids": self.partner_ids.ids, "show_move_line_details": self.show_move_line_details, + "account_financial_report_lang": self.env.lang, } def _export(self, report_type): diff --git a/account_financial_report/wizard/general_ledger_wizard.py b/account_financial_report/wizard/general_ledger_wizard.py index 77382e63..ddf7ea6a 100644 --- a/account_financial_report/wizard/general_ledger_wizard.py +++ b/account_financial_report/wizard/general_ledger_wizard.py @@ -310,6 +310,7 @@ class GeneralLedgerReportWizard(models.TransientModel): "centralize": self.centralize, "fy_start_date": self.fy_start_date, "unaffected_earnings_account": self.unaffected_earnings_account.id, + "account_financial_report_lang": self.env.lang, } def _export(self, report_type): diff --git a/account_financial_report/wizard/journal_ledger_wizard.py b/account_financial_report/wizard/journal_ledger_wizard.py index aaff6a6b..8e077185 100644 --- a/account_financial_report/wizard/journal_ledger_wizard.py +++ b/account_financial_report/wizard/journal_ledger_wizard.py @@ -127,6 +127,7 @@ class JournalLedgerReportWizard(models.TransientModel): "sort_option": self.sort_option, "group_option": self.group_option, "with_account_name": self.with_account_name, + "account_financial_report_lang": self.env.lang, } def _export(self, report_type): diff --git a/account_financial_report/wizard/open_items_wizard.py b/account_financial_report/wizard/open_items_wizard.py index 601da455..2abd23e2 100644 --- a/account_financial_report/wizard/open_items_wizard.py +++ b/account_financial_report/wizard/open_items_wizard.py @@ -183,6 +183,7 @@ class OpenItemsReportWizard(models.TransientModel): "target_move": self.target_move, "account_ids": self.account_ids.ids, "partner_ids": self.partner_ids.ids or [], + "account_financial_report_lang": self.env.lang, } def _export(self, report_type): diff --git a/account_financial_report/wizard/trial_balance_wizard.py b/account_financial_report/wizard/trial_balance_wizard.py index 8061fa4a..ba7288e9 100644 --- a/account_financial_report/wizard/trial_balance_wizard.py +++ b/account_financial_report/wizard/trial_balance_wizard.py @@ -288,6 +288,7 @@ class TrialBalanceReportWizard(models.TransientModel): "hide_parent_hierarchy_level": self.hide_parent_hierarchy_level, "show_partner_details": self.show_partner_details, "unaffected_earnings_account": self.unaffected_earnings_account.id, + "account_financial_report_lang": self.env.lang, } def _export(self, report_type): diff --git a/account_financial_report/wizard/vat_report_wizard.py b/account_financial_report/wizard/vat_report_wizard.py index 0b2771d2..eaa8f9fd 100644 --- a/account_financial_report/wizard/vat_report_wizard.py +++ b/account_financial_report/wizard/vat_report_wizard.py @@ -113,6 +113,7 @@ class VATReportWizard(models.TransientModel): "based_on": self.based_on, "only_posted_moves": self.target_move == "posted", "tax_detail": self.tax_detail, + "account_financial_report_lang": self.env.lang, } def _export(self, report_type):