启用隐藏
This commit is contained in:
@@ -599,8 +599,7 @@ class SoongWorkflowMixin(models.AbstractModel):
|
||||
)
|
||||
else:
|
||||
# Check Condition Code
|
||||
btn_invisible = []
|
||||
is_review_type_invisible = False
|
||||
# btn_invisible = []
|
||||
is_apostille = False
|
||||
if button.btn_hide:
|
||||
if button.review_type == "individual":
|
||||
@@ -615,12 +614,12 @@ class SoongWorkflowMixin(models.AbstractModel):
|
||||
('employee_id.user_role_ids', 'in', button.users_role_id.id)])
|
||||
if self.env.user not in user_role_id:
|
||||
continue
|
||||
# 如果是隐藏条件拼接隐藏条件
|
||||
elif button.review_type == "invisible":
|
||||
if button.invisible_expression:
|
||||
is_review_type_invisible = True
|
||||
domain = eval(button.invisible_expression)
|
||||
btn_invisible = self.sudo().env[button.workflow_id.model_id.model].search(domain).ids
|
||||
# # 如果是隐藏条件拼接隐藏条件
|
||||
# elif button.review_type == "invisible":
|
||||
# if button.invisible_expression:
|
||||
# is_review_type_invisible = True
|
||||
# domain = eval(button.invisible_expression)
|
||||
# btn_invisible = self.sudo().env[button.workflow_id.model_id.model].search(domain).ids
|
||||
# 如果是加签确认
|
||||
elif button.review_type == "apostille":
|
||||
is_apostille = True
|
||||
@@ -644,11 +643,15 @@ class SoongWorkflowMixin(models.AbstractModel):
|
||||
|
||||
if button.is_highlight:
|
||||
btn_exec_action_el.set("class", "oe_highlight")
|
||||
|
||||
# if button.is_high_red:
|
||||
# btn_exec_action_el.set("style", "background-color: red !important;color: white !important;")
|
||||
if button.has_icon:
|
||||
btn_exec_action_el.set("icon", button.icon)
|
||||
if is_review_type_invisible:
|
||||
# 如果有隐藏条件的话,启用隐藏
|
||||
if button.is_review_invisible and button.invisible_expression:
|
||||
domain = eval(button.invisible_expression)
|
||||
btn_invisible = self.sudo().env[button.workflow_id.model_id.model].search(domain).ids
|
||||
btn_exec_action_el.set(
|
||||
"invisible", "not id or state != '{0}' or id not in {1}".format(node.node_name, btn_invisible)
|
||||
)
|
||||
@@ -663,6 +666,7 @@ class SoongWorkflowMixin(models.AbstractModel):
|
||||
btn_exec_action_el.set(
|
||||
"invisible", "not id or state != '%s'" % node.node_name
|
||||
)
|
||||
|
||||
if button.name in ["退回", "结束"]:
|
||||
if not self.sudo().env["soong.workflow.log"].search([("workflow_id", "=", wkf_rec.id), ("node_id", "=", node.id)]).ids:
|
||||
btn_exec_action_el.set("invisible", "1")
|
||||
|
||||
@@ -337,12 +337,13 @@ class SoongWorkflowNodeButton(models.Model):
|
||||
("group", "Any user in a specific group"),
|
||||
("expression", "Python Expression"),
|
||||
('user_role', '角色'),
|
||||
('invisible', '隐藏条件'),
|
||||
# ('invisible', '隐藏条件'),
|
||||
('apostille', '加签确认'),
|
||||
('end', "结束"),
|
||||
('withdraw', '收回'),
|
||||
],
|
||||
)
|
||||
is_review_invisible = fields.Boolean(string="是否隐藏", default=False)
|
||||
reviewer_id = fields.Many2one(comodel_name="res.users", string="Reviewer")
|
||||
reviewer_group_id = fields.Many2one(comodel_name="res.groups", string="Reviewer group")
|
||||
users_role_id = fields.Many2one(comodel_name="soong.user.role", string="主角色",
|
||||
|
||||
@@ -166,6 +166,16 @@
|
||||
<field name="icon" invisible="has_icon == False" required="has_icon == True"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="is_review_invisible"/>
|
||||
<field name="invisible_expression" colspan="2" invisible="is_review_invisible == False" required="is_review_invisible == True"
|
||||
widget="domain"
|
||||
options="{'model': 'invisible_expression_model', 'in_dialog': True,}"
|
||||
nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<notebook>
|
||||
<page string="Condition">
|
||||
<group>
|
||||
@@ -192,12 +202,12 @@
|
||||
<field name="reviewer_expression" colspan="2" required="review_type == 'expression'" widget="code"
|
||||
options="{'mode': 'python'}" nolabel="1"/>
|
||||
</group>
|
||||
<group invisible="review_type != 'invisible' or btn_hide == False">
|
||||
<field name="invisible_expression" colspan="2" required="review_type == 'invisible'"
|
||||
widget="domain"
|
||||
options="{'model': 'invisible_expression_model', 'in_dialog': True,}"
|
||||
nolabel="1"/>
|
||||
</group>
|
||||
<!-- <group invisible="review_type != 'invisible' or btn_hide == False">-->
|
||||
<!-- <field name="invisible_expression" colspan="2" required="review_type == 'invisible'"-->
|
||||
<!-- widget="domain"-->
|
||||
<!-- options="{'model': 'invisible_expression_model', 'in_dialog': True,}"-->
|
||||
<!-- nolabel="1"/>-->
|
||||
<!-- </group>-->
|
||||
</page>
|
||||
<page string="Actions">
|
||||
<group>
|
||||
|
||||
Reference in New Issue
Block a user