Odoo Help


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.


Explanation about widget="selection" [Closed]

on 4/17/13, 6:44 AM 5,766 views

The Question has been closed

Sudhir Arya (SA)
on 04/18/2013 05:08:34

I need to know what is the actual scenario with widget option in OpenERP 7. is it works as readonly field when we use it in form views ?

i used it in my one of form.when i save records in form, that widget values are not saved.

<field name="job_position" placeholder="Finance Manager" widget="selection" />

Sudhir Arya (SA)

--Sudhir Arya (SA)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow




Sudhir Arya (SA)
On 4/17/13, 7:03 AM

widget="selection" is used with many2one field. That field become selection field & user cannot change its value.

When you open many2one field without widget, you can see tree,form view but with widget there is no tree,form view. It will be selection only.

ok Arya thanks..I got it thatswhy its not shows in my Tree view .? but when i checked in my tables also its not saved

on 4/17/13, 7:08 AM

Priyesh Solanki (pso)

--Priyesh Solanki (pso)--
Tiny ERP Pvt Ltd
| 2 2 4
--Priyesh Solanki (pso)--
Priyesh Solanki (pso)
On 4/17/13, 7:24 AM

widget="selection" means it will show all the records of position(many2one) in the selection box. It means if you do not want any user to edit/modify it's record, widget="selection" is useful.

Regarding your issue, issue is due to placeholder attribute, that you used. Place holder will display that value in selection box which may not store in your many2one table and that's why while saving the record, value disappears. Try by removing placeholder over there. If you want any value by default in selection , use _defaults attribute in class.

Thanks, Priyesh Solanki

thanks Priyesh..its really helpful tip :-)

on 4/17/13, 7:42 AM

In openerp 7 many2one search field default shows 8 record. How to increase the default value size to 20? (in the selection widget shows all record with out search condition) is any other way to increase search record

on 9/6/13, 7:03 AM

Francesco OpenCode

--Francesco OpenCode--
| 5 7 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 4/17/13, 7:08 AM

When you set a many2one field with the tag selection, it become a selection with dymamic values get from many2one relative table. This is usefull if you wantshow values that user can't modify. The selection widget tag is used only with many2one.

yeah..it means we cannot use it in form view to save records by that widget ?

on 4/17/13, 7:18 AM

Yes, you can use it like a normal selection. The only difference between m2o and m2o with selection is that the frist one is editable and searchble, the second one no.

Francesco OpenCode
on 4/17/13, 7:20 AM

About This Community

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

Question tools

1 follower(s)


Asked: 4/17/13, 6:44 AM
Seen: 5766 times
Last updated: 3/16/15, 8:10 AM