OpenERP - QWeb report

2k views Asked by At

I'm writing a module on Odoo (OpenERP) v.8 to allow timesheet's print. I'm using QWeb report type, but I can't use the fields that I need to use.

If I call a field from res_company module, it works correctly.

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

If I call a field from other modules, like res_partner, it doesn't work. I can't use fields from the current object (timesheet, inherited from hr_timesheet_sheet.sheet).

If I use t-esc:

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

QWebException: "'NoneType' object has no attribute 'date_from'" while evaluating 'o.date_from'

If I use t-field

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

QWebException: 'NoneType' object has no attribute '_all_columns'

How can I resolve? Thanks.

1

There are 1 answers

0
vencizon On BEST ANSWER

Fixed:

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