Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

5

How do you remove 'CREATE AND EDIT' when populating a one2many field

By
priyankahdp
on 3/28/13, 7:16 AM 20,332 views

Friends, Need to remove this option from pop up manyone fields. (not in all fields.some fields need to remove this feature).i used widget="selection".then my domain filter not working.so please help me to find a solution.

create and edit

Hi ,

Perhaps you can use text widget , such as <field name="division_id" /> with nothing specified in the field tag.

But in the first place why do u want to remove it ? and what do you mean by domain filter not working ? (the model that you are working on or the one2many field e.g. division that show in your screen that is not working ?

kalmenchia
on 3/28/13, 8:25 PM

yes friend.its not working.in here i can insert records without parent company also.then domain filter may useless & user can create estates without company

refer my codes in github https://github.com/priyankahdp/openerp/

priyankahdp
on 3/28/13, 10:37 PM

Add widget="selection"

supreeth
on 1/12/15, 1:57 AM
19

Jeudy Nicolas

--Jeudy Nicolas--
1181
| 6 7 8
PELOUSEY, France
--Jeudy Nicolas--

- Linux administrator - Functional guy with OpenERP - Python, html, css, javascript developer OpenERP Ready Partner

Jeudy Nicolas
On 5/25/13, 10:31 AM

hi,

I reopen this question because priyankahdp link is out, and I think no answer have been written.

So, For this need, I wrote a new OpenERP V7 module web_m2o_enhanced that add some options tu many2one field xml definition:

  • create: true/false -> disable "create" entry in dropdown panel
  • create_edit: true/false -> disable "create and edit" entry in dropdown panel
  • limit: 10 (int) -> change number of selected record return in dropdown panel
  • m2o_dialog: true/false -> disable quick create M20Dialog triggered on error.

Example:

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

you can clone it from github web_m2o_enhanced repo

Update:

  • 29/05/2013: we add using of access right to show create or create and edit if you what write access on linked object by default.
  • Openerp provide by default a no_open option to disable right edit item for many2one widget.
  • 23/09/2013: Be sure to reload openerp web page after installing this module and have an empty javascript cache !
  • 15/10/2013: Now support many2manytag widget ! (OpenERP help)
  • 2/12/2013: Now in community modules: https://www.openerp.com/apps/7.0/web_m2x_options/

thanks so much dear Nicolas

priyankahdp
on 5/26/13, 3:35 AM

Nicolas you should be knighted for this, I have started working on the exact same module and to see it written is a relief! Thank you for the wonderful contribution, the need for this module is pretty high!

One thing though, when typing something in the many2one that does not exist on the other side and pressing tab (field losing focus) a quick-create form pops up that yet again enabled the user to create the object himself.Do you know if anything could be done about that?

Sincere regards! Paul

Paul Catinean
on 5/27/13, 9:44 AM

Paul, m2o_dialog option do this. set it to false and no dialog box will appear if many2one value does not existe.

Tuxservices, Jeudy Nicolas
on 5/28/13, 11:03 AM

Thank you very much Nicolas, I really had no idea about that option.Hope they will implement your design in the core, you should ask for a merge or something it's very useful stuff.Thanks again!

Cheers!

Paul Catinean
on 5/29/13, 4:25 AM

One last question, the edit button on the right after you have chosen an object in the many2one.That allows you to edit the record chosen even if you do not have write privileges on that object.Any idea what can be done with that?

Paul Catinean
on 5/29/13, 5:40 AM

Yes, you CAN use no_open options and SET to false

Tuxservices, Jeudy Nicolas
on 5/29/13, 2:48 PM

We update this module to use right access to show or not some items (create, create and edit). We test it with a sale order for a salesman that can only show partner but not créate it.

Tuxservices, Jeudy Nicolas
on 5/30/13, 3:15 PM

you can use options no_open and set to false if you don't want to see right edit button on right

Tuxservices, Jeudy Nicolas
on 5/30/13, 3:19 PM

How to install web_m2o_enhanced module .

CHEBBAKI kader
on 9/23/13, 10:43 AM

To use this code ou must install web_m2o_enhanced module reload you javascript cache and test this on a form. Be carreful: with inherit system some other form can remove you spécial setup.

Can you give me more détails about form you change and what fails ?

Tuxservices, Jeudy Nicolas
on 12/2/13, 11:19 AM

can you use debug mode on your browser and see if web_m2o_enhanced is loaded ?

Tuxservices, Jeudy Nicolas
on 12/2/13, 11:21 AM

Ok now you can directly install this: https://www.openerp.com/apps/7.0/web_m2x_options/ (from openerp apps) this is the same module but released with community.

What browser do you use ?

Tuxservices, Jeudy Nicolas
on 12/2/13, 11:41 AM

@Nicolas JEUDY:

I have an error when I click on a "many2many" field in which i dont have any options parameter provided

ReferenceError: can_create is not defined

http://localhost:8069/web_m2x_options/static/src/js/form.js:189

Atchuthan - Technical Consultant, Sodexis Inc
on 12/3/13, 6:03 AM

Ok I will try to reproduce this error

Tuxservices, Jeudy Nicolas
on 12/3/13, 3:29 PM

@Nicolas JEUDY, Were you able to produce the error??... Am still waiting for your result eagerly...

Atchuthan - Technical Consultant, Sodexis Inc
on 12/5/13, 9:12 AM

Yes a propose a merge in community web-addons one day before and wait for review and approve. https://code.launchpad.net/~0k.io/web-addons/7.0_web_m2x_options_fix_can_create_2

This issue is ok in this revision / branch .. will be soon approved :)

Tuxservices, Jeudy Nicolas
on 12/5/13, 9:14 AM

Thanks for your quick response

Atchuthan - Technical Consultant, Sodexis Inc
on 12/5/13, 9:19 AM
5

Pawan

--Pawan--
1267
| 4 3 5
Hyderabad, India
--Pawan--


Pawan
On 2/13/15, 5:16 AM

Hi Boris,

U can try adding an attribute "options" to the field where u want to hide "create and edit" option in xml file as:

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

This will possibly solve your problem.

thanks

this feature is available for Odoo8 by default but not in Odoo 7.

Atchuthan - Technical Consultant, Sodexis Inc
on 2/13/15, 5:24 AM
2
semah
On 4/26/15, 10:04 AM

Hello all,

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.

>=8.0 works fine and its the best option.

Cristian Salamea
on 5/24/16, 11:00 PM
2
CHEBBAKI kader
On 9/23/13, 10:44 AM

How to install the web_m2o_enhanced addon ?

I put this to my xml view

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

But i always see the create edit link

Hello, are you shure you reload page after installing it and you have empty javascript cache ? This module work for many2one field, work must be done to many2many field ..

Tuxservices, Jeudy Nicolas
on 9/23/13, 3:47 PM

I refresh and upgrade the module many times. I also empty my browser cache . But i can always see the create/edit link

CHEBBAKI kader
on 9/24/13, 8:16 AM

The same here. The module seems not doing anything.

Bruno
on 10/26/13, 4:15 AM

We are in the same situation.

Elepe Servicios, Fabián De Luca
on 10/29/13, 5:45 PM

Hello,

Can you add a debugger in the get_search_result function in the static/src/js/form.js file ?

Tuxservices, Jeudy Nicolas
on 11/11/13, 4:22 PM

Hello,

can you add debugger in the static/src/js/form.js on the first line of get_search_result function ? If the code is load, and if you use debug mode, you have to be paused in debugger line .., else, the code is not load so, we have to find why :)

Tuxservices, Jeudy Nicolas
on 11/11/13, 4:26 PM

Hi, I'm getting the same result here; "create" "create and edit" links are shown on drop down menu. I'm in debug mode, added the breakpoint, but program is not paused there. Also if I click on "create" nothing happens...

Matjaz
on 11/12/13, 7:21 AM

Ok, I suppose you use the last version of OpenERP v7 ? I will check it out and test with a new database to see if it works. did you you to restart OpenERP server after intsalling module ?

Tuxservices, Jeudy Nicolas
on 11/12/13, 12:14 PM

Yes I'm on v7. Have tried every combination today, restarted server, de-install/install module, changed option parameters but no effect..

Matjaz
on 11/13/13, 4:56 AM

ok, on windows or linux ? I will try with standard V7

Tuxservices, Jeudy Nicolas
on 11/13/13, 5:07 AM

Linux - Firefox and Chromium

Matjaz
on 11/13/13, 5:12 AM

Hi elepe,

I install the module on a fresh openerp 7 instance. I reload, restart the server and all is working fine.

  • Can you double check that no other module inherit your view a remote your options ?
  • Can you paste the view you edit to see if I can help you. ?
Tuxservices, Jeudy Nicolas
on 11/15/13, 3:58 PM

Hello, I have updated your module, but still the same result. I have no idea what I'm doing wrong, so here is my view:

<record id="product_normal_form_view_intrastat" model="ir.ui.view"> <field name="name">product.normal.form.intrastat</field> <field name="model">product.product</field> <field name="inherit_id" ref="product.product_normal_form_view"/> <field name="arch" type="xml"> <field name="product_manager" position="after"> <field name="intrastat_id" options="{'create': false, 'create_edit': false}"/> </field> </field> </record>

Matjaz
on 11/18/13, 5:46 AM

I will check on my install to see what is wrong .. I think this view is update by an other after your mods. you use a personnal module ? can you say where you define intrastat_id ? Can you check on an other field that this works ? Can you check in debug mode and using your browser debug tools that web_m2o_enahnced js is correctly load ?

Tuxservices, Jeudy Nicolas
on 11/18/13, 7:25 PM

Same here...

&lt;field name="default_payprofile_id" options='{"no_open": True, "create":False, "create_edit": False}' /&gt;

Atchuthan - Technical Consultant, Sodexis Inc
on 12/2/13, 11:18 AM
0
Christian Werner
On 12/5/13, 6:40 AM

Hello,

after installing the module, I get the following error on m2m fields with widget="many2many_tags"

Uncaught ReferenceError: can_create is not defined

For m2o fields all works fine.

problem resolved in this link: https://code.launchpad.net/~0k.io/web-addons/7.0_web_m2x_options_fix_can_create_2 (more detail available at 1st answer's comment)

Atchuthan - Technical Consultant, Sodexis Inc
on 2/13/15, 5:23 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

5 follower(s)

Stats

Asked: 3/28/13, 7:16 AM
Seen: 20332 times
Last updated: 10/6/15, 7:52 AM