Odoo Help

Welcome!

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.

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

--Naresh Soni (nch)--
Tiny ERP Pvt Ltd
http://www.odoo.com
1281
| 2 2 4
India
--Naresh Soni (nch)--

Team Lead, Odoo(Formerly OpenERP) Support & OPW

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

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

Question tools

0 follower(s)

Stats

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