Odoo Help

6

14
45 Answers
20
Avatar

Jeudy Nicolas

--Jeudy Nicolas--

1231
| 6 8 10
Pelousey, Frankrijk
--Jeudy Nicolas--

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

Jeudy Nicolas
25-05-13 10:31

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
26-05-13 03:35

thanks so much dear Nicolas

Paul Catinean
27-05-13 09:44

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
28-05-13 11:03

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

Paul Catinean
29-05-13 04:25

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
29-05-13 05:40

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
29-05-13 14:48

Yes, you CAN use no_open options and SET to false

Tuxservices, Jeudy Nicolas
30-05-13 15:15

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
30-05-13 15:19

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

CHEBBAKI kader
23-09-13 10:43

How to install web_m2o_enhanced module .

Tuxservices, Jeudy Nicolas
02-12-13 11:19

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
02-12-13 11:21

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

Tuxservices, Jeudy Nicolas
02-12-13 11:41

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
03-12-13 06:03

@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
03-12-13 15:29

Ok I will try to reproduce this error

Atchuthan - Technical Consultant, Sodexis Inc
05-12-13 09:12

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

Tuxservices, Jeudy Nicolas
05-12-13 09:14

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
05-12-13 09:19

Thanks for your quick response

Akhil P Sivan
04-02-17 02:59

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

9
Avatar

Pawan

--Pawan--

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


Pawan
13-02-15 05:16

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 Opmerking
Atchuthan - Technical Consultant, Sodexis Inc
13-02-15 05:24

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

6
semah
26-04-15 10:04

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 Opmerking
AYNI CONSULTORES 1792538289001
24-05-16 23:00

>=8.0 works fine and its the best option.

2
CHEBBAKI kader
23-09-13 10:44

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
23-09-13 15:47

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
24-09-13 08:16

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

Bruno
26-10-13 04:15

The same here. The module seems not doing anything.

Elepe Servicios, Fabián De Luca
29-10-13 17:45

We are in the same situation.

Tuxservices, Jeudy Nicolas
11-11-13 16:22

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 16:26

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
12-11-13 07:21

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
12-11-13 12:14

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
13-11-13 04:56

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
13-11-13 05:07

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

Matjaz
13-11-13 05:12

Linux - Firefox and Chromium

Tuxservices, Jeudy Nicolas
15-11-13 15:58

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
18-11-13 05:46

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
18-11-13 19:25

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
02-12-13 11:18

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

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

Learning Python..

Ankit H Gandhi(AHG)
25-05-17 07:01

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
05-12-13 06:40

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 Opmerking
Atchuthan - Technical Consultant, Sodexis Inc
13-02-15 05:23

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)

Stel een vraag
Writer
Labels
Keep Informed
6 volger(s)
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