我使用widget联系人有以下字段。
<div t-field="o.partner_id" t-options="{"widget": "contact", "fields": ["address", "name"], "no_marker": True}"/>
这不显示state_id
,我该如何包含它?
答案 0 :(得分:0)
您可以继承base.contact
模板以添加state_id
字段。
<template id="contact" inherit_id="base.contact">
<xpath expr="//address/div[2]/div[2]" position="after">
<div t-if="object.state_id and 'state_id' in fields"
class='css_editable_mode_hidden'>
<div itemprop="state_id" t-esc="object.state_id.name"
style="margin-bottom:4px;font-size:14px;"/>
</div>
</xpath>
</template>
然后要在QWEB报告中使用它,只需在state_id
属性中指定fields
字段即可。
<address t-field="o.partner_id" t-field-options="{"widget": "contact", "fields": ["address", "name", "state_id"], "no_marker": true}"/>
我使用div[2]/div[2]
在国家/地区之后添加state_id。
答案 1 :(得分:0)
我终于发现这是一个配置设置。默认情况下,Odoo不包括大多数国家/地区的state_id。这是在settings->localization->country
答案 2 :(得分:-1)
您可以传递t-field-options参数中的选项,如下所示。
<div t-field="o.partner_id"
t-fields-options='{"widgets": "contact", "fields": ["address", "name", "phone", "email"], "no_marker": true }'
/>
字段“地址”包含合作伙伴的整个地址,包括state_id 。