Is it possible to show an One2many field in a kanban view in Odoo?

╄→гoц情女王★ 提交于 2019-12-11 02:02:03

问题


I would like to know if it's possible to show a One2many field in a kanban view in Odoo (note that I'm not talking about Qweb in templates or reports, only about Qweb in kanban views).

I have a model which has a One2many field named other_contact_ids. I want to show the name of each contact in the kanban view:

<t t-foreach="record.other_contact_ids.raw_value" t-as="contact">
   <p>
      <t t-esc="contact.name"/>
   </p>
</t>

I'm getting an error, because the t-as is storing only the ID of the objects in contact instead of storing the whole object with its fields.

And I think that may be this problem is much related to another question I did earlier: How to use the dot notation in a kanban view in Odoo?

Of course I've tried a lot of ways, for example without using raw_value. And then it shows me the list of attributes of the tag field, like required, invisible, depends, value, raw_value, etc...

I've looked for other t-foreach in kanban and for the moment I didn't find anything, so I'm starting to think that it's not possible. Am I right?


回答1:


Yes, with web_one2many_kanban module is available in apps for V7, V8 and V9. Thanks to Serpent Consulting




回答2:


If you go to customer view, then there is a tab called contacts. It is actually a one2many to partner model itself. It think it will be helpful.




回答3:


If it is an image

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>


来源:https://stackoverflow.com/questions/30805475/is-it-possible-to-show-an-one2many-field-in-a-kanban-view-in-odoo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!