From 11de9acee703de840ae2b8d1d3e6674229a12ed5 Mon Sep 17 00:00:00 2001 From: eLBati Date: Mon, 29 Jan 2024 17:59:35 +0100 Subject: [PATCH] FIX l10n_it_withholding_tax when other localizations are installed Steps: - Install l10n_it_withholding_tax - install l10n_ar - with AR company, print invoice PDF Get ValueError: Element '' cannot be located in parent view --- l10n_it_withholding_tax/models/account.py | 6 ++++++ l10n_it_withholding_tax/views/report_invoice.xml | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/l10n_it_withholding_tax/models/account.py b/l10n_it_withholding_tax/models/account.py index a70c488e40bb..b0fab0ba8f5d 100644 --- a/l10n_it_withholding_tax/models/account.py +++ b/l10n_it_withholding_tax/models/account.py @@ -546,6 +546,12 @@ def action_register_payment(self): res.update({"context": ctx}) return res + def _get_name_invoice_report(self): + self.ensure_one() + if self.company_id.account_fiscal_country_id.code == 'IT': + return 'l10n_it_withholding_tax.print_withholding_tax' + return super()._get_name_invoice_report() + class AccountMoveLine(models.Model): _inherit = "account.move.line" diff --git a/l10n_it_withholding_tax/views/report_invoice.xml b/l10n_it_withholding_tax/views/report_invoice.xml index d6ca950e2dbb..e8f3c00f1b7f 100644 --- a/l10n_it_withholding_tax/views/report_invoice.xml +++ b/l10n_it_withholding_tax/views/report_invoice.xml @@ -4,8 +4,21 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> + + + -