【问题标题】:How to make a QWeb report widget?如何制作 QWeb 报告小部件?
【发布时间】:2018-08-11 12:18:55
【问题描述】:

我正在尝试创建一个简单的 Qweb 小部件。我的代码是这样的

<template id="contact_name">
    <address t-ignore="true" class="mb0" itemscope="itemscope" itemtype="http://schema.org/Signature">
        <div t-att-class="'name' not in fields and 'css_non_editable_mode_hidden'">
            <span itemprop="name" t-esc="name"/>
        </div>
    </address>
</template>

然后我像这样调用小部件

<address t-field="o.partner_id" t-field-options='{"widget": "contact_name", "fields": ["name"], "no_marker": true}' />

它没有打印出名称而是打印出对象res.partner(703,)

如何打印名称?光用&lt;span itemprop="name" t-esc="name"/&gt;还不够吗?

【问题讨论】:

  • 从您获得价值的字段中,传递“.name”参数。
  • 你能在回答部分举个例子吗?

标签: odoo odoo-8 qweb


【解决方案1】:
<div class="page">
            <div class="oe_structure"/>

                <div class="col-xs-6 pull-left">
                    <h2 style="color:red">
                        <span>Plan Order :
                            <span style="color:Red" t-field='doc.name'/>
                        </span>
                    </h2>
                </div>
                <div colspan="4" class="col-xs-6 text-right">
                    <span>
                        <img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', doc.name, 500, 50)"
                             style="width:100%;height:50px"/>
                    </span>
                </div>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多