为什么“qweb”报告没有odoo中的数据?

2024-04-19 20:56:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我做了一个自定义报告,但当打印它时,一切都变成空白,没有数据或标题或任何东西

你知道吗 你知道吗

<template id="report_isrl_document">
    <t t-call="web.external_layout">
        <div class="page">
            <div class="row">
                <h3>Title</h3>
            </div>
        </div>
    </t>
</template>

<template id="report_isrl_main">
    <t t-call="web.html_container">
        <t t-foreach="docs" t-as="o">
            <t t-set="lang" t-value="o.user_id.lang if o.type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
            <t t-call="l10n_ve_isrl.report_isrl_document" t-lang="lang"/>
        </t>
    </t>
</template>

<record model="report.paperformat" id="paperformat_isrl_report">
    <field name="name">paperformat.isrl.report</field>
    <field name="default" eval="True"/>
    <field name="format">Letter</field>
    <field name="page_width">0</field>
    <field name="page_width">0</field>
    <field name="orientation">Landscape</field>
    <field name="margin_top">30</field>
    <field name="margin_right">5</field>
    <field name="margin_bottom">10</field>
    <field name="margin_left">5</field>
    <field name="header_line" eval="False"/>
    <field name="header_spacing">20</field>
    <field name="dpi">90</field>
</record>

<report
    string="ISRL Report"
    id="action_report_isrl"
    model="account.invoice"
    report_type="qweb-pdf"
    name="l10n_ve_isrl.report_isrl_main"
    file="l10n_ve_isrl.report_isrl_main"
    print_report_name="'ISRL Report New"
    paperformat="paperformat_isrl_report"
    menu="False"
/>

对报告的调用我按以下方式进行:

@api.multi
def get_isrl_report(self):

    data = {
        'ids': self.ids,
        'model': self._name,
        }

    return self.env.ref('l10n_ve_isrl.action_report_isrl').report_action(self, data=data)

所期望的是,页面和页脚出现,并在pdf打印的报告中的字标题,我在一个空的pdf中得到


Tags: namemarginselfreportdividfieldlang