viewodooodoo-14kanban

ODOO Aplicant kanban view add text under stage name


I am trying to add a text or field name under the stage name in the Applicant kanban view. please refer the below image for the reference. I want to add a text where i marked in red line. enter image description here from the user interface i am trying edit the kanban view , I created new view in the Inherited Views,

<?xml version="1.0"?>
<xpath expr="//span[@class='o_column_title']" position="after">
    <field name="display_name"></field>
</xpath>

But I am getting this error

Error while validating view:

Element '<xpath expr="//span[@class='o_column_title']">' cannot be located in parent view

View name: my_kanban_view
Error context:
 view: ir.ui.view(662,)
 view.model: hr.applicant
 view.parent: ir.ui.view(566,)

Can you please guide me to achieve this? I will be very useful for me. Thanks in advance.


Solution

  • The element you try to locate is part of the KanbanView.Group template which is rendered in the kanban column.

    You need to inherit that template to add an element just after the title.

    <?xml version="1.0" encoding="UTF-8"?>
    <templates>
        <t t-inherit="web.KanbanView.Group" t-inherit-mode="primary">
            <xpath expr="//div[hasclass('o_kanban_header_title')]" position="after">
               
            </xpath>
        </t>
    </templates>
    

    You can check the kanban column js file to see the available variables defined in the column widget. Records are grouped in each column and available in the data_records object (widget.data_records).
    You will need to select a record before you try to access the field value.