Reputation: 2842
I have extended the CRM kanban view via a custom module to display a button on kanban box.
The issue was getting undefined value in the rendered href link instead of the field value.
My custom view code :
<odoo>
<record id="view_crm_lead_kanban_inherit" model="ir.ui.view">
<field name="name">crm.lead.kanban.inherit</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_kanban_view_leads"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('o_kanban_record_subtitle')]" position="after">
<div class="o_kanban_record_action">
<a name="btn_whatsapp" class="btn btn-sm btn-secondary o_kanban_button_custom"
t-attf-href="{{'https://wa.me/'+record.whatsapp.raw_value+'?text=Hello'}}" t-attf-target="_blank">
Whatsapp
</a>
</div>
</xpath>
</field>
</record>
</odoo>
Upvotes: 1
Views: 23
Reputation: 2842
After a few hours of struggle, I found out that the field's data is fetched if its field tag is inside the record tag.
Finally problem solved by adding the following tag after the <xpath>
tag :
<xpath expr="//div[hasclass('o_kanban_record_subtitle')]" position="after">
<field name="whatsapp" invisible="1"/>
Upvotes: 1