0

I'm working on the HR Recruiter module, Here I'm creating a stage column inside the specific job position, but the stage column is displayed in all other job positions also, but we can choose the job-specific by editing the stage. Here I want to save the job position along with stage creation, by default it should take the current job position when I am creating the stage. enter image description here

Can you please help me to achieve this via code? it will very help full for me, thanks in advance.

Ajay Kumar
  • 1,595
  • 3
  • 20
  • 36

1 Answers1

0

I tried something like this,

took current active_id (job position id) from the context

class StageInherit(models.Model):
    _inherit = 'hr.recruitment.stage'

    @api.model
    def create(self, vals_list):
        stage = super(StageInherit, self).create(vals_list)
        current_job_id = self._context.get('active_id')
        stage.write({'job_ids': [(4, current_job_id)]})
        return stage

So it creats a stage column along with job_ids

Ajay Kumar
  • 1,595
  • 3
  • 20
  • 36