3

How to remove the create option that appears in "search more" view. Search More

Create option

I tried with no_create and few things, but did not help. Anyone have any idea on this?

Shravy
  • 656
  • 1
  • 23
  • 61

2 Answers2

14

many2one widget (default)

Options : Other possible options you can use with this widget.

  • 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 combined.
  • no_open - in read mode: do not render as a link.

Example:

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

Many2many

  1. widget (default)

    Options

    - no_create - remove the “Create” button.
    

    Example

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

    Options

    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.

    Example

    <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>
  • Emipro Technologies, First of all thank you for your valueable answer, Create and edit disappears in the many2one field, but I wanted the create button to be disappeared in the search view i.e after clicking search more, a search view opens , in that search view(that is the second picture). – Shravy Jun 13 '16 at 07:16
  • Review updated answer, I have added few more contents into that. – Emipro Technologies Pvt. Ltd. Jun 13 '16 at 07:53
  • Excellent Emipro Technologies, Spot on. Thanks for the valueable answer. Thank you very much... Great help... – Shravy Jun 13 '16 at 08:20
  • In (2), I think you have the `no_quick_create` and `no_create_edit` definitions mixed up. `no_quick_create` removes "create" and `no_create_edit` removes "create and edit". – snakecharmerb Jun 18 '21 at 08:38
0

It didn't work for me, I did a little change:

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;
}

},
Community
  • 1
  • 1
ejabu
  • 2,998
  • 23
  • 31