问题描述
如何从 many2many 字段看板小部件模式中隐藏“添加”选项。我尝试使用 options="{'no_create': True}" 但它不起作用
<field name="members" widget="many2many_kanban" options="{'no_create': True}"
context="{'form_view_ref': 'project_team.project_team_form_view','default_type_team':'project'}"
attrs="{'readonly':['|',('state','not in',['open']),('project_m_user','!=',True)]}">
<kanban quick_create="false" create="true" delete="true">
<field name="id"/>
<field name="name"/>
<templates>
<t t-name="kanban-Box">
<div class="oe_kanban_global_click" style="max-width: 200px">
<div class="o_kanban_record_top">
<img t-att-src="kanban_image('res.users','image_small',record.id.raw_value)"
height="40" width="40"
class="oe_avatar oe_kanban_avatar_smallBox mb0"/>
<div class="o_kanban_record_headings ml8">
<strong class="o_kanban_record_title">
<field name="name"/>
</strong>
</div>
<!--<a t-if="! read_only_mode" type="delete"
class="text-danger">
<i class="fa fa-times"></i>
</a>-->
</div>
</div>
</t>
</templates>
</kanban>
</field>
提前致谢
解决方法
您可以options
字段标签的属性。
在您的情况下,您需要使用“no_create”,如果您不允许编辑,请使用“no_create_edit”
例如:
编辑:
将 Error from server (BadRequest): error when creating "STDIN": admission webhook "validate.nginx.ingress.kubernetes.io" denied the request:
-------------------------------------------------------------------------------
Error: exit status 1
2021/06/21 11:05:45 [emerg] 851#851: invalid number of arguments in "proxy_set_header" directive in /tmp/nginx-cfg063051389:453
nginx: [emerg] invalid number of arguments in "proxy_set_header" directive in /tmp/nginx-cfg063051389:453
nginx: configuration file /tmp/nginx-cfg063051389 test failed
改为 create="true"
它在树视图中对我有用