Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to inherit purchase order body view?

By
Jeff Beidler
on 1/14/15, 7:34 PM 1,137 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?

0

Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
2988
| 5 3 5
Sudan
--Ahmed M.Elmubarak--


Ahmed M.Elmubarak
On 3/8/15, 5:37 AM

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 ...

0
Jeff Beidler
On 1/15/15, 11:44 AM

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"?

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/14/15, 7:34 PM
Seen: 1137 times
Last updated: 3/16/15, 8:10 AM