Accept Merge Request #183: (feature/企业微信审批接入 -> develop)
Merge Request: 同步模板功能接入 Created By: @马广威 Accepted By: @马广威 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/183
This commit is contained in:
@@ -5,5 +5,7 @@ from . import wxwork_approval_template_controls
|
|||||||
from . import wxwork_settings
|
from . import wxwork_settings
|
||||||
from . import wxwork_approval_template_summary
|
from . import wxwork_approval_template_summary
|
||||||
from . import we_approval_record
|
from . import we_approval_record
|
||||||
|
from . import wx_work_api
|
||||||
|
|
||||||
from . import wxwork_approval
|
from . import wxwork_approval
|
||||||
# from . import res_config_setting
|
# from . import res_config_setting
|
||||||
|
|||||||
@@ -19,6 +19,17 @@ class WxWorkAPI:
|
|||||||
else:
|
else:
|
||||||
raise Exception(f"获取AccessToken失败: {result}")
|
raise Exception(f"获取AccessToken失败: {result}")
|
||||||
|
|
||||||
|
def get_template_detail(self, template_data):
|
||||||
|
url = f"https://qyapi.weixin.qq.com/cgi-bin/oa/gettemplatedetail?access_token={self.access_token}"
|
||||||
|
headers = {'Content-Type': 'application/json'}
|
||||||
|
response = requests.post(url, json=template_data, headers=headers)
|
||||||
|
result = response.json()
|
||||||
|
if result['errcode'] == 0:
|
||||||
|
# print(result)
|
||||||
|
return result
|
||||||
|
else:
|
||||||
|
raise Exception(f"获取模板详情请求失败: {result}")
|
||||||
|
|
||||||
def create_approval_request(self, approval_data):
|
def create_approval_request(self, approval_data):
|
||||||
url = f"https://qyapi.weixin.qq.com/cgi-bin/oa/applyevent?access_token={self.access_token}"
|
url = f"https://qyapi.weixin.qq.com/cgi-bin/oa/applyevent?access_token={self.access_token}"
|
||||||
headers = {'Content-Type': 'application/json'}
|
headers = {'Content-Type': 'application/json'}
|
||||||
@@ -60,89 +71,89 @@ class WxWorkAPI:
|
|||||||
return result['media_id']
|
return result['media_id']
|
||||||
|
|
||||||
|
|
||||||
template_id_dict = {"test": "ZvmJBAt7U2iUju9JLePxfkfuN22meQMVTAHymA"}
|
# template_id_dict = {"test": "ZvmJBAt7U2iUju9JLePxfkfuN22meQMVTAHymA"}
|
||||||
creator_userid = "MaGuangWei"
|
# creator_userid = "MaGuangWei"
|
||||||
corid = 'wweaf7f1caab27a136'
|
# corid = 'wweaf7f1caab27a136'
|
||||||
secret = 'L6z-kjrUBOWfhBiLOmX_fNSY3jydDkLUNNWnemafn00'
|
# secret = 'L6z-kjrUBOWfhBiLOmX_fNSY3jydDkLUNNWnemafn00'
|
||||||
wx = WxWorkAPI(corid, secret)
|
# wx = WxWorkAPI(corid, secret)
|
||||||
media_id = wx.upload_temp_file()
|
# media_id = wx.upload_temp_file()
|
||||||
print(media_id)
|
# print(media_id)
|
||||||
# access = wx.get_access_token()
|
# # access = wx.get_access_token()
|
||||||
approval_datas = {
|
# approval_datas = {
|
||||||
"creator_userid": creator_userid,
|
# "creator_userid": creator_userid,
|
||||||
"template_id": template_id_dict['test'],
|
# "template_id": template_id_dict['test'],
|
||||||
"use_template_approver": 0,
|
# "use_template_approver": 0,
|
||||||
# "choose_department": 2,
|
# # "choose_department": 2,
|
||||||
"approver": [
|
# "approver": [
|
||||||
{
|
# {
|
||||||
"attr": 2,
|
# "attr": 2,
|
||||||
"userid": ["MaGuangWei", "YangJinLing"]
|
# "userid": ["MaGuangWei", "YangJinLing"]
|
||||||
},
|
# },
|
||||||
{
|
# {
|
||||||
"attr": 1,
|
# "attr": 1,
|
||||||
"userid": ["MaGuangWei"]
|
# "userid": ["MaGuangWei"]
|
||||||
}
|
# }
|
||||||
],
|
# ],
|
||||||
"notifyer": ["MaGuangWei", "PengYuBo"],
|
# "notifyer": ["MaGuangWei", "PengYuBo"],
|
||||||
# "notifyer": ["MaGuangWei"],
|
# # "notifyer": ["MaGuangWei"],
|
||||||
"notify_type": 1,
|
# "notify_type": 1,
|
||||||
"apply_data": {
|
# "apply_data": {
|
||||||
"contents": [
|
# "contents": [
|
||||||
# 申请事项
|
# # 申请事项
|
||||||
{
|
# {
|
||||||
"control": "Text",
|
# "control": "Text",
|
||||||
"id": "Text-1640339319582",
|
# "id": "Text-1640339319582",
|
||||||
"value": {
|
# "value": {
|
||||||
"text": "测试测试测试测试测试"
|
# "text": "测试测试测试测试测试"
|
||||||
}
|
# }
|
||||||
},
|
# },
|
||||||
# 申请内容
|
# # 申请内容
|
||||||
{
|
# {
|
||||||
"control": "Textarea",
|
# "control": "Textarea",
|
||||||
"id": "Textarea-1640339335659",
|
# "id": "Textarea-1640339335659",
|
||||||
"value": {
|
# "value": {
|
||||||
"text": "odoo>>>企业微信审批"
|
# "text": "odoo>>>企业微信审批"
|
||||||
}
|
# }
|
||||||
},
|
# },
|
||||||
# 附件
|
# # 附件
|
||||||
{
|
# {
|
||||||
"control": "File",
|
# "control": "File",
|
||||||
"id": "File-1640339381728",
|
# "id": "File-1640339381728",
|
||||||
"value": {
|
# "value": {
|
||||||
"files": [
|
# "files": [
|
||||||
{
|
# {
|
||||||
"file_id": media_id
|
# "file_id": media_id
|
||||||
}
|
# }
|
||||||
]
|
# ]
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
},
|
# },
|
||||||
|
#
|
||||||
]
|
# ]
|
||||||
},
|
# },
|
||||||
"summary_list": [
|
# "summary_list": [
|
||||||
{
|
|
||||||
"summary_info": [{
|
|
||||||
"text": "测试附件上传",
|
|
||||||
"lang": "zh_CN"
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
# {
|
# {
|
||||||
# "summary_info": [{
|
# "summary_info": [{
|
||||||
# "text": "摘要第2行",
|
# "text": "测试附件上传",
|
||||||
# "lang": "zh_CN"
|
# "lang": "zh_CN"
|
||||||
# }]
|
# }]
|
||||||
# },
|
# },
|
||||||
# {
|
# # {
|
||||||
# "summary_info": [{
|
# # "summary_info": [{
|
||||||
# "text": "摘要第3行",
|
# # "text": "摘要第2行",
|
||||||
# "lang": "zh_CN"
|
# # "lang": "zh_CN"
|
||||||
# }]
|
# # }]
|
||||||
|
# # },
|
||||||
|
# # {
|
||||||
|
# # "summary_info": [{
|
||||||
|
# # "text": "摘要第3行",
|
||||||
|
# # "lang": "zh_CN"
|
||||||
|
# # }]
|
||||||
|
# # }
|
||||||
|
# ]
|
||||||
# }
|
# }
|
||||||
]
|
# wx.create_approval_request(approval_datas)
|
||||||
}
|
# print('创建成功')
|
||||||
wx.create_approval_request(approval_datas)
|
|
||||||
print('创建成功')
|
|
||||||
|
|
||||||
aa = {"errcode": 0, "errmsg": "ok", "template_names": [{"text": "对接开发测试", "lang": "zh_CN"}], "template_content": {
|
aa = {"errcode": 0, "errmsg": "ok", "template_names": [{"text": "对接开发测试", "lang": "zh_CN"}], "template_content": {
|
||||||
"controls": [{"property": {"control": "Text", "id": "Text-1640339319582",
|
"controls": [{"property": {"control": "Text", "id": "Text-1640339319582",
|
||||||
|
|||||||
@@ -14,12 +14,15 @@ class WxWorkApprovalTemplate(models.Model):
|
|||||||
name = fields.Char(string='模板名称')
|
name = fields.Char(string='模板名称')
|
||||||
# content_ids = fields.Many2many('wxwork.approval.template.controls', string='模板内容')
|
# content_ids = fields.Many2many('wxwork.approval.template.controls', string='模板内容')
|
||||||
content_ids = fields.One2many('wxwork.approval.template.controls', 'template_id', string='模板内容')
|
content_ids = fields.One2many('wxwork.approval.template.controls', 'template_id', string='模板内容')
|
||||||
|
# 增加一个与wxwork.approval.vacation.config的关联字段
|
||||||
|
vacation_config_id = fields.One2many('wxwork.approval.vacation.config', 'template_id', string='控件配置')
|
||||||
|
|
||||||
company_id = fields.Many2one('res.company', '公司', default=lambda self: self.env.user.company_id.id)
|
company_id = fields.Many2one('res.company', '公司', default=lambda self: self.env.user.company_id.id)
|
||||||
creator_userid = fields.Many2one('res.users', '创建者', default=lambda self: self.env.user.id)
|
creator_userid = fields.Many2one('res.users', '创建者', default=lambda self: self.env.user.id)
|
||||||
use_template_approver = fields.Selection([
|
use_template_approver = fields.Selection([
|
||||||
('0', '自选审批人'),
|
('0', '自选审批人'),
|
||||||
('1', '预设审批人')
|
('1', '预设审批人')
|
||||||
], string='审批人模式', default='0')
|
], string='审批人模式', default='1')
|
||||||
choose_department = fields.Char(string='提单部门')
|
choose_department = fields.Char(string='提单部门')
|
||||||
approver = fields.One2many('wxwork.approval.approver_line', 'main_id', string='审批流程')
|
approver = fields.One2many('wxwork.approval.approver_line', 'main_id', string='审批流程')
|
||||||
notifyer = fields.Many2many('res.users', string='抄送人userid列表')
|
notifyer = fields.Many2many('res.users', string='抄送人userid列表')
|
||||||
|
|||||||
@@ -6,97 +6,196 @@ from odoo.exceptions import UserError
|
|||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
# 控件模型
|
||||||
class WxWorkApprovalTemplate(models.Model):
|
class WxWorkApprovalTemplate(models.Model):
|
||||||
_name = 'wxwork.approval.template.controls'
|
_name = 'wxwork.approval.template.controls'
|
||||||
_description = "企业微信审批模板控件"
|
_description = "企业微信审批模板控件"
|
||||||
|
|
||||||
|
template_id = fields.Many2one('wxwork.approval.template', string='模板')
|
||||||
|
property_id = fields.One2many('property.model', 'control_id', string='控件属性')
|
||||||
|
config_id = fields.One2many('config.model', 'control_id', string='控件配置')
|
||||||
|
|
||||||
|
|
||||||
|
# 控件属性模型
|
||||||
|
class PropertyModel(models.Model):
|
||||||
|
_name = 'property.model'
|
||||||
_rec_name = "title"
|
_rec_name = "title"
|
||||||
|
|
||||||
SELECTION_RELATION = {
|
CONTROL_TYPE_SELECTION = [
|
||||||
'申请事项': {'id': 'Text-1640339319582', 'control': 'Text', 'value': '{"text": "文本填写的内容"}'},
|
('Text', '文本'),
|
||||||
'申请内容': {'id': 'Textarea-1640339335659', 'control': 'Textarea', 'value': '{"text": "文本填写的内容"}'},
|
('Textarea', '多行文本'),
|
||||||
'多行文本': {'id': 'Textarea-1684823453770', 'control': 'Textarea', 'value': '{"text": "文本填写的内容"}'},
|
('Number', '数字'),
|
||||||
'金额': {'id': 'Money-1684823460232', 'control': 'Money', 'value': '{"new_money": "0"}'},
|
('Money', '金额'),
|
||||||
'部门': {'id': 'Contact-1684823477216', 'control': 'Contact',
|
('Date', '日期/日期+时间'),
|
||||||
'value': '{"departments":[{"openapi_id":"2","name":"销售部"},{"openapi_id":"3","name":"生产部"}]}'},
|
('Selector', '单选/多选'),
|
||||||
'成员': {'id': 'Contact-1684823465317', 'control': 'Contact',
|
('Contact', '成员/部门'),
|
||||||
'value': '{"members":[{"userid":"WuJunJie","name":"Jackie"},{"userid":"WangXiaoMing","name":"Tom"}]}'},
|
('Tips', '说明文字'),
|
||||||
'明细': {'id': 'Table-1684823492261', 'control': 'Table',
|
('File', '附件'),
|
||||||
'value': '{"children":[{"list":['
|
('Table', '明细'),
|
||||||
'{"control":"Text","id":"Text-15111111111","title":'
|
('Attendance', '假勤控件'),
|
||||||
'[{"text":"明细内文本控件","lang":"zh_CN"}],"value":{"text":"明细文本1"}},'
|
('Vacation', '请假控件'),
|
||||||
'{"control":"Money","id":"Text-15111111112","title":[{"text":"明细内金额控件","lang":"zh_CN"}],'
|
('Location', '位置'),
|
||||||
'"value":{"new_money":"700"}}]},'
|
('RelatedApproval', '关联审批单'),
|
||||||
'{"list":[{"control":"Text","id":"Text-15111111111",'
|
('Formula', '公式'),
|
||||||
'"title":[{"text":"明细内文本控件","lang":"zh_CN"}],"value":{"text":"明细文本2"}},'
|
('DateRange', '时长')
|
||||||
'{"control":"Money","id":"Text-15111111112","title":[{"text":"明细内金额控件","lang":"zh_CN"}],'
|
]
|
||||||
'"value":{"new_money":"900"}}]}]}'},
|
control_type = fields.Selection(CONTROL_TYPE_SELECTION, string='控件类型')
|
||||||
'关联申请单': {'id': 'RelatedApproval-1684823485883', 'control': 'RelatedApproval',
|
control_id = fields.Many2one('wxwork.approval.template.controls', string='控件')
|
||||||
'value': '{"related_approval":[{"sp_no":"202011180001"}]}'},
|
unique_control_id = fields.Char(string='控件ID')
|
||||||
'附件': {'id': 'File-1640339381728', 'control': 'File',
|
title = fields.Char(string='控件名称', translate=True)
|
||||||
'value': '{"files":[{"file_id":"1G6nrLmr5EC3MMb_-zK1dDdzmd0p7cNliYu9V5w7o8K1aaa"}]}'},
|
placeholder = fields.Char(string='控件说明', translate=True)
|
||||||
'数字': {'id': 'File-1640339381728', 'control': 'Number', 'value': '{"new_number": "700"}'},
|
require = fields.Boolean(string='是否必填')
|
||||||
'日期/日期+时间': {'id': 'File-1640339381728', 'control': 'Date',
|
un_print = fields.Boolean(string='是否参与打印')
|
||||||
'value': '{"date": {"type": "day","s_timestamp": "1569859200"}}'},
|
|
||||||
'单选/多选': {'id': 'File-1640339381728', 'control': 'Selector',
|
|
||||||
'value': '{"selector": '
|
|
||||||
'{"type": "multi","options": [{"key": "option-15111111111"},{"key": "option-15222222222"}]}}'
|
|
||||||
},
|
|
||||||
'说明文字': {'id': 'File-1640339381728', 'control': 'Tips'},
|
|
||||||
'位置': {'id': 'File-1640339381728', 'control': 'Location',
|
|
||||||
'value': '{"location":{"latitude":"30.547239","longitude":"104.063291",'
|
|
||||||
'"title":"腾讯科技(成都)有限公司(腾讯成都大厦)",'
|
|
||||||
'"address":"四川省成都市武侯区天府三街198号腾讯成都大厦A座","time":1605690460}}'},
|
|
||||||
'公式': {'id': 'File-1640339381728', 'control': 'Formula', 'value': '{"formula":{"value":"5.0"}}'},
|
|
||||||
'时长': {'id': 'File-1640339381728', 'control': 'DateRange',
|
|
||||||
'value': '{"date_range":{"new_begin":1570550400,"new_end":1570593600,"new_duration":86400}}'},
|
|
||||||
'请假组件': {'id': 'File-1640339381728', 'control': 'Vacation',
|
|
||||||
'value': '{"vacation":{"selector":{"type":"single","options":[{"key":"3",'
|
|
||||||
'"value":[{"text":"病假","lang":"zh_CN"}]}],"exp_type":0},'
|
|
||||||
'"attendance":{"date_range":{"type":"hour","new_begin":1568077200,'
|
|
||||||
'"new_end":1568368800,"new_duration":291600},"type":1}}}'},
|
|
||||||
'出差/外出/加班组件': {'id': 'File-1640339381728', 'control': 'Attendance',
|
|
||||||
'value': '{"attendance":{"date_range":{"type":"halfday","new_begin":1570550400,'
|
|
||||||
'"new_end":1570593600,"new_duration":86400},"type":4}}'},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
title = fields.Selection(
|
|
||||||
selection=[(key, key) for key in SELECTION_RELATION.keys()],
|
|
||||||
string='控件名称',
|
|
||||||
)
|
|
||||||
template_id = fields.Many2one('wxwork.approval.template', string='模板名称')
|
|
||||||
control_id = fields.Char(string='控件ID')
|
|
||||||
control = fields.Char(string='控件类型')
|
|
||||||
value = fields.Char(string='内容')
|
|
||||||
|
|
||||||
placeholder = fields.Char(string='占位符')
|
|
||||||
require = fields.Boolean(string='必填', compute='_compute_require')
|
|
||||||
un_print = fields.Boolean(string='不打印')
|
|
||||||
un_replace = fields.Boolean(string='不替换')
|
un_replace = fields.Boolean(string='不替换')
|
||||||
display = fields.Boolean(string='显示', compute='_compute_display')
|
display = fields.Boolean(string='显示')
|
||||||
|
child_control_id = fields.Many2one('wxwork.approval.table.config', string='明细子控件')
|
||||||
|
|
||||||
@api.onchange('title')
|
|
||||||
def _onchange_title(self):
|
|
||||||
if self.title:
|
|
||||||
related_values = WxWorkApprovalTemplate.SELECTION_RELATION[self.title]
|
|
||||||
self.control_id = related_values['id']
|
|
||||||
self.control = related_values['control']
|
|
||||||
|
|
||||||
# 特殊处理:对于"说明文字",将"value"设置为空字符串
|
# 控件配置模型
|
||||||
if self.control == 'Tips':
|
class ConfigModel(models.Model):
|
||||||
self.value = ''
|
_name = 'config.model'
|
||||||
else:
|
|
||||||
self.value = related_values['value']
|
|
||||||
|
|
||||||
@api.depends('title')
|
control_id = fields.Many2one('wxwork.approval.template.controls', string='控件')
|
||||||
def _compute_require(self):
|
# # 在此添加其他字段以存储不同控件类型的附加类型和属性
|
||||||
for record in self:
|
# date_type = fields.Selection([('day', '日期'), ('hour', '日期+时间')], string='日期类型')
|
||||||
record.require = record.title in ['申请事项', '申请内容']
|
#
|
||||||
|
# selector_type = fields.Selection([('single', '单选'), ('multi', '多选')], string='选择器类型')
|
||||||
|
# options = fields.One2many('config.option', 'config_id', string='选项')
|
||||||
|
#
|
||||||
|
# contact_type = fields.Selection(
|
||||||
|
# [('single', '单选'), ('multi', '多选')],
|
||||||
|
# string='联系人类型')
|
||||||
|
# contact_mode = fields.Selection(
|
||||||
|
# [('user', '成员'), ('department', '部门')],
|
||||||
|
# string='联系人模式')
|
||||||
|
#
|
||||||
|
# # table_children = fields.One2many('config.child', 'config_id', string='明细子控件')
|
||||||
|
# table_children = fields.One2many('property.model', 'child_control_id', string='明细子控件')
|
||||||
|
#
|
||||||
|
# attendance_type = fields.Selection([('1', '请假'), ('3', '出差'), ('4', '外出'), ('5', '加班')], string='假勤组件类型')
|
||||||
|
# attendance_date_range_type = fields.Selection([('hour', '分钟'), ('halfday', '上午/下午')], string='假勤时间刻度')
|
||||||
|
#
|
||||||
|
# vacation_list = fields.One2many('config.option', 'config_id', string='假期类型列表')
|
||||||
|
# 增加一个wxwork.approval.date.config的关联字段
|
||||||
|
date_type = fields.One2many('wxwork.approval.date.config', 'config_id', string='日期控件配置')
|
||||||
|
# 增加一个与wxwork.approval.selector.config的关联字段
|
||||||
|
selector_type = fields.One2many('wxwork.approval.selector.config', 'config_id', string='选择器控件配置')
|
||||||
|
# 增加一个与wxwork.approval.contact.config的关联字段
|
||||||
|
contact_type = fields.One2many('wxwork.approval.contact.config', 'config_id', string='联系人控件配置')
|
||||||
|
# 增加一个与wxwork.approval.table.config的关联字段
|
||||||
|
table_type = fields.One2many('wxwork.approval.table.config', 'config_id', string='明细控件配置')
|
||||||
|
# 增加一个与wxwork.approval.attendance.config的关联字段
|
||||||
|
attendance_type = fields.One2many('wxwork.approval.attendance.config', 'config_id', string='假勤控件配置')
|
||||||
|
# 增加一个与wxwork.approval.file.config的关联字段
|
||||||
|
file_type = fields.One2many('wxwork.approval.file.config', 'config_id', string='附件控件配置')
|
||||||
|
# 增加一个与wxwork.approval.table.config的Many2one关联字段
|
||||||
|
table_child = fields.Many2one('wxwork.approval.table.config', string='明细子控件配置')
|
||||||
|
|
||||||
@api.depends('title')
|
|
||||||
def _compute_display(self):
|
class ConfigOption(models.Model):
|
||||||
for record in self:
|
_name = 'config.option'
|
||||||
record.display = record.title in ['申请事项', '申请内容']
|
|
||||||
|
key = fields.Char(string='选项Key')
|
||||||
|
text = fields.Char(string='选项Text')
|
||||||
|
lang = fields.Char(string='语言')
|
||||||
|
config_id = fields.Many2one('config.model', string='配置')
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigChild(models.Model):
|
||||||
|
_name = 'config.child'
|
||||||
|
|
||||||
|
control = fields.Char(string='控件类型')
|
||||||
|
control_id = fields.Char(string='控件ID')
|
||||||
|
# 其他属性...
|
||||||
|
|
||||||
|
|
||||||
|
# Date控件config
|
||||||
|
class DateConfig(models.Model):
|
||||||
|
_name = 'wxwork.approval.date.config'
|
||||||
|
|
||||||
|
# 增加一个与config.model的关联字段
|
||||||
|
config_id = fields.Many2one('config.model', string='控件')
|
||||||
|
date_type = fields.Selection([('day', '日期'), ('hour', '日期+时间')], string='日期类型')
|
||||||
|
|
||||||
|
|
||||||
|
# Selector控件(单选/多选控件)config
|
||||||
|
class SelectorConfig(models.Model):
|
||||||
|
_name = 'wxwork.approval.selector.config'
|
||||||
|
|
||||||
|
# 增加一个与config.model的关联字段
|
||||||
|
config_id = fields.Many2one('config.model', string='控件')
|
||||||
|
selector_type = fields.Selection([('single', '单选'), ('multi', '多选')], string='选择器类型')
|
||||||
|
selector_exp_type = fields.Integer(string='选择器表达式类型', default=0)
|
||||||
|
options = fields.One2many('selector.option', 'config_id', string='选项')
|
||||||
|
|
||||||
|
|
||||||
|
# Selector控件(单选/多选控件)选项
|
||||||
|
class SelectorOption(models.Model):
|
||||||
|
_name = 'selector.option'
|
||||||
|
|
||||||
|
key = fields.Char(string='选项Key')
|
||||||
|
text = fields.Char(string='选项Text')
|
||||||
|
lang = fields.Char(string='语言')
|
||||||
|
config_id = fields.Many2one('wxwork.approval.selector.config', string='配置')
|
||||||
|
|
||||||
|
|
||||||
|
# Contact控件(成员/部门控件)config
|
||||||
|
class ContactConfig(models.Model):
|
||||||
|
_name = 'wxwork.approval.contact.config'
|
||||||
|
|
||||||
|
# 增加一个与config.model的关联字段
|
||||||
|
config_id = fields.Many2one('config.model', string='控件')
|
||||||
|
contact_type = fields.Selection([('single', '单选'), ('multi', '多选')], string='选择器类型')
|
||||||
|
contact_mode = fields.Selection([('user', '成员'), ('department', '部门')], string='联系人类型')
|
||||||
|
|
||||||
|
|
||||||
|
# Table控件(明细控件)config
|
||||||
|
class TableConfig(models.Model):
|
||||||
|
_name = 'wxwork.approval.table.config'
|
||||||
|
|
||||||
|
# 增加一个与config.model的关联字段
|
||||||
|
config_id = fields.Many2one('config.model', string='控件')
|
||||||
|
# table_children = fields.One2many('config.child', 'config_id', string='明细子控件')
|
||||||
|
table_children = fields.One2many('property.model', 'child_control_id', string='明细属性控件')
|
||||||
|
# 增加一个与config.model的One2many关联字段
|
||||||
|
table_children_config = fields.One2many('config.model', 'table_child', string='明细配置控件')
|
||||||
|
# stat_field = fields.Many2one('config.model', string='统计字段')
|
||||||
|
|
||||||
|
|
||||||
|
# Attendance控件(假勤控件)config
|
||||||
|
class AttendanceConfig(models.Model):
|
||||||
|
_name = 'wxwork.approval.attendance.config'
|
||||||
|
|
||||||
|
# 增加一个与config.model的关联字段
|
||||||
|
config_id = fields.Many2one('config.model', string='控件')
|
||||||
|
attendance_type = fields.Selection([('1', '请假'), ('3', '出差'), ('4', '外出'), ('5', '加班')], string='假勤组件类型')
|
||||||
|
attendance_date_range_type = fields.Selection([('hour', '分钟'), ('halfday', '上午/下午')], string='假勤时间刻度')
|
||||||
|
|
||||||
|
|
||||||
|
# Vacation控件(假勤控件)config
|
||||||
|
class VacationConfig(models.Model):
|
||||||
|
_name = 'wxwork.approval.vacation.config'
|
||||||
|
|
||||||
|
# 增加一个与wxwork.approval.template的关联字段
|
||||||
|
template_id = fields.Many2one('wxwork.approval.template', string='模板')
|
||||||
|
# control_id = fields.Many2one('wxwork.approval.template.controls', string='控件')
|
||||||
|
# vacation_list = fields.One2many('config.option', 'config_id', string='假期类型列表')
|
||||||
|
vacation_id = fields.Integer(string='假期ID')
|
||||||
|
name = fields.Char(string='假期名称')
|
||||||
|
lang = fields.Char(string='语言')
|
||||||
|
|
||||||
|
# file控件(文件控件)config
|
||||||
|
class FileConfig(models.Model):
|
||||||
|
_name = 'wxwork.approval.file.config'
|
||||||
|
|
||||||
|
# 增加一个与config.model的关联字段
|
||||||
|
config_id = fields.Many2one('config.model', string='控件')
|
||||||
|
# control_id = fields.Many2one('wxwork.approval.template.controls', string='控件')
|
||||||
|
# vacation_list = fields.One2many('config.option', 'config_id', string='假期类型列表')
|
||||||
|
# file_id = fields.Integer(string='文件ID')
|
||||||
|
# name = fields.Char(string='文件名称')
|
||||||
|
# lang = fields.Char(string=
|
||||||
|
is_only_photo = fields.Boolean(string='是否只能上传图片')
|
||||||
|
|
||||||
|
|
||||||
class ApproverLine(models.Model):
|
class ApproverLine(models.Model):
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import json
|
||||||
|
|
||||||
from odoo import api, fields, models
|
from odoo import api, fields, models
|
||||||
|
from odoo.addons.sf_wxwork_approval.models import wx_work_api
|
||||||
|
|
||||||
|
|
||||||
class WxSettings(models.Model):
|
class WxSettings(models.Model):
|
||||||
@@ -10,3 +12,422 @@ class WxSettings(models.Model):
|
|||||||
wx_work_app = fields.Char(string='企业微信应用名称')
|
wx_work_app = fields.Char(string='企业微信应用名称')
|
||||||
wx_work_corp_id = fields.Char(string='企业微信CorpID')
|
wx_work_corp_id = fields.Char(string='企业微信CorpID')
|
||||||
wx_work_secret = fields.Char(string='企业微信Secret')
|
wx_work_secret = fields.Char(string='企业微信Secret')
|
||||||
|
wx_work_template_ids = fields.Many2many('wxwork.template.settings', string='审批模板')
|
||||||
|
|
||||||
|
def update_template(self):
|
||||||
|
template_dict = {}
|
||||||
|
template_list = []
|
||||||
|
print(self.wx_work_template_ids)
|
||||||
|
for template in self.wx_work_template_ids:
|
||||||
|
# template_dict[template.sp_name] = template.template_id
|
||||||
|
template_list.append(template.template_id)
|
||||||
|
# template_dict = {}
|
||||||
|
# print(template_list)
|
||||||
|
wx = wx_work_api.WxWorkAPI(self.wx_work_corp_id, self.wx_work_secret)
|
||||||
|
# print(wx)
|
||||||
|
# 获取模型中的所有记录
|
||||||
|
all_records = self.env['wxwork.approval.template'].search([])
|
||||||
|
all_records1 = self.env['wxwork.approval.template.controls'].search([])
|
||||||
|
|
||||||
|
# 删除所有记录
|
||||||
|
all_records.unlink()
|
||||||
|
all_records1.unlink()
|
||||||
|
content_data_list = []
|
||||||
|
template_data = {}
|
||||||
|
controls_data = []
|
||||||
|
for template in template_list:
|
||||||
|
print('====================')
|
||||||
|
temp_dict = {'template_id': template}
|
||||||
|
# print(json.dumps(temp_dict))
|
||||||
|
# aa = json.dumps(temp_dict)
|
||||||
|
template_detail = wx.get_template_detail(temp_dict)
|
||||||
|
print('template_detail%s' % template_detail)
|
||||||
|
#
|
||||||
|
# # 准备用于创建记录的字段值
|
||||||
|
# values = {
|
||||||
|
# 'process_code': template,
|
||||||
|
# 'name': template_detail['template_names'][0]['text'],
|
||||||
|
# # 如果需要设置content_ids,请按照正确格式添加关联数据
|
||||||
|
# }
|
||||||
|
# # 使用create方法创建记录
|
||||||
|
# new_record = self.env['wxwork.approval.template'].create(values)
|
||||||
|
|
||||||
|
# 解析template_detail中的内容数据
|
||||||
|
|
||||||
|
# print('jjjjjjjj', template_detail['template_content'])
|
||||||
|
# print('jjjjjjjjjj', template_detail['template_content']['controls'])
|
||||||
|
for control_data in template_detail['template_content']['controls']:
|
||||||
|
# print('control_data', control_data)
|
||||||
|
property_data = control_data['property']
|
||||||
|
# print('property_data', property_data)
|
||||||
|
config_values = {}
|
||||||
|
|
||||||
|
if 'config' in control_data:
|
||||||
|
config_data = control_data['config']
|
||||||
|
print('config_data', config_data)
|
||||||
|
|
||||||
|
# 先提取table_children数据
|
||||||
|
table_children_data = config_data.get('table', {}).get('children', [])
|
||||||
|
|
||||||
|
# 创建一个空列表用于存储table_children记录
|
||||||
|
table_children_records = []
|
||||||
|
|
||||||
|
# 遍历table_children_data并为每个子控件创建记录
|
||||||
|
for child_data in table_children_data:
|
||||||
|
print('child_data====================', child_data)
|
||||||
|
# 提取property相关数据
|
||||||
|
child_property_data = {
|
||||||
|
# 'control_type': child_data.get('property', {}).get('control', None),
|
||||||
|
# 'unique_control_id': child_data.get('property', {}).get('id', None),
|
||||||
|
# 'title': child_data.get('property', {}).get('title', [{}])[0].get('text', None),
|
||||||
|
# 'placeholder': child_data.get('property', {}).get('placeholder', [{}])[0].get('text', None),
|
||||||
|
# 'require': child_data.get('property', {}).get('require', None),
|
||||||
|
# 'un_print': child_data.get('property', {}).get('un_print', None),
|
||||||
|
# 'un_replace': child_data.get('property', {}).get('un_replace', None),
|
||||||
|
# 'display': child_data.get('property', {}).get('display', None),
|
||||||
|
'control_type': child_data.get('property', {}).get('control', None),
|
||||||
|
'unique_control_id': child_data.get('property', {}).get('id', None),
|
||||||
|
'title': child_data.get('property', {}).get('title', [{}])[0].get('text', None),
|
||||||
|
'placeholder': child_data.get('property', {}).get('placeholder', [{}])[0].get('text', None),
|
||||||
|
'require': child_data.get('property', {}).get('require', None),
|
||||||
|
'un_print': child_data.get('property', {}).get('un_print', None),
|
||||||
|
'un_replace': child_data.get('property', {}).get('un_replace', None),
|
||||||
|
'display': child_data.get('property', {}).get('display', None),
|
||||||
|
}
|
||||||
|
|
||||||
|
# 在这里根据控件类型为每个子控件创建相应的config_id数据
|
||||||
|
# 例如:
|
||||||
|
config_id_data = {
|
||||||
|
'date_type': [(0, 0, {'date_type': child_data.get('config', {}).get('date', {}).get('type',
|
||||||
|
None)})] if 'date' in child_data.get(
|
||||||
|
'config', {}) else [],
|
||||||
|
'selector_type': [(0, 0, {
|
||||||
|
'selector_type': 'single',
|
||||||
|
'options': [(0, 0, {'key': 'opt1', 'text': '选项1'})],
|
||||||
|
})] if 'selector' in child_data.get('config', {}) else [],
|
||||||
|
'contact_type': [
|
||||||
|
(0, 0, {'contact_type': config_data.get('contact', {}).get('type', None),
|
||||||
|
'contact_mode': config_data.get('contact', {}).get('mode',
|
||||||
|
None)})] if 'contact' in child_data.get(
|
||||||
|
'config', {}).get('contact', {}) else [],
|
||||||
|
'file_type': [
|
||||||
|
(0, 0, {'is_only_photo': config_data.get('file', {}).get('is_only_photo',
|
||||||
|
None)})] if 'file' in child_data.get(
|
||||||
|
'config', {}).get('file', {}) else [],
|
||||||
|
# 'table_type': [(0, 0, {
|
||||||
|
# 'table_children': [
|
||||||
|
# (0, 0, {'control_type': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('control', None),
|
||||||
|
# 'unique_control_id': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('id', None),
|
||||||
|
# 'title': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('title', None)[0].get('text', None),
|
||||||
|
# 'placeholder': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('placeholder', None)[0].get('text', None),
|
||||||
|
# 'require': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('require', None),
|
||||||
|
# 'un_print': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('un_print', None),
|
||||||
|
# 'un_replace': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('un_replace', None),
|
||||||
|
# 'display': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('display', None),
|
||||||
|
# })],
|
||||||
|
# })] if 'table' in config_data else [],
|
||||||
|
# 'attendance_type': [(0, 0, {'attendance_type': '1',
|
||||||
|
# 'attendance_date_range_type': 'hour'})] if 'attendance' in config_data else [],
|
||||||
|
}
|
||||||
|
|
||||||
|
# 将config_id_data添加到property_data中(如果有的话)
|
||||||
|
if config_id_data:
|
||||||
|
child_property_data['child_control_id'] = config_id_data
|
||||||
|
|
||||||
|
# 将property_data添加到table_children_records中
|
||||||
|
table_children_records.append((0, 0, child_property_data))
|
||||||
|
|
||||||
|
# 创建一个包含多个wxwork.approval.template.controls的字典列表
|
||||||
|
controls_data = [
|
||||||
|
(0, 0, {
|
||||||
|
'property_id': [(0, 0, {
|
||||||
|
'control_type': property_data.get('control', ''),
|
||||||
|
'unique_control_id': property_data.get('id', ''),
|
||||||
|
'title': property_data['title'][0]['text'] if 'title' in property_data else '',
|
||||||
|
'placeholder': property_data['placeholder'][0][
|
||||||
|
'text'] if 'placeholder' in property_data else '',
|
||||||
|
'require': property_data.get('require', None),
|
||||||
|
'un_print': property_data.get('un_print', None),
|
||||||
|
'un_replace': property_data.get('un_replace', None),
|
||||||
|
'display': property_data.get('display', None),
|
||||||
|
})],
|
||||||
|
'config_id': [(0, 0, {
|
||||||
|
'date_type': [(0, 0, {'date_type': config_data.get('date', {}).get('type',
|
||||||
|
None)})] if 'date' in config_data else [],
|
||||||
|
# 'selector_type': [(0, 0, {
|
||||||
|
# 'selector_type': config_data['table']['children'][0].get('config', {}).get(
|
||||||
|
# 'selector', {}).get('type', None),
|
||||||
|
# 'options': [
|
||||||
|
# (0, 0, {'key': option['key'], 'text': option['value'][0]['text']})
|
||||||
|
# for option in config_data['table']['children'][0].get('config', {}).get('selector', {}).get('options', [])
|
||||||
|
# ],
|
||||||
|
# })] if 'selector' in config_data else [],
|
||||||
|
'selector_type': [
|
||||||
|
(0, 0, {
|
||||||
|
'selector_type': child.get('config', {}).get('selector', {}).get('type', None),
|
||||||
|
'options': [
|
||||||
|
(0, 0, {'key': option['key'], 'text': option['value'][0]['text']})
|
||||||
|
for option in child.get('config', {}).get('selector', {}).get('options', [])
|
||||||
|
],
|
||||||
|
})
|
||||||
|
for child in config_data.get('table', {}).get('children', [])
|
||||||
|
if 'selector' in child.get('config', {})
|
||||||
|
],
|
||||||
|
|
||||||
|
'contact_type': [
|
||||||
|
(0, 0, {'contact_type': config_data.get('contact', {}).get('type', None),
|
||||||
|
'contact_mode': config_data.get('contact', {}).get('mode',
|
||||||
|
None)})] if 'contact' in config_data else [],
|
||||||
|
'file_type': [
|
||||||
|
(0, 0, {'is_only_photo': config_data.get('file', {}).get('is_only_photo',
|
||||||
|
None)})] if 'file' in config_data else [],
|
||||||
|
'table_type': [(0, 0, {
|
||||||
|
'table_children': table_children_records,
|
||||||
|
})] if 'table' in config_data else [],
|
||||||
|
|
||||||
|
# 'contact_type': [
|
||||||
|
# (0, 0, {'contact_type': config_data.get('contact', {}).get('type', None)})],
|
||||||
|
# 'contact_mode': [
|
||||||
|
# (0, 0, {'contact_mode': config_data.get('contact', {}).get('mode', None)})],
|
||||||
|
# 'table_type': [(0, 0, {
|
||||||
|
# 'table_children': [
|
||||||
|
# (0, 0,
|
||||||
|
# {'control_type': 'Text', 'unique_control_id': 'text_2', 'title': '文本框2'})],
|
||||||
|
# })],
|
||||||
|
# # [
|
||||||
|
# # (0, 0, {'control_type': config_data.get('table', {}).get('children', {})[0].
|
||||||
|
# # get('property', {}).get('control', None), 'unique_control_id': 'text_2',
|
||||||
|
# # 'title': '文本框2'})]
|
||||||
|
|
||||||
|
'attendance_type': [(0, 0, {'attendance_type': '1',
|
||||||
|
'attendance_date_range_type': 'hour'})] if 'attendance' in config_data else [],
|
||||||
|
})],
|
||||||
|
}),
|
||||||
|
# 在这里添加更多的控件数据
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
# 创建一个包含多个wxwork.approval.template.controls的字典列表
|
||||||
|
controls_data = [
|
||||||
|
(0, 0, {
|
||||||
|
'property_id': [(0, 0, {
|
||||||
|
'control_type': property_data.get('control', ''),
|
||||||
|
'unique_control_id': property_data.get('id', ''),
|
||||||
|
'title': property_data['title'][0]['text'] if 'title' in property_data else '',
|
||||||
|
'placeholder': property_data['placeholder'][0][
|
||||||
|
'text'] if 'placeholder' in property_data else '',
|
||||||
|
'require': property_data.get('require', None),
|
||||||
|
'un_print': property_data.get('un_print', None),
|
||||||
|
'un_replace': property_data.get('un_replace', None),
|
||||||
|
'display': property_data.get('display', None),
|
||||||
|
})],
|
||||||
|
}),
|
||||||
|
# 在这里添加更多的控件数据
|
||||||
|
]
|
||||||
|
|
||||||
|
# 从vacation_list中提取假期类型数据
|
||||||
|
vacation_items = []
|
||||||
|
vacation_items_data = template_detail.get('vacation_list', [])
|
||||||
|
# 将假期类型数据转换为适用于vacation_items字段的格式
|
||||||
|
if vacation_items_data and 'item' in vacation_items_data:
|
||||||
|
items = []
|
||||||
|
for item in vacation_items_data['item']:
|
||||||
|
id = item.get('id')
|
||||||
|
name = item.get('name')[0].get('text')
|
||||||
|
items.append({'id': id, 'name': name})
|
||||||
|
print(items)
|
||||||
|
|
||||||
|
# if vacation_items_data:
|
||||||
|
# print('vacation_items_data', vacation_items_data)
|
||||||
|
# print('vacation_items_data', type(vacation_items_data))
|
||||||
|
# print('vacation_items_data', vacation_items_data['items'])
|
||||||
|
# print('vacation_items_data', vacation_items_data[0])
|
||||||
|
vacation_items = [(0, 0, {
|
||||||
|
'vacation_id': item['id'],
|
||||||
|
'name': item['name'],
|
||||||
|
'lang': 'zh_CN',
|
||||||
|
}) for item in items]
|
||||||
|
|
||||||
|
# 创建一个包含WxWorkApprovalTemplate和关联记录数据的字典
|
||||||
|
template_data = {
|
||||||
|
'process_code': template,
|
||||||
|
'name': template_detail['template_names'][0]['text'],
|
||||||
|
'content_ids': controls_data,
|
||||||
|
# 'vacation_config_id': [(0, 0, {
|
||||||
|
# # 在这里添加wxwork.approval.vacation.config模型的字段数据
|
||||||
|
# 'vacation_id': template_detail.get('vacation_id', None),
|
||||||
|
# 'name': template_detail.get('vacation_name', None),
|
||||||
|
# 'lang': template_detail.get('vacation_lang', None),
|
||||||
|
# # ...
|
||||||
|
# })],
|
||||||
|
'vacation_config_id': vacation_items
|
||||||
|
}
|
||||||
|
# 检查数据库中是否已经存在具有相同process_code的模板
|
||||||
|
existing_template = self.env['wxwork.approval.template'].search(
|
||||||
|
[('process_code', '=', template)], limit=1)
|
||||||
|
|
||||||
|
if existing_template:
|
||||||
|
# 如果模板已经存在,更新其content_ids字段(即添加控件记录)
|
||||||
|
existing_template.write({'content_ids': controls_data})
|
||||||
|
else:
|
||||||
|
# 如果模板不存在,创建一个新的模板及其关联记录
|
||||||
|
# 调用create方法创建记录
|
||||||
|
template_record = self.env['wxwork.approval.template'].create(template_data)
|
||||||
|
|
||||||
|
# # print(property_data)
|
||||||
|
# # 准备用于创建记录的字段值
|
||||||
|
# property_values = {
|
||||||
|
# 'control_type': property_data.get('control', ''),
|
||||||
|
# 'unique_control_id': property_data.get('id', ''),
|
||||||
|
# 'title': property_data['title'][0]['text'] if 'title' in property_data else '',
|
||||||
|
# 'placeholder': property_data['placeholder'][0]['text'] if 'placeholder' in property_data else '',
|
||||||
|
# 'require': property_data.get('require', None),
|
||||||
|
# 'un_print': property_data.get('un_print', None),
|
||||||
|
# 'un_replace': property_data.get('un_replace', None),
|
||||||
|
# 'display': property_data.get('display', None),
|
||||||
|
# # 'un_replace': template_detail['template_names'][0]['text'],
|
||||||
|
# # 如果需要设置content_ids,请按照正确格式添加关联数据
|
||||||
|
# }
|
||||||
|
# # print('property_values', property_values)
|
||||||
|
# # config_data = None
|
||||||
|
#
|
||||||
|
# if 'config' in control_data:
|
||||||
|
#
|
||||||
|
# config_data = control_data['config']
|
||||||
|
# # print('config_data===', config_data)
|
||||||
|
# if '"date":' in config_data:
|
||||||
|
# # config_values = {
|
||||||
|
# # 'date_type': config_data.get('type', ''),
|
||||||
|
# # }
|
||||||
|
# config_values['date_type'] = config_data.get('type', '')
|
||||||
|
# if '"selector":' in config_data:
|
||||||
|
# # config_values = {
|
||||||
|
# # 'selector_type': config_data.get('type', ''),
|
||||||
|
# # # 'options': config_data['title'][0]['text'] if 'title' in property_data else '',
|
||||||
|
# # }
|
||||||
|
# config_values['selector_type'] = config_data.get('type', '')
|
||||||
|
# if '"contact":' in config_data:
|
||||||
|
# # config_values = {
|
||||||
|
# # 'contact_type': config_data.get('type', ''),
|
||||||
|
# # 'contact_mode': config_data.get('mode', ''),
|
||||||
|
# #
|
||||||
|
# # }
|
||||||
|
# config_values['contact_type'] = config_data.get('type', '')
|
||||||
|
# config_values['contact_mode'] = config_data.get('mode', '')
|
||||||
|
# if '"table":' in config_data:
|
||||||
|
# pass
|
||||||
|
# # config_values = {
|
||||||
|
# # 'table_children': config_data.get('un_print', None),
|
||||||
|
# # }
|
||||||
|
# if '"attendance":' in config_data:
|
||||||
|
# pass
|
||||||
|
# # config_values = {
|
||||||
|
# # 'attendance_type': config_data.get('un_replace', None),
|
||||||
|
# # 'attendance_date_range_type': config_data.get('display', None),
|
||||||
|
# # # 如果需要设置content_ids,请按照正确格式添加关联数据
|
||||||
|
# # }
|
||||||
|
# if '"vacation_list":' in config_data:
|
||||||
|
# pass
|
||||||
|
# # config_values = {
|
||||||
|
# # 'vacation_list': config_data['template_names'][0]['text'],
|
||||||
|
# # # 如果需要设置content_ids,请按照正确格式添加关联数据
|
||||||
|
# # }
|
||||||
|
#
|
||||||
|
# content_data_list.append((0, 0, {
|
||||||
|
# 'property_id': [(0, 0, property_values)],
|
||||||
|
# 'config_id': [(0, 0, config_values)],
|
||||||
|
# }))
|
||||||
|
# else:
|
||||||
|
# content_data_list.append((0, 0, {
|
||||||
|
# 'property_id': [(0, 0, property_values)],
|
||||||
|
# # 'config_id': [(0, 0, config_values)],
|
||||||
|
# }))
|
||||||
|
# # 准备用于创建记录的字段值
|
||||||
|
# property_values = {
|
||||||
|
# 'control_type': property_data.get('control', ''),
|
||||||
|
# 'unique_control_id': property_data.get('id', ''),
|
||||||
|
# 'title': property_data['title'][0]['text'] if 'title' in property_data else '',
|
||||||
|
# 'placeholder': property_data['placeholder'][0]['text'] if 'placeholder' in property_data else '',
|
||||||
|
# 'require': property_data.get('require', None),
|
||||||
|
# 'un_print': property_data.get('un_print', None),
|
||||||
|
# 'un_replace': property_data.get('un_replace', None),
|
||||||
|
# 'display': property_data.get('display', None),
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# if 'config' in control_data:
|
||||||
|
# config_data = control_data['config']
|
||||||
|
#
|
||||||
|
# # 根据config_data为config.model的One2many字段(如options和table_children)构建命令列表
|
||||||
|
# option_vals = [
|
||||||
|
# (0, 0, {'key': 'option_key_1', 'text': 'option_text_1', 'lang': 'zh_CN'}),
|
||||||
|
# (0, 0, {'key': 'option_key_2', 'text': 'option_text_2', 'lang': 'zh_CN'})
|
||||||
|
# ]
|
||||||
|
# vacation_vals = [{'key': 'vacation_key_1', 'text': 'vacation_text_1', 'lang': 'zh_CN'},
|
||||||
|
# {'key': 'vacation_key_2', 'text': 'vacation_text_2', 'lang': 'zh_CN'}]
|
||||||
|
# table_children_vals = [
|
||||||
|
# (0, 0, {
|
||||||
|
# 'control_type': 'Text',
|
||||||
|
# 'unique_control_id': 'control_id_1',
|
||||||
|
# 'title': '控件名称1',
|
||||||
|
# 'placeholder': '控件说明1',
|
||||||
|
# 'require': True
|
||||||
|
# }),
|
||||||
|
# (0, 0, {
|
||||||
|
# 'control_type': 'Number',
|
||||||
|
# 'unique_control_id': 'control_id_2',
|
||||||
|
# 'title': '控件名称2',
|
||||||
|
# 'placeholder': '控件说明2',
|
||||||
|
# 'require': False
|
||||||
|
# })
|
||||||
|
# ]
|
||||||
|
#
|
||||||
|
# # property_vals = [
|
||||||
|
# # (0, 0, {
|
||||||
|
# # 'control_type': 'Text',
|
||||||
|
# # 'unique_control_id': 'control_id_1',
|
||||||
|
# # 'title': '控件名称1',
|
||||||
|
# # 'placeholder': '控件说明1',
|
||||||
|
# # 'require': True
|
||||||
|
# # }),
|
||||||
|
# # (0, 0, {
|
||||||
|
# # 'control_type': 'Number',
|
||||||
|
# # 'unique_control_id': 'control_id_2',
|
||||||
|
# # 'title': '控件名称2',
|
||||||
|
# # 'placeholder': '控件说明2',
|
||||||
|
# # 'require': False
|
||||||
|
# # })
|
||||||
|
# # ]
|
||||||
|
#
|
||||||
|
# config_values = {
|
||||||
|
# 'date_type': config_data.get('type', '') if '"date":' in config_data else '',
|
||||||
|
# 'selector_type': config_data.get('type', '') if '"selector":' in config_data else '',
|
||||||
|
# 'contact_type': config_data.get('type', '') if '"contact":' in config_data else '',
|
||||||
|
# 'contact_mode': config_data.get('mode', '') if '"contact":' in config_data else '',
|
||||||
|
# 'options': option_vals if '"selector":' in config_data else [(6, 0, [])], # 使用示例中的option_vals
|
||||||
|
# 'table_children': table_children_vals if '"table":' in config_data else [(6, 0, [])],
|
||||||
|
# # 使用示例中的property_vals
|
||||||
|
# 'vacation_list': vacation_vals if '"vacation_list":' in config_data else [] # 添加vacation_vals
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# content_data_list.append((0, 0, {
|
||||||
|
# 'property_id': [(0, 0, property_values)],
|
||||||
|
# 'config_id': [(0, 0, config_values)] if 'config' in control_data else [(6, 0, [])],
|
||||||
|
# }))
|
||||||
|
#
|
||||||
|
# # 准备用于创建记录的字段值,包括content_ids数据
|
||||||
|
# values = {
|
||||||
|
# 'process_code': template,
|
||||||
|
# 'name': template_detail['template_names'][0]['text'],
|
||||||
|
# 'content_ids': content_data_list,
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# # 使用create方法创建记录
|
||||||
|
# new_record = self.env['wxwork.approval.template'].create(values)
|
||||||
|
|
||||||
|
|
||||||
|
class WxTemplateSettings(models.Model):
|
||||||
|
_name = 'wxwork.template.settings'
|
||||||
|
_description = '企业微信模板设置'
|
||||||
|
|
||||||
|
sp_name = fields.Char(string='审批模板名称')
|
||||||
|
template_id = fields.Char(string='审批模板ID')
|
||||||
|
# wxwork_id = fields.Many2one('wxwork.settings', string='企业微信')
|
||||||
|
|||||||
@@ -6,6 +6,18 @@ access_wxwork_approval_template_controls,wxwork.approval.template.controls,model
|
|||||||
access_wxwork_approval_approver_line,wxwork.approval.approver_line,model_wxwork_approval_approver_line,base.group_user,1,1,1,1
|
access_wxwork_approval_approver_line,wxwork.approval.approver_line,model_wxwork_approval_approver_line,base.group_user,1,1,1,1
|
||||||
access_wxwork_settings,wxwork.settings,model_wxwork_settings,base.group_user,1,1,1,1
|
access_wxwork_settings,wxwork.settings,model_wxwork_settings,base.group_user,1,1,1,1
|
||||||
access_wxwork_approval_template_summary,wxwork.approval.template.summary,model_wxwork_approval_template_summary,base.group_user,1,1,1,1
|
access_wxwork_approval_template_summary,wxwork.approval.template.summary,model_wxwork_approval_template_summary,base.group_user,1,1,1,1
|
||||||
|
access_wxwork_template_settings,wxwork.template.settings,model_wxwork_template_settings,base.group_user,1,1,1,1
|
||||||
|
access_property_model,property.model,model_property_model,base.group_user,1,1,1,1
|
||||||
|
access_config_model,config.model,model_config_model,base.group_user,1,1,1,1
|
||||||
|
access_config_option,config.option,model_config_option,base.group_user,1,1,1,1
|
||||||
|
access_wxwork_approval_vacation_config,wxwork.approval.vacation.config,model_wxwork_approval_vacation_config,base.group_user,1,1,1,1
|
||||||
|
access_wxwork_approval_date_config,wxwork.approval.date.config,model_wxwork_approval_date_config,base.group_user,1,1,1,1
|
||||||
|
access_wxwork_approval_selector_config,wxwork.approval.selector.config,model_wxwork_approval_selector_config,base.group_user,1,1,1,1
|
||||||
|
access_selector_option,selector.option,model_selector_option,base.group_user,1,1,1,1
|
||||||
|
access_wxwork_approval_contact_config,wxwork.approval.contact.config,model_wxwork_approval_contact_config,base.group_user,1,1,1,1
|
||||||
|
access_wxwork_approval_table_config,wxwork.approval.table.config,model_wxwork_approval_table_config,base.group_user,1,1,1,1
|
||||||
|
access_wxwork_approval_attendance_config,wxwork.approval.attendance.config,model_wxwork_approval_attendance_config,base.group_user,1,1,1,1
|
||||||
|
access_wxwork_approval_file_config,wxwork.approval.file.config,model_wxwork_approval_file_config,base.group_user,1,1,1,1
|
||||||
access_wxwork_approval,wxwork.approval,model_wxwork_approval,base.group_user,1,1,1,1
|
access_wxwork_approval,wxwork.approval,model_wxwork_approval,base.group_user,1,1,1,1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
|
@@ -10,8 +10,8 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<!-- <tree default_order="id desc" js_class="we_approval_tem_tree_class"> -->
|
<!-- <tree default_order="id desc" js_class="we_approval_tem_tree_class"> -->
|
||||||
<tree js_class="we_approval_tem_tree_class">
|
<tree js_class="we_approval_tem_tree_class">
|
||||||
<field name="process_code"/>
|
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
<field name="process_code"/>
|
||||||
<field name="company_id"/>
|
<field name="company_id"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
@@ -23,17 +23,19 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form>
|
<form>
|
||||||
<group>
|
<group>
|
||||||
<field name="process_code"/>
|
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
<field name="process_code"/>
|
||||||
<field name="content_ids"/>
|
<field name="content_ids"/>
|
||||||
<field name="company_id"/>
|
<field name="vacation_config_id" attrs="{'invisible': [('name', '!=', '请假')]}"/>
|
||||||
<field name="choose_department"/>
|
<!-- <field name="vacation_config_id"/> -->
|
||||||
|
<!-- <field name="company_id"/> -->
|
||||||
|
<!-- <field name="choose_department"/> -->
|
||||||
<field name="use_template_approver"/>
|
<field name="use_template_approver"/>
|
||||||
<field name="approver" attrs="{'invisible': [('use_template_approver', '=', '1')]}"/>
|
<field name="approver" attrs="{'invisible': [('use_template_approver', '=', '1')]}"/>
|
||||||
<field name="notifyer" attrs="{'invisible': [('use_template_approver', '=', '1')]}"/>
|
<field name="notifyer" attrs="{'invisible': [('use_template_approver', '=', '1')]}"/>
|
||||||
<field name="notify_type" attrs="{'invisible': [('use_template_approver', '=', '1')]}"/>
|
<field name="notify_type" attrs="{'invisible': [('use_template_approver', '=', '1')]}"/>
|
||||||
<field name="summary_info_ids"/>
|
<field name="summary_info_ids"/>
|
||||||
<!-- <field name="summary_info_ids"/> -->
|
<!-- <button name="submit" type="object" string="提交" class="btn-success"/> -->
|
||||||
</group>
|
</group>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
@@ -57,7 +59,7 @@
|
|||||||
</strong>
|
</strong>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<field name="company_id" options="{'color_field': 'color'}"/>
|
<!-- <field name="company_id" options="{'color_field': 'color'}"/> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
@@ -72,15 +74,8 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree default_order="id desc" js_class="we_approval_tem_tree_class">
|
<tree default_order="id desc" js_class="we_approval_tem_tree_class">
|
||||||
<field name="template_id"/>
|
<field name="template_id"/>
|
||||||
<field name="title"/>
|
<field name="property_id" widget="many2many_tags"/>
|
||||||
<field name="control_id"/>
|
<field name="config_id"/>
|
||||||
<field name="control"/>
|
|
||||||
<field name="value" widget="text"/>
|
|
||||||
<field name="placeholder"/>
|
|
||||||
<field name="require"/>
|
|
||||||
<field name="un_print"/>
|
|
||||||
<field name="un_replace"/>
|
|
||||||
<field name="display"/>
|
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@@ -91,10 +86,40 @@
|
|||||||
<form>
|
<form>
|
||||||
<group>
|
<group>
|
||||||
<field name="template_id"/>
|
<field name="template_id"/>
|
||||||
|
<field name="property_id"/>
|
||||||
|
<field name="config_id"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<!-- 审批模板控件属性 -->
|
||||||
|
<record id="property_model_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件属性</field>
|
||||||
|
<field name="model">property.model</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
<field name="title"/>
|
<field name="title"/>
|
||||||
<field name="control_id"/>
|
<!-- <field name="control_id"/> -->
|
||||||
<field name="control"/>
|
<field name="unique_control_id"/>
|
||||||
<field name="value" widget="text"/>
|
<field name="control_type"/>
|
||||||
|
<field name="placeholder"/>
|
||||||
|
<field name="require"/>
|
||||||
|
<field name="un_print"/>
|
||||||
|
<field name="un_replace"/>
|
||||||
|
<field name="display"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="property_model_form" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件属性</field>
|
||||||
|
<field name="model">property.model</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<group>
|
||||||
|
<field name="title"/>
|
||||||
|
<!-- <field name="control_id"/> -->
|
||||||
|
<field name="unique_control_id"/>
|
||||||
|
<field name="control_type"/>
|
||||||
<field name="placeholder"/>
|
<field name="placeholder"/>
|
||||||
<field name="require"/>
|
<field name="require"/>
|
||||||
<field name="un_print"/>
|
<field name="un_print"/>
|
||||||
@@ -105,6 +130,394 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- 审批模板控件配置 -->
|
||||||
|
<record id="config_model_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件配置</field>
|
||||||
|
<field name="model">config.model</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="control_id"/>
|
||||||
|
<field name="date_type"/>
|
||||||
|
<field name="selector_type"/>
|
||||||
|
<field name="contact_type"/>
|
||||||
|
<field name="table_type"/>
|
||||||
|
<field name="attendance_type"/>
|
||||||
|
<field name="file_type"/>
|
||||||
|
|
||||||
|
<!-- <field name="options"/> -->
|
||||||
|
<!-- <field name="contact_type"/> -->
|
||||||
|
<!-- <field name="contact_mode"/> -->
|
||||||
|
<!-- <field name="table_children"/> -->
|
||||||
|
<!-- <field name="attendance_type"/> -->
|
||||||
|
<!-- <field name="attendance_date_range_type"/> -->
|
||||||
|
<!-- <field name="vacation_list"/> -->
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="config_model_form" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件配置</field>
|
||||||
|
<field name="model">config.model</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<group>
|
||||||
|
<field name="control_id"/>
|
||||||
|
<field name="date_type"/>
|
||||||
|
<field name="selector_type"/>
|
||||||
|
<field name="contact_type"/>
|
||||||
|
<field name="table_type"/>
|
||||||
|
<field name="attendance_type"/>
|
||||||
|
<field name="file_type"/>
|
||||||
|
<!-- <field name="date_type"/> -->
|
||||||
|
<!-- <field name="selector_type"/> -->
|
||||||
|
<!-- <field name="options"/> -->
|
||||||
|
<!-- <field name="contact_type"/> -->
|
||||||
|
<!-- <field name="contact_mode"/> -->
|
||||||
|
<!-- <field name="table_children"/> -->
|
||||||
|
<!-- <field name="attendance_type"/> -->
|
||||||
|
<!-- <field name="attendance_date_range_type"/> -->
|
||||||
|
<!-- <field name="vacation_list"/> -->
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- 审批模板控件Date控件config配置 -->
|
||||||
|
<record id="config_model_date_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件Date控件config配置</field>
|
||||||
|
<field name="model">wxwork.approval.date.config</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="date_type"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="config_model_date_form" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件Date控件config配置</field>
|
||||||
|
<field name="model">wxwork.approval.date.config</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<group>
|
||||||
|
<field name="date_type"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<!-- 审批模板控Selector控件(单选/多选控件)config配置 -->
|
||||||
|
<record id="config_model_selector_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件Selector控件(单选/多选控件)config配置</field>
|
||||||
|
<field name="model">wxwork.approval.selector.config</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="selector_type"/>
|
||||||
|
<field name="selector_exp_type"/>
|
||||||
|
<field name="options"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="config_model_selector_form" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件Selector控件(单选/多选控件)config配置</field>
|
||||||
|
<field name="model">wxwork.approval.selector.config</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<group>
|
||||||
|
<field name="selector_type"/>
|
||||||
|
<field name="selector_exp_type"/>
|
||||||
|
<field name="options"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<!-- 审批模板控Selector控件(单选/多选控件)选项配置 -->
|
||||||
|
<record id="config_model_selector_options_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件Selector控件(单选/多选控件)选项配置</field>
|
||||||
|
<field name="model">selector.option</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="key"/>
|
||||||
|
<field name="text"/>
|
||||||
|
<field name="lang"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="config_model_selector_options_form" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件Selector控件(单选/多选控件)选项配置</field>
|
||||||
|
<field name="model">selector.option</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<group>
|
||||||
|
<field name="key"/>
|
||||||
|
<field name="text"/>
|
||||||
|
<field name="lang"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<!-- 审批模板控件Contact控件(成员/部门/标签控件)config配置 -->
|
||||||
|
<record id="config_model_contact_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件Contact控件(成员/部门/标签控件)config配置</field>
|
||||||
|
<field name="model">wxwork.approval.contact.config</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="contact_type"/>
|
||||||
|
<field name="contact_mode"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="config_model_contact_form" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件Contact控件(成员/部门/标签控件)config配置</field>
|
||||||
|
<field name="model">wxwork.approval.contact.config</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<group>
|
||||||
|
<field name="contact_type"/>
|
||||||
|
<field name="contact_mode"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<!-- 审批模板控件Table控件(明细控件)config配置 -->
|
||||||
|
<record id="config_model_table_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件Table控件(明细控件)config配置</field>
|
||||||
|
<field name="model">wxwork.approval.table.config</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="table_children"/>
|
||||||
|
<field name="table_children_config"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="config_model_table_form" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件Table控件(明细控件)config配置</field>
|
||||||
|
<field name="model">wxwork.approval.table.config</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<group>
|
||||||
|
<field name="table_children"/>
|
||||||
|
<field name="table_children_config"/>
|
||||||
|
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<!-- --><!-- 审批模板控件Table控件(明细控件)子控件配置 -->
|
||||||
|
<!-- <record id="config_model_table_children_tree_view" model="ir.ui.view"> -->
|
||||||
|
<!-- <field name="name">审批模板控件Table控件(明细控件)子控件配置</field> -->
|
||||||
|
<!-- <field name="model">wxwork.approval.table.children.config</field> -->
|
||||||
|
<!-- <field name="arch" type="xml"> -->
|
||||||
|
<!-- <tree> -->
|
||||||
|
<!-- <field name="children_name"/> -->
|
||||||
|
<!-- <field name="children_control"/> -->
|
||||||
|
<!-- </tree> -->
|
||||||
|
<!-- </field> -->
|
||||||
|
<!-- </record> -->
|
||||||
|
<!-- <record id="config_model_table_children_form" model="ir.ui.view"> -->
|
||||||
|
<!-- <field name="name">审批模板控件Table控件(明细控件)子控件配置</field> -->
|
||||||
|
<!-- <field name="model">wxwork.approval.table.children.config</field> -->
|
||||||
|
<!-- <field name="arch" type="xml"> -->
|
||||||
|
<!-- <form> -->
|
||||||
|
<!-- <group> -->
|
||||||
|
<!-- <field name="children_name"/> -->
|
||||||
|
<!-- <field name="children_control"/> -->
|
||||||
|
<!-- </group> -->
|
||||||
|
<!-- </form> -->
|
||||||
|
<!-- </field> -->
|
||||||
|
<!-- </record> -->
|
||||||
|
<!-- --><!-- 审批模板控件Table控件(明细控件)子控件配置 -->
|
||||||
|
<!-- <record id="config_model_table_children_control_tree_view" model="ir.ui.view"> -->
|
||||||
|
<!-- <field name="name">审批模板控件Table控件(明细控件)子控件配置</field> -->
|
||||||
|
<!-- <field name="model">wxwork.approval.table.children.control.config</field> -->
|
||||||
|
<!-- <field name="arch" type="xml"> -->
|
||||||
|
<!-- <tree> -->
|
||||||
|
<!-- <field name="control_type"/> -->
|
||||||
|
<!-- <field name="control_name"/> -->
|
||||||
|
<!-- <field name="control_required"/> -->
|
||||||
|
<!-- </tree> -->
|
||||||
|
<!-- </field> -->
|
||||||
|
<!-- </record> -->
|
||||||
|
<!-- <record id="config_model_table_children_control_form" model="ir.ui.view"> -->
|
||||||
|
<!-- <field name="name">审批模板控件Table控件(明细控件)子控件配置</field> -->
|
||||||
|
<!-- <field name="model">wxwork.approval.table.children.control.config</field> -->
|
||||||
|
<!-- <field name="arch" type="xml"> -->
|
||||||
|
<!-- <form> -->
|
||||||
|
<!-- <group> -->
|
||||||
|
<!-- <field name="control_type"/> -->
|
||||||
|
<!-- <field name="control_name"/> -->
|
||||||
|
<!-- <field name="control_required"/> -->
|
||||||
|
<!-- </group> -->
|
||||||
|
<!-- </form> -->
|
||||||
|
<!-- </field> -->
|
||||||
|
<!-- </record> -->
|
||||||
|
<!-- --><!-- 审批模板控件Table控件(明细控件)子控件配置 -->
|
||||||
|
<!-- <record id="config_model_table_children_control_required_tree_view" model="ir.ui.view"> -->
|
||||||
|
<!-- <field name="name">审批模板控件Table控件(明细控件)子控件配置</field> -->
|
||||||
|
<!-- <field name="model">wxwork.approval.table.children.control.required.config</field> -->
|
||||||
|
<!-- <field name="arch" type="xml"> -->
|
||||||
|
<!-- <tree> -->
|
||||||
|
<!-- <field name="required_name"/> -->
|
||||||
|
<!-- <field name="required_control"/> -->
|
||||||
|
<!-- </tree> -->
|
||||||
|
<!-- </field> -->
|
||||||
|
<!-- </record> -->
|
||||||
|
<!-- <record id="config_model_table_children_control_required_form" model="ir.ui.view"> -->
|
||||||
|
<!-- <field name="name">审批模板控件Table控件(明细控件)子控件配置</field> -->
|
||||||
|
<!-- <field name="model">wxwork.approval.table.children.control.required.config</field> -->
|
||||||
|
<!-- <field name="arch" type="xml"> -->
|
||||||
|
<!-- <form> -->
|
||||||
|
<!-- <group> -->
|
||||||
|
<!-- <field name="required_name"/> -->
|
||||||
|
<!-- <field name="required_control"/> -->
|
||||||
|
<!-- </group> -->
|
||||||
|
<!-- </form> -->
|
||||||
|
<!-- </field> -->
|
||||||
|
<!-- </record> -->
|
||||||
|
<!-- --><!-- 审批模板控件Table控件(明细控件)子控件配置 -->
|
||||||
|
<!-- <record id="config_model_table_children_control_required_control_tree_view" model="ir.ui.view"> -->
|
||||||
|
<!-- <field name="name">审批模板控件Table控件(明细控件)子控件配置</field> -->
|
||||||
|
<!-- <field name="model">wxwork.approval.table.children.control.required.control.config</field> -->
|
||||||
|
<!-- <field name="arch" type="xml"> -->
|
||||||
|
<!-- <tree> -->
|
||||||
|
<!-- <field name="control_name"/> -->
|
||||||
|
<!-- <field name="control_required"/> -->
|
||||||
|
<!-- </tree> -->
|
||||||
|
<!-- </field> -->
|
||||||
|
<!-- </record> -->
|
||||||
|
<!-- <record id="config_model_table_children_control_required_control_form" model="ir.ui.view"> -->
|
||||||
|
<!-- <field name="name">审批模板控件Table控件(明细控件)子控件配置</field> -->
|
||||||
|
<!-- <field name="model">wxwork.approval.table.children.control.required.control.config</field> -->
|
||||||
|
<!-- <field name="arch" type="xml"> -->
|
||||||
|
<!-- <form> -->
|
||||||
|
<!-- <group> -->
|
||||||
|
<!-- <field name="control_name"/> -->
|
||||||
|
<!-- <field name="control_required"/> -->
|
||||||
|
<!-- </group> -->
|
||||||
|
<!-- </form> -->
|
||||||
|
<!-- </field> -->
|
||||||
|
<!-- </record> -->
|
||||||
|
<!-- --><!-- 审批模板控件Table控件(明细控件)子控件配置 -->
|
||||||
|
<!-- <record id="config_model_table_children_control_required_control_required_tree_view" model="ir.ui.view"> -->
|
||||||
|
<!-- <field name="name">审批模板控件Table控件(明细控件)子控件配置</field> -->
|
||||||
|
<!-- <field name="model">wxwork.approval.table.children.control.required.control.required.config</field> -->
|
||||||
|
<!-- <field name="arch" type="xml"> -->
|
||||||
|
<!-- <tree> -->
|
||||||
|
<!-- <field name="required_name"/> -->
|
||||||
|
<!-- <field name="required_control"/> -->
|
||||||
|
<!-- </tree> -->
|
||||||
|
<!-- </field> -->
|
||||||
|
<!-- </record> -->
|
||||||
|
<!-- <record id="config_model_table_children_control_required_control_required_form" model="ir.ui.view"> -->
|
||||||
|
<!-- <field name="name">审批模板控件Table控件(明细控件)子控件配置</field> -->
|
||||||
|
<!-- <field name="model">wxwork.approval.table.children.control.required.control.required.config</field> -->
|
||||||
|
<!-- <field name="arch" type="xml"> -->
|
||||||
|
<!-- <form> -->
|
||||||
|
<!-- <group> -->
|
||||||
|
<!-- <field name="required_name"/> -->
|
||||||
|
<!-- <field name="required_control"/> -->
|
||||||
|
<!-- </group> -->
|
||||||
|
<!-- </form> -->
|
||||||
|
<!-- </field> -->
|
||||||
|
<!-- </record> -->
|
||||||
|
<!-- --><!-- 审批模板控件Table控件(明细控件)子控件配置 -->
|
||||||
|
<!-- <record id="config_model_table_children_control_required_control_required_control_tree_view" model="ir.ui.view"> -->
|
||||||
|
<!-- <field name="name">审批模板控件Table控件(明细控件)子控件配置</field> -->
|
||||||
|
<!-- <field name="model">wxwork.approval.table.children.control.required.control.required.control.config</field> -->
|
||||||
|
<!-- <field name="arch" type="xml"> -->
|
||||||
|
<!-- <tree> -->
|
||||||
|
<!-- <field name="control_name"/> -->
|
||||||
|
<!-- <field name="control_required"/> -->
|
||||||
|
<!-- </tree> -->
|
||||||
|
<!-- </field> -->
|
||||||
|
<!-- </record> -->
|
||||||
|
<!-- <record id="config_model_table_children_control_required_control_required_control_form" model="ir.ui.view"> -->
|
||||||
|
<!-- <field name="name">审批模板控件Table控件(明细控件)子控件配置</field> -->
|
||||||
|
<!-- <field name="model">wxwork.approval.table.children.control.required.control.required.control.config</field> -->
|
||||||
|
<!-- <field name="arch" type="xml"> -->
|
||||||
|
<!-- <form> -->
|
||||||
|
<!-- <group> -->
|
||||||
|
<!-- <field name="control_name"/> -->
|
||||||
|
<!-- <field name="control_required"/> -->
|
||||||
|
<!-- </group> -->
|
||||||
|
<!-- </form> -->
|
||||||
|
<!-- </field> -->
|
||||||
|
<!-- </record> -->
|
||||||
|
|
||||||
|
<!-- 审批模板控件Attendance控件(假勤控件)config配置 -->
|
||||||
|
<record id="config_model_attendance_control_config_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件Attendance控件(假勤控件)config配置</field>
|
||||||
|
<field name="model">wxwork.approval.attendance.config</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="attendance_type"/>
|
||||||
|
<field name="attendance_date_range_type"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="config_model_attendance_control_config_form" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件Attendance控件(假勤控件)config配置</field>
|
||||||
|
<field name="model">wxwork.approval.attendance.config</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<group>
|
||||||
|
<field name="attendance_type"/>
|
||||||
|
<field name="attendance_date_range_type"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<!-- 审批模板控件Vacation控件(假勤控件)config配置 -->
|
||||||
|
<record id="config_model_vacation_control_config_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件Vacation控件(假勤控件)config配置</field>
|
||||||
|
<field name="model">wxwork.approval.vacation.config</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="vacation_id"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="lang"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="config_model_vacation_control_config_form" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件Vacation控件(假勤控件)config配置</field>
|
||||||
|
<field name="model">wxwork.approval.vacation.config</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<group>
|
||||||
|
<field name="vacation_id"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="lang"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<!-- 审批模板控件file控件(文件控件)config配置 -->
|
||||||
|
<record id="config_model_file_control_config_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件file控件(文件控件)config配置</field>
|
||||||
|
<field name="model">wxwork.approval.file.config</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="is_only_photo"/>
|
||||||
|
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="config_model_file_control_config_form" model="ir.ui.view">
|
||||||
|
<field name="name">审批模板控件file控件(文件控件)config配置</field>
|
||||||
|
<field name="model">wxwork.approval.file.config</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<group>
|
||||||
|
<field name="is_only_photo"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<record id="we_approval_template_action" model="ir.actions.act_window">
|
<record id="we_approval_template_action" model="ir.actions.act_window">
|
||||||
<field name="name">审批模板</field>
|
<field name="name">审批模板</field>
|
||||||
<field name="res_model">wxwork.approval.template</field>
|
<field name="res_model">wxwork.approval.template</field>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<field name="wx_work_app"/>
|
<field name="wx_work_app"/>
|
||||||
<field name="wx_work_corp_id"/>
|
<field name="wx_work_corp_id"/>
|
||||||
<field name="wx_work_secret"/>
|
<field name="wx_work_secret"/>
|
||||||
|
<field name="wx_work_template_ids"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@@ -21,6 +22,37 @@
|
|||||||
<field name="wx_work_app"/>
|
<field name="wx_work_app"/>
|
||||||
<field name="wx_work_corp_id"/>
|
<field name="wx_work_corp_id"/>
|
||||||
<field name="wx_work_secret"/>
|
<field name="wx_work_secret"/>
|
||||||
|
<field name="wx_work_template_ids"/>
|
||||||
|
|
||||||
|
</group>
|
||||||
|
<button name="update_template" type="object" string="更新模板"/>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="wxwork_template_settings_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">企业微信模板设置</field>
|
||||||
|
<field name="model">wxwork.template.settings</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<!-- <field name="wxwork_id"/> -->
|
||||||
|
<field name="sp_name"/>
|
||||||
|
<field name="template_id"/>
|
||||||
|
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="wxwork_template_settings_form" model="ir.ui.view">
|
||||||
|
<field name="name">企业微信模板设置</field>
|
||||||
|
<field name="model">wxwork.template.settings</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<group>
|
||||||
|
<!-- <field name="wxwork_id"/> -->
|
||||||
|
<field name="sp_name"/>
|
||||||
|
<field name="template_id"/>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
@@ -37,7 +69,20 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="wx_work_template_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">企业微信模板设置</field>
|
||||||
|
<field name="res_model">wxwork.template.settings</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="help" type="html">
|
||||||
|
<p class="o_view_nocontent_smiling_face">
|
||||||
|
请设置企业微信模板参数!!!
|
||||||
|
</p>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<menuitem id="wx_work_menu" name="企业微信设置" parent="menu_wxwork_approval" sequence="21"
|
<menuitem id="wx_work_menu" name="企业微信设置" parent="menu_wxwork_approval" sequence="21"
|
||||||
action="wx_work_action"/>
|
action="wx_work_action"/>
|
||||||
|
<menuitem id="wx_work_template_menu" name="企业微信模板设置" parent="menu_wxwork_approval" sequence="22"
|
||||||
|
action="wx_work_template_action"/>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
Reference in New Issue
Block a user