This question has been flagged
4 Replies
10429 Views

I refer to Kanban views whereby I has 2 models

- Stage

- Registration

Stages has One2Many Registrations. 

Registration has Many2One Stage .


and in my kanban view, I can only add Registration, but I cannot add a column (a new Stage)


        <!-- Kanban View -->
<record model="ir.ui.view" id="warranty_registration_kanban_view">
<field name="name">warranty.registration.kanban</field>
<field name="model">warranty.registration</field>
<field name="arch" type="xml">
<kanban default_group_by="stage_id">
<field name="color"/>
<templates>
<t t-name="kanban-box">
<div
t-attf-class="oe_kanban_color_{{kanban_getcolor(record.color.raw_value)}}
oe_semantic_html_override
oe_kanban_card {{record.group_fancy==1 ? 'oe_kanban_card_fancy' : ''}}">
<div class="oe_dropdown_kanban">
<!-- dropdown menu -->
<div class="oe_dropdown_toggle">
<span class="oe_e">#</span>
<ul class="oe_dropdown_menu">
<li>
<a type="delete">Delete</a>
</li>
<li>
<ul class="oe_kanban_colorpicker"
data-field="color"/>
</li>
</ul>
</div>
<div class="oe_clear"></div>
</div>
<div t-attf-class="oe_kanban_content">
<!-- title -->
Start date:
<field name="start_date"/>
<br/>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>


What I want to achieve is like the hr_recruitment  or Notes module,  where I can create stage in the kanban view using the column option

Avatar
Discard
Author Best Answer

The answer is so simple, which I would never thought  of.

In the Kanban view xml, the field used in  'default_group_by', need to be defined within the kanban.

<kanban default_group_by="stage_id">
<field name="stage_id"/>
<field name="project">
    <field name="project_client"/>
    <field name="project_mode"/> 
    <field name="credit"/>
    <field name="state"/>
    <templates>




Avatar
Discard
Best Answer

Here is an example, you can learn from it .


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

<field name="name">Test Kanban</field>

<field name="model">test.project</field>

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

<kanban>

<field name="project"/>

<field name="project_client"/>

<field name="project_mode"/> 

<field name="credit"/>

<field name="state"/>

<templates>

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

<div class="oe_kanban_vignette oe_semantic_html_override">

<a type="open"><img t-att-src="kanban_image('product.product', 'image_small', record.id.value)" class="oe_kanban_image"/></a>

<div class="oe_kanban_details">

<h4>

<a type="open">

<field name="project"/>

</a>

<div name="client"/>

<ul>

<li>Project Owner:<field name="project_client"></field></li>

</ul>

</h4>

<div name="services"/>

<ul>

<li>Services:<field name="service_ids"></field></li>

</ul>

<div name="credits"/>

<ul>

<li>Credits:<field name="credit_ids"></field></li>

</ul>

</div>

</div>

</t>

</templates>

</kanban>

</field>

</record>

It works in my session perfectly.

Here is a usefull link for you:

https://www.odoo.com/fr_FR/forum/help-1/question/can-we-create-a-kunban-view-for-a-custom-module-17393


Avatar
Discard

Note that service_ids and credit_ids are one2many fields :)

Author

I think u mis read my question. If you ever install the notes module. in the kanban view of your notes, you can add a column group , or stages. My kanban view works except, I'm not seeing the column option to add a stage.