This question has been flagged
45 Replies
80733 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

Avatar
Discard

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 ?

Author

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/

Add widget="selection"

Best Answer

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

Avatar
Discard

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

Best Answer

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/
Avatar
Discard
Author

thanks so much dear Nicolas

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, m2o_dialog option do this. set it to false and no dialog box will appear if many2one value does not existe.

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!

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?

Yes, you CAN use no_open options and SET to false

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.

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

How to install web_m2o_enhanced module .

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 ?

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

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 ?

@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

Ok I will try to reproduce this error

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

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

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

Best Answer

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.

Avatar
Discard

>=8.0 works fine and its the best option.

Best Answer

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

Avatar
Discard

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

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

The same here. The module seems not doing anything.

We are in the same situation.

Hello,

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

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

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

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 ?

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

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

Linux - Firefox and Chromium

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

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>

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 ?

Same here...

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

Best Answer

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.

Avatar
Discard
Best Answer

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.

Avatar
Discard

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)