This question has been flagged
1 Reply
6319 Views

i'm using module recruitment of odoo v11 and i want to create a fixed columns in the kanban view for example when i create a new application i want it to be created under the column CV in progress automatically instead of been created under a column entitled "undefined" ? Any idea for help please ?

Avatar
Discard
Best Answer

Hello,

To make it, you need to define a default stage for all new application.


Here are some steps that could help you achieve it:

Step 1: Define a default stage in a xml data file

<?xml version="1.0" encoding="UTF-8"?>

<odoo>
    <data noupdate="1">
        <record model="hr.recruitment.stage" id="default_stage_job">
            <field name="name">My Default Stage</field>
            <field name="sequence">0</field>

        </record>
  </data>

</odoo>


Don't forget to import your xml data file in your module __manifest__.py file

Step 2: Override the default stage function in "hr.applicant" model


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('my_module_name.default_stage_job').id
		except Exception as e:
			pass
			
		return stage_id


Hope this will help you

Avatar
Discard
Author

Thanks for your answer, the stage "my default stage" is added automatically but i notice my new applicant is always created under state undefined