73 lines
2.6 KiB
Python
73 lines
2.6 KiB
Python
from odoo import models, fields, api, exceptions, _
|
|
|
|
|
|
class YuthonAssessmentTasks(models.Model):
|
|
_name = 'yuthon.assessment.tasks'
|
|
_description = '考核任务总汇'
|
|
|
|
name = fields.Char(string='考核任务名称')
|
|
index_statu = fields.Selection([('work', '生效'), ('void', '作废')], string='状态')
|
|
performance_type = fields.Selection([('organize', '组织绩效'), ('employs', '员工绩效')], stroing='考核类型')
|
|
assessment_time = fields.Char(string='考核时间')
|
|
performance_id = fields.Many2one('yuthon.employee.performance', string='关联员工任务', ondelete='cascade')
|
|
organization_id = fields.Many2one('yuthon.duty.management', string='关联组织任务 ', ondelete='cascade')
|
|
assessment_ids = fields.One2many('yuthon.assessment.tasks.lines', 'assessment_id', string='考核任务明细')
|
|
|
|
def button_appraisals_ids(self):
|
|
if self.performance_type == 'organize':
|
|
res_model = 'yuthon.duty.management'
|
|
id = self.organization_id.id #
|
|
else:
|
|
res_model = 'yuthon.employee.performance'
|
|
id = self.performance_id.id #
|
|
self.ensure_one()
|
|
return {
|
|
'type': 'ir.actions.act_window',
|
|
'res_model': res_model,
|
|
'res_id': id,
|
|
'view_mode': 'form',
|
|
'target': 'current',
|
|
}
|
|
|
|
def button_appraisal_ids(self):
|
|
return {
|
|
'type': 'ir.actions.act_window',
|
|
'res_model': 'yuthon.assessment.tasks.wizard',
|
|
'view_mode': 'form',
|
|
'target': 'new',
|
|
"context": {
|
|
'default_name': self.name,
|
|
'default_assessment_ids': [(6, 0, self.assessment_ids.ids)]
|
|
}
|
|
}
|
|
|
|
def button_clone_task(self):
|
|
pass
|
|
|
|
def button_calculate_score(self):
|
|
pass
|
|
|
|
def pub_alert_people(self):
|
|
pass
|
|
|
|
def unlink(self):
|
|
return super().unlink()
|
|
|
|
|
|
|
|
class YuthonAssessmentTasksLines(models.Model):
|
|
_name = 'yuthon.assessment.tasks.lines'
|
|
|
|
_description = '考核明细行'
|
|
|
|
name = fields.Char(string='名称')
|
|
assessment_id = fields.Many2one('yuthon.assessment.tasks', string='关联考核任务总汇')
|
|
tasks_wizard_id = fields.Many2one('yuthon.assessment.tasks.wizard', string='任务详情弹窗')
|
|
examiners = fields.Many2one('hr.employee',string='考核人员')
|
|
be_examiners = fields.Many2one('hr.employee',string='被考核人员')
|
|
assessment_status = fields.Selection([('assessment', '已考核'), ('no_assessment', '未考核')], string='考核状态')
|
|
|
|
|
|
def put_retake_the_exam(self):
|
|
pass
|