Help

2

Issue in showing kanban image in odoo 11

Avatar
sibi0229

Python Code:
        class Test(models.Model):

       _name = "test.test"_name = "test.test" 

        image = fields.Binary(attachment=True)

XML Code:
                <record id = "test_id" model = "ir.ui.view">

                        <field name = "name">Test Image</field>

                        <field name = "model">test.test</field>

                        <field name = "arch" type = "xml">

                        <kanban>

                                    <field name="image" />

                        <templates>

                                <t t-name="kanban-box">

                                <div class="oe_resource_vignette">

                                <div class="oe_resource_image">

                                        <img t-att-src="kanban_image('test.test','image',record.id.raw_value)" class="oe_resource_picture"/>

                              </div>

                            </templates>

            </kanban>

            </field>

      </record>

            

Avatar
Discard
1 Answer
0
Avatar
Jignesh Mehta
Best Answer

Hello sibi0229,


Try below code :

<record id="test_kanban_view" model="ir.ui.view">

    <field name="name">test.test.kanban.view</field>

    <field name="model">test.test</field>

    <field name="arch" type="xml">

        <kanban class="o_kanban_small_column">

            <field name="image"/>

            <templates>

                <t t-name="kanban-box">

                    <div class="oe_kanban_content">

                        <div class="row">

                            <img t-att-src="kanban_image('test.test', 'image', record.id.value)" class="oe_kanban_picture" style="max-height: 90px; max-width: 60px;"/>

                        </div>

                    </div>

                </t>

            </templates>

        </kanban>

    </field>

</record>


Hope it will works for you.

Thanks,

Avatar
Discard