This commit is contained in:
李鹏宇
2025-02-14 09:38:26 +08:00
parent 072b981326
commit b58ab92bb3
7 changed files with 13 additions and 14 deletions
+2 -2
View File
@@ -51,8 +51,8 @@ class SoongWorkflow(models.Model):
is_enable_return_button = fields.Boolean(string="是否启用收回", default=True)
is_enable_transmitted_button = fields.Boolean(string="是否启用转交", default=True)
approvals_group_id = fields.Many2one('soong.approval.group', string="审批分组")
user_role_ids = fields.Many2many('soong.user.role', string="授权范围", store=True,
default=lambda self: [(6, 0, [self.env.ref('soong_workflow.soong_user_role_workflow_admin').id])], domain=[('user_type', '!=', 'lv_role')])
user_role_ids = fields.Many2many('soong.user.role', string="授权范围", store=True, domain=[('user_type', '!=', 'lv_role')],
default=lambda self: [(6, 0, [self.env.ref('soong_workflow.soong_user_role_workflow_admin').id])])
department_role_ids = fields.Many2many('hr.department', string="授权部门范围", store=True)
is_user_department_role = fields.Boolean(string="是否有权限查看", store=False, search="_search_is_user_department_role")
@@ -378,6 +378,7 @@ class SoongWorkflowMixin(models.AbstractModel):
# 下一个节点
if self_state + 1 != len(state_list):
next_state = btn_rec.workflow_id.node_ids[self_state + 1].button_ids[0]
# 转交逻辑调整。之后的所有流程
if btn_rec.name == '转交' and len(btn_rec.node_id.out_link_ids) >= 1:
for state in btn_rec.node_id.out_link_ids:
trans_link_id = self.env['trans.link'].create({
@@ -401,6 +402,10 @@ class SoongWorkflowMixin(models.AbstractModel):
raise UserError('请配置{}的角色人员'.format(state.name))
if btn_rec.name == '分发':
employee_ids = [self.env['hr.employee'].search([('user_role_id.name', '=', '董事长')])[0].id]
# 分发督办隐藏过滤
is_supervising = False
if self._module in ['yuthon_official']:
is_supervising = self.is_supervising
return {
"name": _("评论"),
"type": "ir.actions.act_window",
@@ -413,6 +418,7 @@ class SoongWorkflowMixin(models.AbstractModel):
"default_res_id": self.id,
"default_res_model": self._name,
"default_log_ids": logs.ids,
"default_is_supervising": is_supervising,
"default_is_automatic": next_state.is_automatic if btn_rec.name != '分发' else False,
"default_employee_ids": employee_ids,
"default_node_btn_id": btn_rec.id,
@@ -527,7 +533,6 @@ class SoongWorkflowMixin(models.AbstractModel):
return res
# 收回
# 状态变化的时候会出现一条记录是谁操作的?
def action_withdraw(self):
for record in self:
log_ids = record.log_ids.sorted('sequence')
+1
View File
@@ -9,6 +9,7 @@ class TransLink(models.Model):
node_button_id = fields.Many2one('soong.workflow.node.button', string="按钮")
name = fields.Char(string="节点名称")
link_type = fields.Selection([('trans', '转交'), ('return', '退回')], string="节点类型")
sequence = fields.Integer(string="转交顺序")
record_id = fields.Integer()
@@ -43,7 +43,7 @@
<notebook>
<page string="Buttons">
<button name="btn_role_sync"
string="角色同步按钮"
string="角色同步"
type="object"
class="oe_highlight"/>
<field name="button_ids" mode="tree" context="{'default_node_id':id}"/>
@@ -18,7 +18,7 @@ class SoongWorkflowCommentWizard(models.TransientModel):
node_btn_id = fields.Many2one(comodel_name="soong.workflow.node.button")
node_btn_name = fields.Char(string="动作名称", related='node_btn_id.name')
node_link_len = fields.Char(string="转交2")
# is_supervising = fields.Boolean(string="是否督办")
is_supervising = fields.Boolean(string="是否督办")
comment_note_id = fields.Many2one('soong.note', string="意见")
state_list = fields.Char(string="状态列表")
@@ -15,6 +15,7 @@
<field name="node_link_len" invisible="1"/>
<field name="record_id" invisible="1"/>
<field name="is_automatic" invisible="1"/>
<field name="is_supervising" invisible="1"/>
<!-- 退回意见退回类型 -->
<field name="return_link_id" invisible="node_btn_name != '退回'" string="退回节点"/>
<!-- 转交人员 -->
@@ -25,7 +26,7 @@
<field name="comment_note_id" require="1" string="分发意见"/>
<field name="employee_ids" widget="many2many_tags" string="董事长"/>
<field name="circulated_employee_ids" widget="many2many_tags"/>
<field name="supervising_employee_ids" widget="many2many_tags"/>
<field name="supervising_employee_ids" widget="many2many_tags" invisible="not is_supervising"/>
</group>
<footer>
<button name="add_comment" string="确认" type="object" class="oe_highlight"/>
@@ -4,10 +4,6 @@
<record id="hr_recruitment.menu_hr_recruitment_root" model="ir.ui.menu">
<field name="active">False</field>
</record>
<!-- 网站 -->
<record id="website.menu_website_configuration" model="ir.ui.menu">
<field name="active">False</field>
</record>
<!-- 人事 -->
<record id="hr.menu_hr_root" model="ir.ui.menu">
<field name="active">False</field>
@@ -28,10 +24,6 @@
<record id="hr_expense.menu_hr_expense_root" model="ir.ui.menu">
<field name="active">False</field>
</record>
<!--联系人-->
<record id="contacts.menu_contacts" model="ir.ui.menu">
<field name="active">False</field>
</record>
<!-- 假期 -->
<record id="hr_holidays.menu_hr_holidays_root" model="ir.ui.menu">
<field name="active">False</field>