Odoo Help

0

how create a new selection field with option to create another contained in this field

By
kizayko
on 4/1/13, 1:19 PM 1,421 views

hi to all I want to create a new field type "selection". there is the same example in the stock module product is the category selection list,, how to do?? Thanks

You need to give some more details on what you want to accomplish. Please put in the module and field you want to edit along with the version of openERP you are using.

AJ Schrafel Paper Corp
on 4/1/13, 1:44 PM
0
Naresh Soni (nch)
On 4/1/13, 1:51 PM

Hello Kizayko,

Syntax for creating selection field is

selection(values, string, ...)

values: list of values (key-label tuples) or function returning such a list

For creating dynamic values in the selection. You can add a function like :

fields.selection(_get_selection,'myselection')

then you can define this function as:

def _get_selection(self, cr, uid, context=None):

 """ Your logic to get the values """

return[(key1,value1),(key2,value2)]

Hope this helps !

Thanks, Naresh

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

Question tools

0 follower(s)

Stats

Asked: 4/1/13, 1:19 PM
Seen: 1421 times
Last updated: 3/16/15, 8:10 AM