Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
6960 Lượt xem

Hello;


Im having problems with the kanban view, i want to make it fully clickable like the odoo default ones, this is my code, the closer i got is making image and content clickable but its not quite the same.


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

    <field name="name">articulo.kanban</field>

    <field name="model">articulo</field>

    <field name="type">kanban</field>

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

       <kanban >

          <templates>

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

                     <div class="oe_resource_vignette">

                         <a type="edit"><div class="oe_resource_image">

                                                             <img t-att-src="kanban_image('articulo', 'foto', record.id.value)" class="oe_resource_picture"/>

                                                    </div>

                                    <div class="oe_resource_details">

                                            <ul class="lista">

                                                   <li><b><field name="codigo"/></b></li>

                                                   <li><b><field name="tipo"/></b></li>

                                          </ul>

                                      </div></a>

                        </div>

                    </t>

         </templates>

     </kanban>

  </field>

</record>


I dont know if what im asking can be done. Thanks in advance.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

This code is helpful for you, right now check it,

<record model="ir.ui.view" id="My_kanban">
        <field name="name">Kanban</field>
        <field name="model">my.module</field>
        <field name="arch" type="xml">
            <kanban>
                <field name="name"/>
                <field name="code"/>
                <field name="lst_price"/>
                <templates>
                    <t t-name="kanban-box">
                        <div class="oe_kanban_vignette oe_semantic_html_override">
                            <a type="open"><img t-att-src="kanban_image('my.module', 'image_small', record.id.value)" class="oe_kanban_image"/></a>
                            <div class="oe_kanban_details">
                                <h4>
                                    <a type="open">
                                         <t t-if="record.code.raw_value">[<field name="code"/>]</t> <field name="name"/>
                                    </a>
                                </h4>
                                <div name="tags"/>
                                <ul>
                                    <li>Price: <field name="lst_price"></field></li>
                                </ul>
                            </div>
                        </div>
                    </t>
                </templates>
            </kanban>
        </field>
    </record>
Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Works exactly the same as "edit" just opens in read-only mode.

My real problem is , when i apply the <a type="edit"> or "open"  to  this div

  <div class="oe_resource_vignette"> it stops working, i can click the full kanban but it wont get me to the form view.

Thanks.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Try by replacing  <a type="edit"> by  <a type="open">

Ảnh đại diện
Huỷ bỏ