diff --git a/yuthon_hr_employee/models/yuthon_hr_task.py b/yuthon_hr_employee/models/yuthon_hr_task.py new file mode 100644 index 000000000..225a9663d --- /dev/null +++ b/yuthon_hr_employee/models/yuthon_hr_task.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +from odoo import api, fields, models + + +class YuthonHrTask(models.Model): + _name = 'yuthon.hr.task' + _description = '定时任务配置' + + name = fields.Char(string='名称') + cron_id = fields.Many2one(comodel_name='ir.cron', string='任务') + users_role_id = fields.Many2one(comodel_name='soong.user.role', string='角色') + users_role_group_ids = fields.Many2many(comodel_name='soong.user.role.group', string='角色组') + user_ids = fields.Many2many(comodel_name='res.users', string='人员') + + def action_view_task_confirm(self): + return { + 'type': 'ir.actions.act_window', + 'name': '任务确认记录', + 'res_model': 'yuthon.task.confirm', + 'view_mode': 'tree,form', + 'domain': [('task_id', '=', self.id)], + 'context': {'default_task_id': self.id}, + 'target': 'current', + } + + +class YuthonTaskConfirm(models.Model): + _name = 'yuthon.task.confirm' + _description = '任务确认记录' + + task_id = fields.Many2one(comodel_name='yuthon.hr.task', string='任务', ondelete='cascade') + user_id = fields.Many2one(comodel_name='res.users', string='人员') + state = fields.Selection([('unread', '未阅'), ('read', '已阅')], string='状态', default='unread') + msg_id = fields.Char(string='消息ID') + + def action_view_detail(self): + return { + 'type': 'ir.actions.act_window', + 'res_model': 'yuthon.task.confirm', + 'view_mode': 'form', + 'res_id': self.id, + 'target': 'current', + } diff --git a/yuthon_hr_employee/views/yuthon_hr_task_views.xml b/yuthon_hr_employee/views/yuthon_hr_task_views.xml new file mode 100644 index 000000000..c0f79d98e --- /dev/null +++ b/yuthon_hr_employee/views/yuthon_hr_task_views.xml @@ -0,0 +1,63 @@ + + + + yuthon.hr.task.tree + yuthon.hr.task + + + + + + +