我正在创建一个自定义模块来修复默认阶段,它会自动创建,但是总是在创建新应用程序时在未定义阶段创建它,并且希望在我的默认阶段创建它。任何想法如何解决这个问题,请?这是我的代码
hr_recruitment_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>
</record>
</data>
</odoo>
hr_recruitment.py
# -*- coding: utf-8 -*-
from odoo import fields, api, models
class Applicant(models.Model):
_inherit = "hr.applicant"
def _default_stage_id(self):
# Search your stage
stage_id = self.env['hr.recruitment.stage'].search([('name', '=', 'CV in progress')], limit=1).id
if stage_id:
return stage_id
return super(Applicant, self)._default_stage_id()