Skip to Content
Menu
This question has been flagged
1 Reply
11958 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>



Avatar
Discard
Author Best Answer

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 :-)

Avatar
Discard
Related Posts Replies Views Activity
1
May 16
3977
0
Apr 16
2582
0
Feb 16
4175
3
Dec 23
20205
1
Jul 23
3249