콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
7168 화면

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?

아바타
취소
작성자 베스트 답변

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

아바타
취소
베스트 답변

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

아바타
취소
관련 게시물 답글 화면 활동
1
3월 22
6388
1
1월 22
7808
1
7월 16
23884
1
12월 23
1133
2
12월 22
22233