Mostafa Mostafa - 1 year ago 349
Python Question

How to access one2many fields values on Kanban view odoo 0.8?

I need to loop over the records of o2m filed in kanban to show what I need from the other model.

all i need in kanban view to do this

<t t-foreach="o2m_field" t-as"record">
<t t-esc=""/>

Is that possible to do it?

Answer Source

Yes you can.

This question is a duplicate to Is it possible to show an One2many field in a kanban view in Odoo? but here is a link to a module from Serpent Consulting which will be able to do what you are looking for.

Here is a little more info.

    <field name="one2manyFieldname"/>
        <t t-name="kanban-box">
            <div class="oe_kanban_content">
                   <t t-foreach="record.one2manyFieldname.raw_value" t-as='o'>
                       <t t-esc=""/><br/>

The important part is before the template tag you have to pass through your one2many field so it is available within your template. Then you must access the record's "raw_value" and give it an alias. Like this.

 <t t-foreach="record.attendee_ids.raw_value" t-as='o'>

Then you can access the properties of the record.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download