From 2ae4c791d947b71a54b71c3ae2ccfe2f2bec24b6 Mon Sep 17 00:00:00 2001 From: Xavier ALT Date: Fri, 19 Jan 2024 16:21:38 +0000 Subject: [PATCH] [FIX] l10n_in: make invoice template primary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid specific changes of l10n_in invoice report to affect other countries. OPW-2504287 closes odoo/odoo#152862 X-original-commit: 87a1fa6f49f1dc1824cfcdc2701d92d0382fa652 Signed-off-by: de Wouters de Bouchout Jean-BenoƮt (jbw) Signed-off-by: Xavier Alt (xal) --- addons/l10n_in/models/account_invoice.py | 8 ++++++++ addons/l10n_in/views/report_invoice.xml | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/addons/l10n_in/models/account_invoice.py b/addons/l10n_in/models/account_invoice.py index a62d470fd36..d2f1354ae83 100644 --- a/addons/l10n_in/models/account_invoice.py +++ b/addons/l10n_in/models/account_invoice.py @@ -62,6 +62,14 @@ class AccountMove(models.Model): else: move.l10n_in_state_id = False + def _get_name_invoice_report(self): + if self.country_code == 'IN': + # TODO: remove the view mode check in master, only for stable releases + in_invoice_view = self.env.ref('l10n_in.l10n_in_report_invoice_document_inherit', raise_if_not_found=False) + if (in_invoice_view and in_invoice_view.mode == "primary"): + return 'l10n_in.l10n_in_report_invoice_document_inherit' + return super()._get_name_invoice_report() + def _post(self, soft=True): """Use journal type to define document type because not miss state in any entry including POS entry""" posted = super()._post(soft) diff --git a/addons/l10n_in/views/report_invoice.xml b/addons/l10n_in/views/report_invoice.xml index 8615f3fdadb..3f7847b1ae3 100644 --- a/addons/l10n_in/views/report_invoice.xml +++ b/addons/l10n_in/views/report_invoice.xml @@ -1,6 +1,6 @@ -