44 lines
1.6 KiB
Python
44 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class YuthonPropertyTask(models.Model):
|
|
_name = 'yuthon.property.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.property.task.confirm',
|
|
'view_mode': 'tree,form',
|
|
'domain': [('task_id', '=', self.id)],
|
|
'context': {'default_task_id': self.id},
|
|
'target': 'current',
|
|
}
|
|
|
|
|
|
class YuthonPropertyTaskConfirm(models.Model):
|
|
_name = 'yuthon.property.task.confirm'
|
|
_description = '物业任务确认记录'
|
|
|
|
task_id = fields.Many2one(comodel_name='yuthon.property.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.property.task.confirm',
|
|
'view_mode': 'form',
|
|
'res_id': self.id,
|
|
'target': 'current',
|
|
}
|