Add information when printing an invoice [Odoo 15]

Viewed 48

I want to add more information in the printing of an invoice. I tried inheriting report_invoice.xml and account_invoice_report.py, and I added both on manifest.py

It still doesn't work (New info is not showing on the print) and I want to know why. Can u guys help me? Here is the code

report_invoice.xml

 <odoo>
        <data>
            <template inherit_id="report_invoice_document">
                <div id="informations" class="row mt-4 mb-4">
                    <div class="col-auto col-3 mw-100 mb-2" t-if="o.invoice_date" name="invoice_date">
                        <strong>Invoice Date:</strong>
                        <p class="m-0" t-field="o.invoice_date"/>
                    </div>
                </div>
            </template>
        </data>
</odoo>

account_invoice_report.py

class AccountInvoiceReport(models.Model):
    _inherit = "account.invoice.report"
1 Answers

You did not specify the template id and when Odoo will try to compute the full template id it will raise the following error (in the log):

TypeError: argument of type 'NoneType' is not iterable

To fix that error just set the template id.

To add some information to the invoice report you just need to inherit the invoice report document and make the module depend on the account module

You can check the OCA account_tax_invoice_note module which inherited the invoice report to add tax information

Related