This commit is contained in:
李鹏宇
2025-01-21 21:33:24 +08:00
parent cdb38a3f13
commit 7a5e1cba9f
2 changed files with 36 additions and 13 deletions
@@ -190,9 +190,16 @@ class SoongWorkflowNode(models.Model):
})
else:
raise UserError('该模型未找到form视图')
def all_readonly_fields(self):
self.field_ids.write({"readonly": True})
def all_required_fields(self):
self.field_ids.write({"required": True})
def all_invisible_fields(self):
self.field_ids.write({"invisible": True})
class SoongWorkflowNodeButton(models.Model):
_name = "soong.workflow.node.button"
@@ -47,11 +47,18 @@
string="加载模型字段-form"
type="object"
class="oe_highlight"/>
<p></p>
<button name="all_readonly_fields"
string="所有字段只读"
type="object"
class="oe_highlight"/>
<button name="all_required_fields"
string="所有字段必填"
type="object"
class="oe_highlight"/>
<button name="all_invisible_fields"
string="所有字段隐藏"
type="object"
class="oe_highlight"/>
<field name="field_ids" mode="tree"
context="{'default_model_id':model_id, 'disable_open': 1}"/>
</page>
@@ -153,35 +160,44 @@
<field name="btn_hide"/>
</group>
<group invisible="btn_hide == False">
<field name="review_type" />
<field name="review_type"/>
<field
name="reviewer_id"
invisible="review_type != 'individual'"
name="reviewer_id"
invisible="review_type != 'individual'"
/>
<field
name="reviewer_group_id"
invisible="review_type != 'group'"
name="reviewer_group_id"
invisible="review_type != 'group'"
/>
<field name="users_role_id" invisible="review_type != 'user_role'" required="review_type == 'user_role' and btn_hide"/>
<field name="users_role_id" invisible="review_type != 'user_role'"
required="review_type == 'user_role' and btn_hide"/>
</group>
<group invisible="review_type != 'expression' or btn_hide == False">
<div class="alert alert-danger oe_edit_only" role="alert" style="width: max-content;">
<strong>Note:</strong> The result of executing the expression must be a res.users recordset.
<strong>Note:</strong>
The result of executing the expression must be a res.users recordset.
</div>
<field name="reviewer_expression" colspan="2" required="1" widget="code" options="{'mode': 'python'}" nolabel="1"/>
<field name="reviewer_expression" colspan="2" required="1" widget="code"
options="{'mode': 'python'}" nolabel="1"/>
</group>
<group invisible="review_type != 'invisible' or btn_hide == False">
<group invisible="review_type != 'invisible' or btn_hide == False">
<div class="alert alert-danger oe_edit_only" role="alert" style="width: max-content;">
<strong>备注:</strong> 这里填写按钮的隐藏条件,参考invisible的写法,invisible="name != '1' or state != '0'",这里只写 name != '1' or state != '0' 即可,注意其中的字段必须填写页面中提前声明的。
<strong>备注:</strong>
这里填写按钮的隐藏条件,参考invisible的写法,invisible="name != '1' or state !=
'0'",这里只写 name != '1' or state != '0' 即可,注意其中的字段必须填写页面中提前声明的。
</div>
<field name="invisible_expression" colspan="2" required="review_type == 'invisible'" widget="domain" options="{'model': 'invisible_expression_model', 'in_dialog': True,}" nolabel="1"/>
<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>
<field name="action_type" required="1"/>
</group>
<group name="link" invisible="action_type not in ['link', 'link_action', 'link_action_approve', 'link_action_refuse', 'link_start_statu']">
<group name="link"
invisible="action_type not in ['link', 'link_action', 'link_action_approve', 'link_action_refuse', 'link_start_statu']">
<field name="link_id"
domain="[('node_from','=',node_id)]"
options="{'no_open': True, 'no_create': True}"