OpenERP - QWeb报告

时间:2014-11-26 11:20:59

标签: openerp qwebview qweb

我在Odoo(OpenERP)v.8上编写模块以允许时间表的打印。 我使用QWeb报告类型,但我无法使用我需要使用的字段。

如果我从res_company模块调用字段,它可以正常工作。

<template id="report_timesheet_document">
    <t t-call="report.external_layout">
        <div class="page">
            <div class="row">
                <div>
                    <span t-esc="res_company.name"/>
                </div>
            </div>

如果我从其他模块调用字段,例如res_partner,它就不起作用。 我无法使用当前对象中的字段(时间表,继承自hr_timesheet_sheet.sheet)。

如果我使用t-esc

<span t-esc="o.date_from"/>
  

QWebException:&#34;&#39; NoneType&#39;对象没有属性&#39; date_from&#39;&#34;而   评估&#39; o.date_from&#39;

如果我使用t-field

<span t-field="o.date_from"/>
  

QWebException:&#39; NoneType&#39;对象没有属性&#39; _all_columns&#39;

我该如何解决?感谢。

1 个答案:

答案 0 :(得分:0)

修正:

<template id="report_timesheet">
    <t t-call="report.html_container">
        <t t-foreach="doc_ids" t-as="doc_id">
            <t t-raw="translate_doc(doc_id, doc_model, 'user_id.partner_id.lang', 'hr_timesheet_print.report_timesheet_document')"/>
        </t>
    </t>
</template>