Skip to Content
Menu
This question has been flagged
1 Reply
2051 Views

I'm trying to add new fields in a new invoice report without modifying the original template, Any ideas about how to implement it?

Avatar
Discard
Best Answer

Please check the below youtube:

How To Inherit And Create New Report In Odoo - YouTube

Avatar
Discard
Author

I've already followed this tutorial, but it gave me this error:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 331, in _compiled_fn
return compiled(self, append, new, options, log)
File "<template>", line 1, in template_yds_reports_invoice_report_modified_inherited_170
File "<template>", line 2, in body_call_content_168
AttributeError: 'NoneType' object has no attribute 'with_context'

Error to render compiling AST
AttributeError: 'NoneType' object has no attribute 'with_context'
Template: yds_reports.invoice_report_modified_inherited
Path: /t/t/t[1]
Node: <t t-set="o" t-value="o.with_context(lang=lang)"/>

Please post your code

Author

here is my template:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="invoice_report_modified_inherited" inherit_id="account.report_invoice_document" primary="True">
<xpath expr="//div[@id='total']" position="after">
<span t-field="o.advanced_payment_amount" />
</xpath>

</template>
</odoo>

And here is the report :
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<data>
<record id="action_construction_id_card" model="ir.actions.report">
<field name="name">Construction Invoice</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">yds_reports.invoice_report_modified_inherited</field>
<field name="report_file">yds_reports.invoice_report_modified_inherited</field>
<field name="print_report_name">'Construction Invoice- %s' % (object.name)</field>
<field name="binding_model_id" ref="account.model_account_move" />
<field name="binding_type">report</field>
</record>
</data>

</odoo>

I can't see the o.with_context(lang=lang) which showing in the error. I think you have another xml.