如何删除“创建:单击odoo 8中的搜索视图后打开的搜索视图中的选项?

How to remove "Create: option in search view opened after clicking Search view in odoo 8?

如何删除出现在 "search more" 视图中的创建选项。

我尝试了 no_create 和一些东西,但没有帮助。有人对此有任何想法吗?

many2one 小部件(默认)

选项:您可以使用此小部件的其他可能选项。

  • no_quick_create - 删除创建和编辑...选项。
  • no_create_edit - 删除创建 "search_value" 选项。
  • no_create - no_quick_create 和 no_create_edit 合并。
  • no_open - 在阅读模式下:不要呈现为 link.

示例:

<field name="field_name" options="{'no_quick_create': True,    'no_create_edit' : True}"/>

多对多

  1. 小部件(默认)

    选项

    - no_create - remove the “Create” button.
    

    例子

    <field name="field_name" options="{'no_create': True}"/>
    
  2. many2many_tags 小部件

    选项

    no_quick_create - remove the Create and edit... option.

    no_create_edit - remove the Create "search_value" option.

    no_create - no_quick_create and no_create_edit together.

    示例

    <field name="field_name" widget="many2many_tags" options="{'no_create_edit': True}"/>
    

In order to remove CREATE button from search popup, you need to remove it from ~/web/static/src/xml/base.xml file

there is code which add this button into that search wizard. This button is adding conditionally to the wizard but no_create:True is not working somehow. So if you want to remove it from every wizard then just remove it from file else think something how to hide that field conditionally.

<t t-name="SelectCreatePopup.search.buttons">
    <t t-if="! widget.options.disable_multiple_selection">
        <button type="button" class="oe_button oe_selectcreatepopup-search-select oe_highlight" disabled="disabled">Select</button>
    </t>
    <t t-if="!widget.options.no_create">
    <button type="button" class="oe_button oe_selectcreatepopup-search-create">Create</button>
    or </t><a class="oe_selectcreatepopup-search-close oe_bold oe_form_button_cancel" href="javascript:void(0)">Cancel</a>
</t>

它对我不起作用,我做了一点改变:

init: function(parent, options) {
    this._super(parent, options);

    _.defaults(this.options, { initial_view: "search" });
    this.initial_ids = this.options.initial_ids;
if(parent.options && (parent.options.no_create_edit || parent.options.no_create)){
        this.options.no_create = true;
}

},