Skip to Content
Menu
This question has been flagged
2 Replies
7118 Views

I have already created a module that inherits/overrides the default Sales Order view.  Works great.  I am now trying to do the same thing for Purchase Orders.  However, when I try to install my module, Odoo complains that it can't find the template to inherit from:

ParseError: "External ID not found in the system: purchase.report_purchasequotation_document"

My XML code looks like this:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
        <template id="videx_po_body" inherit_id="purchase.report_purchasequotation_document">

...

The template is defined in the file "addons/purchase/views/report_purchasequotation.xml":

<template id="report_purchasequotation_document">

Why can't Odoo find the template to inherit?

Avatar
Discard
Author Best Answer

Well, by going to Settings-->Reports-->purchase.report_purchasequotation and clicking on the "Search associated Qweb views" link, I can see that "purchase.report_purchasequotation" is the only view ID listed.  So, that should be the view name to inherit from.  That view calls "purchase.report_purchasequotation_document" from within "<t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'purchase.report_purchasequotation_document')"/>", but I don't understand how this is different than the Sales Order views.  If I search associated Qweb views for "sale.report_saleorder", that screen lists both "sale.report_saleorder" and "sale.report_saleorder_document", but the latter is also called by the former in the file "report_saleorder.xml" : "<t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'sale.report_saleorder_document')"/>".  I would like to understand the difference!

--Edit-- Also, if I change the "inherit_id" to "purchase.report_purchasequotation",  then Odoo can find the template, but I am unable to override any of the elements inside of the sub-view "purchase.report_purchasequotation_document".  Odoo then complains that it can't find any of the referenced xpath elements, since the parent view contains only "t-" tags.  How can I override the elements of "purchase.report_purchasequotation_document"?

Avatar
Discard
Best Answer

Hi,

You can use the template id to override it . e.g in the sale order report_saleorder.xml:
 

<template id="report_saleorder">
    <t t-call="report.html_container">
        <t t-foreach="doc_ids" t-as="doc_id">
            <t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'sale.report_saleorder_document')"/>
        </t>
    </t>
</template>

in your custom saleorder qweb you can use :

<template id="sale.report_saleorder">
    <t t-call="report.html_container">
        <t t-foreach="doc_ids" t-as="doc_id">
            <t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'your_module_name.your_template_id')"/>
        </t>
    </t>
</template>

I hope this could helps ...

Avatar
Discard
Related Posts Replies Views Activity
1
Mar 22
6314
1
Jan 22
7743
1
Jul 16
23801
1
Dec 23
1096
2
Dec 22
22174