Odoo 奥多12号报告发布

Odoo 奥多12号报告发布,odoo,odoo-12,Odoo,Odoo 12,我已经在odoo 12中为account.invoice开发了一个新的报告,但当我打算打印此报告时,它在12.0 branch中给了我类似的警告: 报告的模板“模板名称”错误,请与管理员联系 无法分离文件以另存为附件,因为报表模板不包含具有“article”类名的div上的属性“data oe model”和“data oe id” 在主分支中,它表示数据模型而不是数据oe模型,数据id而不是数据oe id,以及“页面”类名而不是“文章”类名 如果有人遇到过同样的问题并找到了解决方案,请让我知道

我已经在odoo 12中为account.invoice开发了一个新的报告,但当我打算打印此报告时,它在12.0 branch中给了我类似的警告:

报告的模板“模板名称”错误,请与管理员联系

无法分离文件以另存为附件,因为报表模板不包含具有“article”类名的div上的属性“data oe model”和“data oe id”

在主分支中,它表示数据模型而不是数据oe模型,数据id而不是数据oe id,以及“页面”类名而不是“文章”类名

如果有人遇到过同样的问题并找到了解决方案,请让我知道


谢谢

我在朋友的帮助下解决了这个问题:

在外部_布局中,必须定义“t-att-data-oe-model”和“t-att-data-oe-id”。添加以下内容:

<div class="article o_report_layout_standard" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id">
    <t t-call="web.address_layout"/>
    <t t-raw="0"/>
</div>

以前,这段代码(v11)是这样的:

<div class="article o_report_layout_standard">
    <t t-raw="0" />
</div>


希望它能解决你的问题。此更改是因为报表现在可以在v12中使用studio应用程序进行编辑。

是的,您需要修改外部布局,在我的情况下,它是自定义布局,我使用下面的XML解决了它

<template id="custom_layout">
    <!-- Multicompany -->
        <div class="article o_report_layout_standard" t-att-data-oe-model="doc and doc._name" t-att-data-oe-id="doc and doc.id">
            <t t-if ="doc and 'company_id' in doc" >
                <t t-set="company" t-value="doc.company_id"/>
                <t t-set="customer" t-value="doc.partner_id"/>
            </t>
            <t t-call="custom_sale_report_v12.custom_layout_header"/>
            <t t-raw="0"/>
            <t t-call="ce_sale_report_v12.custom_layout_footer"/>
        </div>
    </template>

如果报告没有报告,则可能发生此错误。 要解决这个问题,我们必须同时。。。大概是这样的:

<report
        id="report_invoice_html"
        model="MY_MODEL_NAME"
        string="Invoice HTML"
        name="MODULE.report_invoice_view"
        file="MODULE.report_invoice"
        report_type="qweb-html" />

<report
        id="report_invoice_pdf"
        model="MY_MODEL_NAME"
        string="Invoice PDF"
        name="MODULE.report_invoice_view"
        file="MODULE.report_invoice"
        report_type="qweb-pdf" />


如果查看ir_actions_report.py上的Odoo代码源,您将看到一条语句比较set(res_ids)!=设置(html_id),如果html模板不存在,则返回True,然后引发错误

我遇到了完全相同的错误。我有一个报表模块,它从v9运行到v11(在新版本中采用)。但在Odoo v12中,当我尝试打印发票时,会出现以下错误:“报告的模板‘发票’错误,请与管理员联系。无法分离文件以另存为附件,因为报告的模板不包含具有‘article’类名的div上的‘data oe model’和‘data oe id’属性。”截图:这个“外部布局”应该在哪里找到?谢谢通过这个,您可以调用外部布局