添加功能

This commit is contained in:
李鹏宇
2025-12-05 10:09:29 +08:00
parent 27836dfe83
commit 400b30e7af
+13 -14
View File
@@ -694,7 +694,6 @@ class SoongWorkflowMixin(models.AbstractModel):
# Construct Buttons & Fields Tags
wkf_rec = wkf_obj.search([("model_id", "=", model), ('is_enable', '=', True)])
for node in wkf_rec.node_ids:
force_hide_withdraw = False
for button in node.button_ids:
if self.env.user.has_group("soong_workflow.group_soong_workflow_manager"):
btn_exec_action_el = etree.SubElement(header_el, "button")
@@ -722,13 +721,13 @@ class SoongWorkflowMixin(models.AbstractModel):
elif button.review_type == "expression":
if not _check_condition_code(button):
continue
# 如果是收回
log_ids = self.sudo().env["soong.workflow.log"].search(
[("workflow_id", "=", wkf_rec.id),
("node_id", "=", node.id)
])
if log_ids and log_ids[-1].approval_state != '0':
force_hide_withdraw = True
# # 如果是收回
# log_ids = self.sudo().env["soong.workflow.log"].search(
# [("workflow_id", "=", wkf_rec.id),
# ("node_id", "=", node.id)
# ])
# if log_ids and log_ids[-1].approval_state != '0':
# force_hide_withdraw = True
# Add Button to View
btn_exec_action_el = etree.SubElement(header_el, "button")
btn_exec_action_el.set("name", "btn_exec_action")
@@ -790,12 +789,12 @@ class SoongWorkflowMixin(models.AbstractModel):
# if button.name == "结束":
# invisible += " or True"
invisible += " or work_end"
if force_hide_withdraw and button.name == "收回":
invisible += "1"
btn_exec_action_el.set("invisible", "1")
else:
btn_exec_action_el.set("invisible", invisible)
btn_exec_action_el.set("context", "{'btn_key':'%s','active_model':'%s'}" % (button.btn_key, self._name),)
# if force_hide_withdraw and button.name == "收回":
# invisible += "1"
# btn_exec_action_el.set("invisible", "1")
# else:
btn_exec_action_el.set("invisible", invisible)
btn_exec_action_el.set("context", "{'btn_key':'%s','active_model':'%s'}" % (button.btn_key, self._name),)
res["arch"] = etree.tostring(arch, encoding="unicode").replace("\t", "")
return res