添加功能
This commit is contained in:
@@ -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',
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="view_yuthon_hr_task_tree" model="ir.ui.view">
|
||||
<field name="name">yuthon.hr.task.tree</field>
|
||||
<field name="model">yuthon.hr.task</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="cron_id"/>
|
||||
<field name="users_role_id"/>
|
||||
<field name="users_role_group_ids" widget="many2many_tags"/>
|
||||
<field name="user_ids" widget="many2many_tags"/>
|
||||
<button name="action_view_task_confirm" type="object" string="详情" class="btn-primary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_yuthon_hr_task" model="ir.actions.act_window">
|
||||
<field name="name">定时任务配置</field>
|
||||
<field name="res_model">yuthon.hr.task</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
|
||||
<record id="view_yuthon_task_confirm_tree" model="ir.ui.view">
|
||||
<field name="name">yuthon.task.confirm.tree</field>
|
||||
<field name="model">yuthon.task.confirm</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="task_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_yuthon_task_confirm_form" model="ir.ui.view">
|
||||
<field name="name">yuthon.task.confirm.form</field>
|
||||
<field name="model">yuthon.task.confirm</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="task_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="state"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_yuthon_task_confirm" model="ir.actions.act_window">
|
||||
<field name="name">任务确认记录</field>
|
||||
<field name="res_model">yuthon.task.confirm</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="menu_yuthon_hr_task"
|
||||
name="定时任务配置"
|
||||
action="action_yuthon_hr_task"
|
||||
parent="hr.menu_config_employee"
|
||||
sequence="20"/>
|
||||
</odoo>
|
||||
@@ -0,0 +1,43 @@
|
||||
# -*- 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',
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<!-- yuthon.property.task tree(无 form,详情跳 yuthon.property.task.confirm) -->
|
||||
<record id="view_yuthon_property_task_tree" model="ir.ui.view">
|
||||
<field name="name">yuthon.property.task.tree</field>
|
||||
<field name="model">yuthon.property.task</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="cron_id"/>
|
||||
<field name="users_role_id"/>
|
||||
<field name="users_role_group_ids" widget="many2many_tags"/>
|
||||
<field name="user_ids" widget="many2many_tags"/>
|
||||
<button name="action_view_task_confirm" type="object" string="详情" class="btn-primary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_yuthon_property_task" model="ir.actions.act_window">
|
||||
<field name="name">物业定时任务配置</field>
|
||||
<field name="res_model">yuthon.property.task</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
|
||||
<!-- yuthon.property.task.confirm tree + form -->
|
||||
<record id="view_yuthon_property_task_confirm_tree" model="ir.ui.view">
|
||||
<field name="name">yuthon.property.task.confirm.tree</field>
|
||||
<field name="model">yuthon.property.task.confirm</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="task_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="state"/>
|
||||
<button name="action_view_detail" type="object" string="详情" class="btn-primary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_yuthon_property_task_confirm_form" model="ir.ui.view">
|
||||
<field name="name">yuthon.property.task.confirm.form</field>
|
||||
<field name="model">yuthon.property.task.confirm</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="task_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="state"/>
|
||||
<field name="msg_id"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_yuthon_property_task_confirm" model="ir.actions.act_window">
|
||||
<field name="name">物业任务确认记录</field>
|
||||
<field name="res_model">yuthon.property.task.confirm</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="menu_yuthon_property_task"
|
||||
name="物业定时任务配置"
|
||||
action="action_yuthon_property_task"
|
||||
parent="yuthon_property.resource_mgmt_config_menu"
|
||||
sequence="100"/>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user