小智 5
这可以通过插入条件 CSS 来完成。
首先添加一个 html 字段,并将 sanitize 选项设置为 False:
x_css = fields.Html(
string='CSS',
sanitize=False,
compute='_compute_css',
store=False,
)
Run Code Online (Sandbox Code Playgroud)
然后添加具有您自己的依赖项和条件的计算方法:
# Modify the "depends"
@api.depends('state_str_modify_me')
def _compute_css(self):
for application in self:
# Modify below condition
if application.state_str_modify_me= 'In Progress':
application.x_css = '<style>.o_form_button_edit {display: none !important;}</style>'
else:
application.x_css = False
Run Code Online (Sandbox Code Playgroud)
最后将其添加到视图中:
<field name="x_css" invisible="1"/>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2120 次 |
最近记录: |