From 38f560b3e7529e967c546c2416c67bcb1130b277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Tue, 16 Dec 2025 15:42:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_base/__manifest__.py | 1 + yuthon_base/models/__init__.py | 1 + yuthon_base/models/yuthon_timed_tasks.py | 22 ++++++++++++++++ yuthon_base/security/ir.model.access.csv | 1 + yuthon_base/views/menu.xml | 2 +- .../views/yuthon_timed_tasks_views.xml | 25 +++++++++++++++++++ yuthon_notice/models/yuthon_notice.py | 2 +- 7 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 yuthon_base/models/yuthon_timed_tasks.py create mode 100644 yuthon_base/views/yuthon_timed_tasks_views.xml diff --git a/yuthon_base/__manifest__.py b/yuthon_base/__manifest__.py index 3a8ecbd2b..bc4e3f528 100644 --- a/yuthon_base/__manifest__.py +++ b/yuthon_base/__manifest__.py @@ -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': { diff --git a/yuthon_base/models/__init__.py b/yuthon_base/models/__init__.py index 024efa1ca..38ec55d94 100644 --- a/yuthon_base/models/__init__.py +++ b/yuthon_base/models/__init__.py @@ -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 \ No newline at end of file diff --git a/yuthon_base/models/yuthon_timed_tasks.py b/yuthon_base/models/yuthon_timed_tasks.py new file mode 100644 index 000000000..cca454b40 --- /dev/null +++ b/yuthon_base/models/yuthon_timed_tasks.py @@ -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="模型") \ No newline at end of file diff --git a/yuthon_base/security/ir.model.access.csv b/yuthon_base/security/ir.model.access.csv index 318f27c43..abc9f248e 100644 --- a/yuthon_base/security/ir.model.access.csv +++ b/yuthon_base/security/ir.model.access.csv @@ -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 diff --git a/yuthon_base/views/menu.xml b/yuthon_base/views/menu.xml index 319fe26c6..318b263f8 100644 --- a/yuthon_base/views/menu.xml +++ b/yuthon_base/views/menu.xml @@ -12,7 +12,7 @@ + + + yuthon.timed.tasks.tree + yuthon.timed.tasks + + + + + + + + + + + + + + + 定时任务管理 + yuthon.timed.tasks + tree + + + diff --git a/yuthon_notice/models/yuthon_notice.py b/yuthon_notice/models/yuthon_notice.py index 5c8637673..83d5da99e 100644 --- a/yuthon_notice/models/yuthon_notice.py +++ b/yuthon_notice/models/yuthon_notice.py @@ -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'})