This question has been flagged
3 Replies
8795 Views

i'm using odoo 11 and i want to fix the stages in the kanban view of the the model "hr.applicant". At this time , i develop a custom module and i'm able to fix one stage but i want to define all the stage of the recruitment process automatically. Any idea for help please ?

recruitement.py

class Applicant(models.Model):
    _inherit = 'hr.applicant'

    def _get_default_stage_id(self):
        stage_id = super(Applicant, self)._get_default_stage_id()
        try:
            stage_id = self.env.ref('sifast_default_stage_recruitement.default_stage_job').id
        except Exception as e:
            pass

        return stage_id

recruitement_view.xml

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
    <record model="hr.recruitment.stage" id="default_stage_job">
        <field name="name">CV in progress</field>
        <field name="sequence">0</field>
        <field name="name">Technical Test</field>
        <field name="sequence">1</field>

    </record>
</data>
</odoo>


Avatar
Discard
Best Answer

Inherit the view you want to add the stages feature to and add this code in a new module 
for example here is the orders in your module who are inherited from the sales module

<odoo>
<data>

<record id="example_order_kanban_inherit" model="ir.ui.view">
<field name="name">example.order.kanban.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_sale_order_kanban"/>
<field name="arch" type="xml">
<xpath expr="//kanban" position="attributes">
<attribute name="default_group_by">state</attribute>
</xpath>
</field>
</record>

</data>
</odoo>


change the "state" field to the field you want to group them by.
It can be a One2many or a Selection field

Avatar
Discard
Best Answer

Hello,

You can define in your kanban view like this 

<kanban default_group_by="stage_id" class="o_kanban_small_column o_kanban_project_tasks" on_create="quick_create" quick_create_view="project.quick_create_task_form" examples="project">

maybe it's works for you.

Thanks

Avatar
Discard
Best Answer

Hi Dhouha: 

The Stages can be configured without writing any code by going to Recruitment > Configuration > Stages after activating Developer mode. 

Avatar
Discard