This question has been flagged
12 Replies
9819 Views

i created a module in openerp it have textbox, dropdown list etc for adding the student details. so iwant to add a radio button field to that form.

i just add the following line in python code.

'rd':fields.radio([('state','State'),('cbse','CBSE')],'Syllabus',required=True), 'rd':fields.radiobutton([('state','State'),('cbse','CBSE')],'Syllabus',required=True),

but in the first case in the form displays a dropdown list.

The line on the xml view is given below.

<field name="rd"/>

and also try this <field name="rd" widget="radio"/>

please give suggestion to me..

Avatar
Discard
Best Answer

Why don't u use one2many field or a selection and let them choose from a Dropdown list. This give the same functionality. Radiobuttons are not implemented so far as I know.

Avatar
Discard
Author

ok i will use the selection instead of it.. Thanks for your answer....

can i use selection widget for many value..example: I need 21 values that fit in one selection..is it possible?because I have tried other widget llike one2many but it can't solve my problem..I only can do with selection

Best Answer

There is no radio button widget in v7, but you can add it using widget="radio" attribute.

First you create your own widget [like selection widget] then add python code: 'syllabus': fields.selection([('state','State'),('cbse','CBSE')],'Syllabus'), and add XML code: <field name="syllabus" widget="radio"/>

The radio widget is available in trunk branch.

Avatar
Discard
Best Answer

In OpenERP the radiobutton function is simuleted by a selection field. If you need to choose only one value in between some values you can use selection, if you want select more values there are booleans fields. Why you need radiobutton?

Avatar
Discard
Author

ok i will use the selection insted of it .. Thanks for your reply..

If this answer is the correct one, please set it as correct with the green circle near the answer text. So, you can help future user with the some problem

All Answers are correct. ;)

can i use selection widget for many value..example: I need 21 values that fit in one selection..is it possible?because I have tried other widget..it can't solve my problem..I only can do with selection

Best Answer

There is no radio button widget in v7, only drop down widget for both selection and many2one fields. However, in v8, there will be a new radio button widget that can be used in view using widget="radio" attribute.

The new radio widget is available now in trunk branch but there is no estimated release date yet for v8. I think it will be somewhere in 2014.

Avatar
Discard
Best Answer

You can see this link where you can use it to make a radio button widget in openerp.

http://stackoverflow.com/questions/22612080/openerp-view-change-look-of-selection-field-aka-radio-button

if you want the module for free, kindly send your email to me at (engmohamans@gmail.com) .

 

 

 

Avatar
Discard