How to remove Create and Edit... from many2one field.?
Asked Answered
G

10

10

Please advice me How to remove "Create and Edit..." from many2one field.? that item shows below in the many2one fields which I filtered with domain option.

OpenERP version 7

Gourmand answered 26/3, 2013 at 5:33 Comment(0)
L
18

I don't have much idea. Maybe for that you have to make changes in web addons.

But an alternative solution is that you can make that many2one field selection. Add widget="selection" attribute in your xml.

<field name="Your_many2one_field" widget="selection">

Lapful answered 26/3, 2013 at 5:42 Comment(5)
Nice and easy solution , it is working for odoo-8 also , i tested thereRabe
If I want to change the domain of the field from fields_view_get(), so I have to remove the widget="selection". Then how this can be achieved?Bunt
Domain doesn't work on m2o field if widget selection is given.Lapful
I have done it by installing the web_m2x_options module and updating the domain from fields_view_get.Bunt
This solution should be the best but that widget has a problem, and is that if you have a lot of available records to select in the dropdown, it's going to show you only a few ones, and as the selection doesn't have a Search more... option, you'll never be able to select the rest ones.Storz
M
20

Many2one widget (default)

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

  • no_quick_create - It will remove Create "entered text" option.
  • no_create_edit - It will remove Create and edit... 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}"/>

You can refer it from Ludwik Trammer's post

Mcneese answered 2/6, 2015 at 7:46 Comment(0)
L
18

I don't have much idea. Maybe for that you have to make changes in web addons.

But an alternative solution is that you can make that many2one field selection. Add widget="selection" attribute in your xml.

<field name="Your_many2one_field" widget="selection">

Lapful answered 26/3, 2013 at 5:42 Comment(5)
Nice and easy solution , it is working for odoo-8 also , i tested thereRabe
If I want to change the domain of the field from fields_view_get(), so I have to remove the widget="selection". Then how this can be achieved?Bunt
Domain doesn't work on m2o field if widget selection is given.Lapful
I have done it by installing the web_m2x_options module and updating the domain from fields_view_get.Bunt
This solution should be the best but that widget has a problem, and is that if you have a lot of available records to select in the dropdown, it's going to show you only a few ones, and as the selection doesn't have a Search more... option, you'll never be able to select the rest ones.Storz
M
6

It is tested in openerp v7.0 , in which we can remove 'create and edit' by downloading a module present at,

https://www.odoo.com/apps/7.0/web_m2x_options/#access_token=31af017545174c1eb6745fa70c9b6684&scope=userinfo&state=&expires_in=3600&token_type=Bearer

and adding attribute 'create':false, 'create_edit': false like this

    <field name="partner_id" options="{'limit': 10, 'create': false, 'create_edit': false}"/>

A nice tutorial about this is given here https://www.odoo.com/apps/7.0/web_m2x_options/

Materfamilias answered 29/4, 2014 at 13:18 Comment(1)
ello and welcome to Stackoverflow. Please read the guidelines for good answers: stackoverflow.com/questions/how-to-answer. One of the rules is to add context to links, instead of just pasting them. You should provide an answer that is valid without the need for the user to navigate to another side, but might wish to do so for more detail on the answer. That becomes a bigger problem when the links for some reason become invalid.Bekha
A
5

For Odoo 8.0 and 9.0, you should use no_create and no_open.

no_create: Set to True to disable the option the create a new entry inside the drop down list.

no_open: Set to True to disable the button to the right of the drop down list which popup a windows allowing to edit the selected instance.

<field name="field_name"  options="{'no_create': True, 'no_open': True}" />
Amiss answered 2/12, 2015 at 21:21 Comment(0)
A
3

In the xml file put:

<field name="my_field_name" options="{'no_create' : True}"/>

I hope this works!

Altdorfer answered 1/6, 2015 at 20:0 Comment(0)
A
3

In the XML file:

Please add options="{'no_create': True}" to your field which will remove the create button

Affrica answered 12/6, 2017 at 7:39 Comment(0)
H
1

For those who don't want the 'selection' widget (it is less powerful, doesn't offer search capability) this is another method, tested in 8.

<xpath expr="//field[@name='partner_id']" position="attributes">
   <attribute name="options">{'no_create': '1', 'no_create_edit': '1'}</attribute>
</xpath>
Hirai answered 21/4, 2015 at 11:14 Comment(0)
H
1

just add no_open, no_create, no_create_edit, in options

<field name="partner_id" options='{"no_open": True,"no_create": 1, "no_create_edit": 1}'/>

I tried it and it is working fine.

Hemminger answered 26/4, 2015 at 14:0 Comment(0)
Y
1

In you XML file

<field name="your_field_name" options="{'no_quick_create':True,'no_create_edit':True,'no_open': True,}"/>
Yocum answered 26/4, 2018 at 6:18 Comment(0)
C
0

Solution for odoo here, for many2one relational field.

Works in listed below official odoo version, default feature.

  • odoo 9
  • odoo 10
  • odoo 11
<field name="patient_id" options="{'no_quick_create': true, 'no_create_edit': false}"/>

Note:

  • 'no_quick_create': true, disable inline creation feature, without
  • popup 'no_create_edit': true, disable inline creation with popup features. 'no
  • _create': true, diable inline and popup both with this only a option
Cyclamen answered 27/11, 2017 at 16:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.