Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to inherit from a kanban view in Odoo9

By
Dominic
on 5/25/16, 11:15 AM 381 views

Hello, 

I checked google and this forum but did not find the right answer for odoo9. I have a kanban view that I would like to modify in in a inherited way. But my changes do not show up nowhere and I have no clue why. This is my approach that fails:

<record id="view_kanban_res_partner_inherited" model="ir.ui.view"> 
<field name="inherit_id" ref="base.res_partner_kanban_view" />
<field name="model">res.partner</field>
<field name="arch" type="xml">

<!-- my changes here do not show up :-( -->

</record>


the change it would like to realize in the partner kanban view is the following: There is an existing div "oe_kanban_details" where I would like to add/modify this bold lines:


<div class="oe_kanban_details">
<strong class="oe_partner_heading"><field name="display_name"/></strong>
<div t-if="!record.xidentification.raw_value" style="margin: 0px; padding:3px 3px 10px 3px; color:#F77171; background-color: #FFF3F3;">
<b>Dates not complete!</b></div>
<div class="oe_kanban_partner_links"/>
</div>



0
Dominic
On 5/25/16, 12:24 PM

Alright, after seeing this blog post https://odedrabhavesh.blogspot.com.co/2015/01/how-to-replace-kanban-image-in-odoo.html I got the solution. Although this example from the blog post works for Odoo8:


Code: 

<record model="ir.ui.view" id="res_partner_kanban_view_extened">
<field name="name">res.partner.kanban.view.extened</field>
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<xpath expr='//kanban/templates/t/div/a/t/t[@t-if="record.is_company.raw_value === true"]' position="replace">
<!-- check condition weather IS A COMPANY is checked or not -->
<t t-if="record.is_company.raw_value === true">
<img src="custom_patht_of_image" class="oe_kanban_image"/>
</t>
</xpath>
</field>
</record>


I had to modify it as Odoo v9 no more supports named attributes of Xpath (like @class='page', etc.).

So this was my solution, working with Indexes instead:

<record model="ir.ui.view" id="res_partner_kanban_view_extened">
<field name="name">res.partner.kanban.view.extened</field>
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<xpath expr='//kanban/templates/t/div/div[3]/ul' position="before">
<field name="myvar" />
<div t-if="!record.myvar.raw_value"
style="margin: 0px; padding:3px 3px 10px 3px; color:#F77171; background-color: #FFF3F3;">
</div>
</xpath>
</field>
</record>


Hope this helps someone :-)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/25/16, 11:15 AM
Seen: 381 times
Last updated: 5/25/16, 3:26 PM