Merge branch 'dev' of https://gitee.com/jinan-pengyusen-data/gzth into dev_wang
This commit is contained in:
@@ -44,76 +44,76 @@ class SoongWorkflowEntrust(models.Model):
|
||||
entrust_notice = fields.Boolean(string="发送事务提醒消息", default=True)
|
||||
workflow_data = fields.Char(string="委托流程记录方便到期删除")
|
||||
|
||||
@api.constrains('is_enable', 'entrust_user_id', 'entrust_user_id2')
|
||||
def onchange_entrust(self):
|
||||
# 如果是全部流程
|
||||
if self.is_enable:
|
||||
all_work_list = []
|
||||
for model_id in self.model_ids:
|
||||
if self.env['ir.model'].search([('id', '=', model_id.id)]).name == '全部流程':
|
||||
all_work_ids = self.env['soong.workflow'].search([('is_enable', '=', True)])
|
||||
else:
|
||||
all_work_ids = self.env['soong.workflow'].search([('is_enable', '=', True), ('model_id', '=', model_id.id)])
|
||||
# 便利出所有的记录集,查出与本人相关的
|
||||
for work_id in all_work_ids:
|
||||
state_dict = {}
|
||||
for state in work_id.node_ids:
|
||||
node_data_list = []
|
||||
for node in state.button_ids:
|
||||
if node.name == '转交':
|
||||
if node.btn_hide:
|
||||
if node.review_type == 'user_role':
|
||||
node_data = {'users_role_id': node.users_role_id.id}
|
||||
elif node.review_type == 'individual':
|
||||
node_data = {'reviewer_id': node.reviewer_id.id, }
|
||||
else:
|
||||
node_data = []
|
||||
node_data_list.append(node_data)
|
||||
state_dict[state.name + '-' + str(work_id.id)] = node_data_list
|
||||
all_work_list.append(state_dict)
|
||||
# 查找委托人当前关联的流程
|
||||
reviewer_id = self.env['res.users'].search([('id', '=', self.entrust_user_id.id)])
|
||||
users_role_id = reviewer_id.employee_id.user_role_id.id
|
||||
for work in all_work_list:
|
||||
# 判断角色是否在里面
|
||||
users_role = [
|
||||
key for key, items in work.items()
|
||||
if any(
|
||||
isinstance(item, dict) and item.get('users_role_id') == users_role_id
|
||||
for item in items
|
||||
)
|
||||
]
|
||||
for role in users_role:
|
||||
workflow = int(role.split('-')[-1])
|
||||
work_code = role.split('-')[0]
|
||||
workflow_id = self.env['soong.workflow'].search([('id', '=', workflow)])
|
||||
for flow in workflow_id.node_ids:
|
||||
if flow.name == work_code and flow.button_ids[-1].name != '转交':
|
||||
flow.write({
|
||||
'button_ids': [(0, 0, {
|
||||
"name": _("转交"),
|
||||
"workflow_id": workflow_id.id,
|
||||
"sequence": 999,
|
||||
"review_type": "individual",
|
||||
"btn_hide": True,
|
||||
"action_type": 'code',
|
||||
"reviewer_id": self.entrust_user_id2.id,
|
||||
"has_comment": True,
|
||||
})]
|
||||
})
|
||||
if self.workflow_data:
|
||||
self.workflow_data = self.workflow_data + work_code + '-' + str(workflow_id.id) + ','
|
||||
else:
|
||||
self.workflow_data = work_code + '-' + str(workflow_id.id) + ','
|
||||
else:
|
||||
for de in self:
|
||||
work_ids_list = de.workflow_data.split(',')[0:-1]
|
||||
for work in work_ids_list:
|
||||
workflow_id = self.env['soong.workflow'].search([('id', '=', int(work.split('-')[-1]))])
|
||||
for flow in workflow_id.node_ids:
|
||||
if flow.name == work.split('-')[0] and flow.button_ids[-1].name == '转交':
|
||||
flow.button_ids[-1].unlink()
|
||||
self.workflow_data = ''
|
||||
# @api.constrains('is_enable', 'entrust_user_id', 'entrust_user_id2')
|
||||
# def onchange_entrust(self):
|
||||
# # 如果是全部流程
|
||||
# if self.is_enable:
|
||||
# all_work_list = []
|
||||
# for model_id in self.model_ids:
|
||||
# if self.env['ir.model'].search([('id', '=', model_id.id)]).name == '全部流程':
|
||||
# all_work_ids = self.env['soong.workflow'].search([('is_enable', '=', True)])
|
||||
# else:
|
||||
# all_work_ids = self.env['soong.workflow'].search([('is_enable', '=', True), ('model_id', '=', model_id.id)])
|
||||
# # 便利出所有的记录集,查出与本人相关的
|
||||
# for work_id in all_work_ids:
|
||||
# state_dict = {}
|
||||
# for state in work_id.node_ids:
|
||||
# node_data_list = []
|
||||
# for node in state.button_ids:
|
||||
# if node.name == '转交':
|
||||
# if node.btn_hide:
|
||||
# if node.review_type == 'user_role':
|
||||
# node_data = {'users_role_id': node.users_role_id.id}
|
||||
# elif node.review_type == 'individual':
|
||||
# node_data = {'reviewer_id': node.reviewer_id.id, }
|
||||
# else:
|
||||
# node_data = []
|
||||
# node_data_list.append(node_data)
|
||||
# state_dict[state.name + '-' + str(work_id.id)] = node_data_list
|
||||
# all_work_list.append(state_dict)
|
||||
# # 查找委托人当前关联的流程
|
||||
# reviewer_id = self.env['res.users'].search([('id', '=', self.entrust_user_id.id)])
|
||||
# users_role_id = reviewer_id.employee_id.user_role_id.id
|
||||
# for work in all_work_list:
|
||||
# # 判断角色是否在里面
|
||||
# users_role = [
|
||||
# key for key, items in work.items()
|
||||
# if any(
|
||||
# isinstance(item, dict) and item.get('users_role_id') == users_role_id
|
||||
# for item in items
|
||||
# )
|
||||
# ]
|
||||
# for role in users_role:
|
||||
# workflow = int(role.split('-')[-1])
|
||||
# work_code = role.split('-')[0]
|
||||
# workflow_id = self.env['soong.workflow'].search([('id', '=', workflow)])
|
||||
# for flow in workflow_id.node_ids:
|
||||
# if flow.name == work_code and flow.button_ids[-1].name != '转交':
|
||||
# flow.write({
|
||||
# 'button_ids': [(0, 0, {
|
||||
# "name": _("转交"),
|
||||
# "workflow_id": workflow_id.id,
|
||||
# "sequence": 999,
|
||||
# "review_type": "individual",
|
||||
# "btn_hide": True,
|
||||
# "action_type": 'code',
|
||||
# "reviewer_id": self.entrust_user_id2.id,
|
||||
# "has_comment": True,
|
||||
# })]
|
||||
# })
|
||||
# if self.workflow_data:
|
||||
# self.workflow_data = self.workflow_data + work_code + '-' + str(workflow_id.id) + ','
|
||||
# else:
|
||||
# self.workflow_data = work_code + '-' + str(workflow_id.id) + ','
|
||||
# else:
|
||||
# for de in self:
|
||||
# work_ids_list = de.workflow_data.split(',')[0:-1]
|
||||
# for work in work_ids_list:
|
||||
# workflow_id = self.env['soong.workflow'].search([('id', '=', int(work.split('-')[-1]))])
|
||||
# for flow in workflow_id.node_ids:
|
||||
# if flow.name == work.split('-')[0] and flow.button_ids[-1].name == '转交':
|
||||
# flow.button_ids[-1].unlink()
|
||||
# self.workflow_data = ''
|
||||
|
||||
@api.depends('start_date', 'end_date', 'is_expiration_date')
|
||||
def compute_is_enable(self):
|
||||
|
||||
@@ -128,11 +128,11 @@ class YuthonSalaryActive(models.Model):
|
||||
category='salary', user_id=self.employee_id.wecom_userid,
|
||||
url=url, title='工资条', description=f"{self.select_year}年{self.select_time}月的薪资条已经发放", btntxt="查看详情"
|
||||
)
|
||||
self.sudo().env["wecom.apps"].sync_send_message_textcard(
|
||||
category='salary', user_id='18562027762',
|
||||
url=url, title='工资条', description=f"{self.select_year}年{self.select_time}月的薪资条已经发放",
|
||||
btntxt="查看详情"
|
||||
)
|
||||
# self.sudo().env["wecom.apps"].sync_send_message_textcard(
|
||||
# category='salary', user_id='18562027762',
|
||||
# url=url, title='工资条', description=f"{self.select_year}年{self.select_time}月的薪资条已经发放",
|
||||
# btntxt="查看详情"
|
||||
# )
|
||||
self.write({'confirm_status': 'un_confirm'})
|
||||
|
||||
def all_payslip_transmit(self):
|
||||
|
||||
@@ -94,6 +94,12 @@ class YuthonWillTask(models.Model):
|
||||
is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company',
|
||||
search='_search_part_of_company')
|
||||
|
||||
def update_task_state(self):
|
||||
will_ids = self.env["yuthon.will.task"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for will in will_ids:
|
||||
will.task_state = 'done'
|
||||
|
||||
def _compute_is_company(self):
|
||||
active_company_ids = self.env.companies
|
||||
for employee in self:
|
||||
|
||||
@@ -402,4 +402,12 @@
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.one_time()</field>
|
||||
</record>
|
||||
<record id="all_update_task_state" model="ir.actions.server">
|
||||
<field name="name">状态改为已办</field>
|
||||
<field name="model_id" ref="yuthon_will_task.model_yuthon_will_task"/>
|
||||
<field name="binding_model_id" ref="yuthon_will_task.model_yuthon_will_task"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.update_task_state()</field>
|
||||
<field name="groups_id" eval="[(4, ref('base.group_system'))]"/>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user