新增消息提醒模版

This commit is contained in:
jinling.yang
2024-09-12 17:06:16 +08:00
parent 35c8b9316e
commit 22864b9669
7 changed files with 171 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class SfMessageTemplate(models.Model):
_name = "sf.message.template"
_description = u'消息模板'
name = fields.Char(string=u"名称", required=True)
type = fields.Selection([
('待接单', '待接单'),
('待排程', '待排程'),
('坯料采购', '坯料采购'),
('坯料发料', '坯料发料'),
('待编程', '待编程'),
('调拨入库', '调拨入库'),
('功能刀具组装', '功能刀具组装'),
('功能刀具寿命到期', '功能刀具寿命到期'),
('程序用刀计划异常', '程序用刀计划异常'),
('工单无CNC程序', '工单无CNC程序'),
('生产线无功能刀具', '生产线无功能刀具'),
('工单无定位数据', '工单无定位数据'),
('工单FTP无文件', '工单FTP无文件'),
('工单加工失败', '工单加工失败'),
('设备故障及异常', '设备故障及异常'),
('工单逾期预警', '工单逾期预警'),
('工单已逾期', '工单已逾期'),
('销售订单逾期', '销售订单逾期'),
('销售订单已逾期', '销售订单已逾期'),
('待质量判定', '待质量判定'),
('生产完工待入库', '生产完工待入库'),
('订单发货', '订单发货')
], string='类型', required=True)
description = fields.Char(string=u"描述")
content = fields.Html(string=u"内容", required=True, translate=True)
msgtype = fields.Selection(
[('text', u'文字'), ('markdown', u'Markdown')], u'消息类型',
required=True, default='markdown')
notification_department_id = fields.Many2one('hr.department', u'通知部门', required=True)
notification_employee_ids = fields.Many2many('hr.employee', string=u'员工',
domain="[('department_id', '=',notification_department_id)]",
required=True)
active = fields.Boolean(string=u"是否有效", default=True)
@api.onchange('notification_department_id')
def _clear_employee_ids(self):
if self.notification_department_id:
self.notification_employee_ids = False