我想知道是否可以在Odoo的看板视图中显示One2many字段(请注意,我不是在模板或报告中讨论Qweb,而是在看板视图中仅讨论Qweb)。
我有一个名为other_contact_ids
的One2many字段的模型。我想在看板视图中显示每个联系人的姓名:
<t t-foreach="record.other_contact_ids.raw_value" t-as="contact">
<p>
<t t-esc="contact.name"/>
</p>
</t>
我收到一个错误,因为t-as
只存储contact
中对象的ID而不是将整个对象与其字段一起存储。
而且我认为可能这个问题与我之前做过的另一个问题有很大关系:How to use the dot notation in a kanban view in Odoo?
当然,我已经尝试了很多方法,例如不使用raw_value。然后它显示了标记字段的属性列表,如required
,invisible
,depends
,value
,raw_value
等...
我在看板上寻找其他T-foreach,目前我没有找到任何东西,所以我开始认为这是不可能的。我对吗?
是的,使用web_one2many_kanban module可用于V7,V8和V9的应用程序。感谢Serpent Consulting
如果您转到客户视图,则会出现一个名为contacts的选项卡。实际上,合作伙伴模型本身就是一个人。它认为这会有所帮助。
如果是图像
rooms = fields.One2many('block.rooms', 'block_id')
<t t-foreach="record.rooms.raw_value" t-as="room">
<img t-att-src="kanban_image('block.room', 'image_field_name', room)" t-att-data-member_id="room"/>
</t>