简体   繁体   English

如何在odoo 11中做报告

[英]How to do a report in odoo 11

I'm a beginner on Odoo and I want to customize the report that already exists in sale and so I made an inherit of sale But my code shows me an error that is: Error while validating the constraint .... cannot be located in the parent view 我是Odoo的初学者,我想自定义销售中已经存在的报表,因此我继承了销售,但是我的代码显示了一个错误,即:验证约束时出错....不能位于父视图

In addition to that if I execute just the first part it works but it directly modifies the report of dirty but the report in my module is remain empty. 除此之外,如果我仅执行第一部分,它就可以工作,但是会直接修改脏报告,但模块中的报告仍为空。

Here is the code: 这是代码:

<template id="report_real_estate_rental_in" inherit_id="sale.report_saleorder_document">
    <xpath expr="//span[@t-field='doc.name']" position="after">
        <p>JE SUIS LA</p>
    </xpath>
</template>

<template id="report_real_estate_rental">
    <t  t-call = "web.html_container" >
        <t  t-foreach = "docs"  t-as = "o" >
            <t  t-call = "web.external_layout" >
                <div  class = "page" >
                    <t t-call="report_real_estate_rental_in"/>
                </div>
            </t>
        </t>
    </t>
</template>

This error usually occurs when xpath expression cannot be located in parent view. 当无法在父视图中找到xpath表达式时,通常会发生此错误。 Please make sure the xpath expression is correct and template id you're inheriting is correct. 请确保xpath表达式正确,并且您继承的模板ID是正确的。 Check out this link for inheriting and modifying existing report in Odoo. 检查此链接,以继承和修改Odoo中的现有报告。

If i got the question as you meant , when you use t-call you have to include the module name also , so it will be module_name.template_id . 如果我按照您的意思回答了问题,那么在使用t-call还必须包括模块名称,因此它将是module_name.template_id

In your case , change it as <t t-call="your_module_name.report_real_estate_rental_in"/> 根据您的情况,将其更改为<t t-call="your_module_name.report_real_estate_rental_in"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM