添加功能

This commit is contained in:
李鹏宇
2025-12-16 15:42:34 +08:00
parent 81c2ad21d9
commit 38f560b3e7
7 changed files with 52 additions and 2 deletions
+1
View File
@@ -10,6 +10,7 @@
'security/ir.model.access.csv',
'views/system_version_views.xml',
'views/ir_cron_act_views.xml',
'views/yuthon_timed_tasks_views.xml',
'views/menu.xml',
],
'assets': {
+1
View File
@@ -3,4 +3,5 @@ from . import inherit_ir_attachment
from . import system_version
from . import fields_piyin
from . import ir_cron_act
from . import yuthon_timed_tasks
# from . import res_partner
+22
View File
@@ -0,0 +1,22 @@
from odoo import models, fields, api
class YuthonTimedTasks(models.Model):
_name = 'yuthon.timed.tasks'
_description = '定时任务'
sequence = fields.Integer(string='序号')
name = fields.Char(string='名称')
notice_type = fields.Selection([('attendance', '出勤'), ('schedule', '日程'), ('announcement', '公告'),
('attendance_confirmation', '考勤确认单'), ('salary_slip', '薪资条'),
('process', '流程'), ('other', '其他')], string='类型')
active = fields.Boolean(string='有效', default=True)
runtime = fields.Datetime(string="运行时间")
interval_number = fields.Integer(string='间隔')
interval_type = fields.Selection([('minutes', '分钟'),
('hours', '小时'),
('days', '天'),
('weeks', '周'),
('months', '月')], string='运行周期', default='months')
model_id = fields.Many2one("ir.model", string="模型")
+1
View File
@@ -1,3 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_system_version,system_version,model_system_version,base.group_system,1,1,1,1
access_ir_cron_type,ir.cron.type,model_ir_cron_type,base.group_system,1,1,1,1
access_yuthon_timed_tasks,yuthon.timed.tasks,model_yuthon_timed_tasks,base.group_system,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_system_version system_version model_system_version base.group_system 1 1 1 1
3 access_ir_cron_type ir.cron.type model_ir_cron_type base.group_system 1 1 1 1
4 access_yuthon_timed_tasks yuthon.timed.tasks model_yuthon_timed_tasks base.group_system 1 1 1 1
+1 -1
View File
@@ -12,7 +12,7 @@
<menuitem id="timed_tasks_menu_root"
name="定时任务"
parent="system_version_menu_root_board"
action="base.ir_cron_act"
action="yuthon_base.view_yuthon_timed_tasks_action"
sequence="5"/>
<menuitem id="cron_type_menu_root"
name="配置"
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_yuthon_timed_tasks_tree" model="ir.ui.view">
<field name="name">yuthon.timed.tasks.tree</field>
<field name="model">yuthon.timed.tasks</field>
<field name="arch" type="xml">
<tree string="定时任务管理" editable="bottom">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="notice_type"/>
<field name="model_id"/>
<field name="runtime"/>
<field name="interval_number"/>
<field name="interval_type"/>
<field name="active"/>
</tree>
</field>
</record>
<record id="view_yuthon_timed_tasks_action" model="ir.actions.act_window">
<field name="name">定时任务管理</field>
<field name="res_model">yuthon.timed.tasks</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_yuthon_timed_tasks_tree"/>
</record>
</odoo>
+1 -1
View File
@@ -157,7 +157,7 @@ class YuthonNotice(models.Model):
'state': 'no',
})
we_id = self.env['hr.employee'].search([('id', '=', user_id.employee_ids.id)]).wecom_userid
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='notice', user_id=we_id, title="通知公告",
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='notice', user_id='18562027762', title="通知公告",
description=self.name + '发布人:' + self.users_id.name,
url=url, btntxt="详细信息")
self.write({"notice_state": 'yes'})