[FIX] l10n_au: fix traceback when printing a pdf

When installing l10n_au, printing a PDF from any invoice will raise a UserError
(this one: https://github.com/odoo/odoo/blob/16.0/odoo/addons/base/models/ir_actions_report.py#L699).

Indeed, the content of the PDF is empty. Because no qweb report is called since on line
https://github.com/odoo/odoo/blob/16.0/addons/account/views/report_invoice.xml#L335, the t-if is falsy.
Indeed, the `o._get_name_invoice_report()` returns `l10n_au.report_invoice_document` since the l10n_au
was made primary in https://github.com/odoo/odoo/commit/5079ace74958d4acd54d24a95579289a2eda92f1.

To solve that, we need to inherit the `report_invoice_with_payments` template in l10n_au, change the name
in the `t-if` and call the `l10n_au` report.

closes odoo/odoo#108081

X-original-commit: ab221bccc8cc7484efb56d3b1f620031b120f193
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Julien Van Roy <juvr@odoo.com>
This commit is contained in:
Julien Van Roy
2022-12-15 15:45:21 +01:00
parent ff619c4761
commit e34712d7b5
+14
View File
@@ -1,5 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_invoice" inherit_id="account.report_invoice">
<xpath expr='//t[@t-call="account.report_invoice_document"]' position="after">
<t t-if="o._get_name_invoice_report() == 'l10n_au.report_invoice_document'"
t-call="l10n_au.report_invoice_document" t-lang="lang"/>
</xpath>
</template>
<template id="report_invoice_with_payments" inherit_id="account.report_invoice_with_payments">
<xpath expr='//t[@t-call="account.report_invoice_document"]' position="after">
<t t-if="o._get_name_invoice_report() == 'l10n_au.report_invoice_document'"
t-call="l10n_au.report_invoice_document" t-lang="lang"/>
</xpath>
</template>
<template id="report_invoice_document" inherit_id="account.report_invoice_document" primary="True">
<xpath expr="//div[hasclass('page')]/h2" position="replace">
<h2>