Odoo Help

5
45 Answers
20
Avatar

Jeudy Nicolas

--Jeudy Nicolas--

1231
| 6 8 8
Pelousey, France
--Jeudy Nicolas--

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

Jeudy Nicolas
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/
18 Comments
priyankahdp
5/26/13, 3:35 AM

thanks so much dear Nicolas

Paul Catinean
5/27/13, 9:44 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

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

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

Paul Catinean
5/29/13, 4:25 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
5/29/13, 5:40 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?

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

Yes, you CAN use no_open options and SET to false

Tuxservices, Jeudy Nicolas
5/30/13, 3:15 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
5/30/13, 3:19 PM

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

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

How to install web_m2o_enhanced module .

Tuxservices, Jeudy Nicolas
12/2/13, 11:19 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
12/2/13, 11:21 AM

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

Tuxservices, Jeudy Nicolas
12/2/13, 11:41 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 ?

Atchuthan - Technical Consultant, Sodexis Inc
12/3/13, 6:03 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

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

Ok I will try to reproduce this error

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

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

Tuxservices, Jeudy Nicolas
12/5/13, 9:14 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 :)

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

Thanks for your quick response

Akhil P Sivan
2/4/17, 2:59 AM

Is it possible to pass conditions like, options= {'no_create':[('name','=','Akhil')]} ?

9
Avatar

Pawan

--Pawan--

1532
| 4 4 6
Hyderabad, India
--Pawan--


Pawan
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

1 Comment
Atchuthan - Technical Consultant, Sodexis Inc
2/13/15, 5:24 AM

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

5
semah
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.

1 Comment
AYNI CONSULTORES 1792538289001
5/24/16, 11:00 PM

>=8.0 works fine and its the best option.

2
CHEBBAKI kader
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

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

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 ..

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

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

Bruno
10/26/13, 4:15 AM

The same here. The module seems not doing anything.

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

We are in the same situation.

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

Hello,

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

Tuxservices, Jeudy Nicolas
11/11/13, 4:26 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 :)

Matjaz
11/12/13, 7:21 AM

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...

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

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 ?

Matjaz
11/13/13, 4:56 AM

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

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

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

Matjaz
11/13/13, 5:12 AM

Linux - Firefox and Chromium

Tuxservices, Jeudy Nicolas
11/15/13, 3:58 PM

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. ?
Matjaz
11/18/13, 5:46 AM

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>

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

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 ?

Atchuthan - Technical Consultant, Sodexis Inc
12/2/13, 11:18 AM

Same here...

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

0
Avatar

Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--

1334
| 6 5 6
Baroda, India
--Ankit H Gandhi(AHG)--

Learning Python..

Ankit H Gandhi(AHG)
5/25/17, 7:01 AM

Hello priyankahdp,

Please use below code.

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

or

<attribute name="widget">selection</attribute>

I hope this help you.

Best Thanks,

Ankit H Gandhi.

0
Christian Werner
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.

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

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)

Ask a Question
Writer
Tags
About This Community

This platform 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.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now