1
votes

I'm trying to create a simple Qweb widget. My code is like this

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

Then I called the widget like this

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

It did not print out name but print out the object res.partner(703,)

How is it to print the name? Is it not enough to just to use <span itemprop="name" t-esc="name"/>?

1
From the field where you are getting value, pass '.name' argument. - Keval Mehta
Can you give an example in the answer section? - strike_noir

1 Answers

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