Files
odoo_source/addons/l10n_au/views/report_invoice.xml
T
Julien Van Roy e34712d7b5 [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>
2022-12-15 15:45:21 +01:00

33 lines
1.9 KiB
XML

<?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>
<span t-if="o.move_type == 'out_invoice' and o.state == 'posted'">Tax Invoice</span>
<span t-elif="o.move_type == 'out_invoice' and o.state == 'draft'">Draft Tax Invoice</span>
<span t-elif="o.move_type == 'out_invoice' and o.state == 'cancel'">Cancelled Tax Invoice</span>
<span t-elif="o.move_type == 'out_refund' and o.state == 'posted'">Tax Credit Note</span>
<span t-elif="o.move_type == 'out_refund' and o.state == 'draft'">Draft Tax Credit Note</span>
<span t-elif="o.move_type == 'out_refund' and o.state == 'cancel'">Cancelled Tax Credit Note</span>
<span t-elif="o.move_type == 'in_refund'">Tax Vendor Credit Note</span>
<span t-elif="o.move_type == 'in_invoice'">Tax Vendor Bill</span>
<span t-if="o.name != '/'" t-field="o.name"/>
</h2>
</xpath>
</template>
</odoo>