If you need to create a new QWeb report in Odoo that will be very similar to the existing one, you don’t need to rewrite the whole code from the existing report. Instead, you need to inherit it with flag primary=True and to make the changes that you want to see in the new report.
For Example, If you want to create a new report in the sale module, that is very similar to the existing one, the code should look like:
<openerp> <data> <template id="new_saleorder_report" inherit_id="sale.report_saleorder_document" primary="True"> <Here goes your customization> </template> </data> </openerp>
I’m trying to customize a report_invoice_document qweb report with the following code:
and I was getting the following error:
ValueError: Can’t validate view:
Element ” cannot be located in parent view
then I added attribute primary=”True” inside the tag and error was gone. So here are some questions:
1) Why my error was gone and do I have to add “primary” attribute every time I inherit a report?
2) It still prints out the original report without my customization, which is tag. I expected to see only “Invoice_test_2” in my printed customized report and nothing else. What am I doing wrong?
Well, it ignored my code in my post
Probably you have an error in the inherited view. I need to see the code in order to tell you exactly what is the issue. You can send it at firstname.lastname@example.org
When you add primary=”True”, you don’t change existing report but you are creating a new one. Actually, your report is not called at all, therefore, the error is gone.