添加功能
This commit is contained in:
@@ -95,13 +95,22 @@ class HrJob(models.Model):
|
||||
if department_id:
|
||||
job.sudo().write({'department_id': department_id.id if len(department_id) == 1 else department_id[0].id})
|
||||
|
||||
|
||||
@api.onchange('department_id')
|
||||
def onchange_department_id(self):
|
||||
company_mapping = {
|
||||
'天河投资集团':'thtz' , '天河物管': 'thwg', '天河粮储':'thlc', '集团本部': 'thtjbb'
|
||||
'天河投资集团': 'thtz',
|
||||
'天河物管': 'thwg',
|
||||
'天河粮储': 'thlc',
|
||||
'集团本部': 'thtjbb'
|
||||
}
|
||||
yuthon_company = company_mapping.get(self.department_id.parent_id.name)
|
||||
department = self.department_id
|
||||
yuthon_company = company_mapping.get(department.name) # 先检查自身
|
||||
if not yuthon_company:
|
||||
while department.parent_id:
|
||||
department = department.parent_id
|
||||
yuthon_company = company_mapping.get(department.name)
|
||||
if yuthon_company:
|
||||
break
|
||||
self.yuthon_company = yuthon_company
|
||||
|
||||
class HrJobType(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user