[FIX] l10n_in: make invoice template primary
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) <jbw@odoo.com> Signed-off-by: Xavier Alt (xal) <xal@odoo.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<template id="l10n_in_report_invoice_document_inherit" inherit_id="account.report_invoice_document">
|
||||
<template id="l10n_in_report_invoice_document_inherit" inherit_id="account.report_invoice_document" primary="True">
|
||||
<xpath expr="//address[@t-field='o.partner_id']" position="after">
|
||||
<span t-field="o.l10n_in_gstin" t-if="o.company_id.account_fiscal_country_id.code == 'IN'"/>
|
||||
</xpath>
|
||||
@@ -60,4 +60,13 @@
|
||||
|
||||
</template>
|
||||
|
||||
<!-- Workaround for Studio reports, see odoo/odoo#60660 -->
|
||||
<template id="report_invoice" inherit_id="account.report_invoice">
|
||||
<xpath expr='//t[@t-call="account.report_invoice_document"]' position="after">
|
||||
<t t-elif="o._get_name_invoice_report() == 'l10n_in.l10n_in_report_invoice_document_inherit'"
|
||||
t-call="l10n_in.l10n_in_report_invoice_document_inherit"
|
||||
t-lang="lang"/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user