Odoo Help

0

Why is this Selection method not working?

By
Phillip
on 4/20/15, 10:28 AM 651 views

I am trying to define a selection method. I have created a method that outputs the exact values I need.

    list = [(2, 'John Smith'), (3, 'Jill Smith')]

If I use the following return statement 

    return [(2, 'John Smith'), (3, 'John Smith')]

EVERYTHING WORKS!!!! A perfectly displayed selection field.

When I use 

    return list

I dont get any errors however I get no selection values in my drop down.

CODE BELOW

###############################################

                    WORKS

###############################################

@api.model

def _selection_method(self):

    some stuff

    return [(2, 'John Smith'), (3, 'John Smith')]

############################################

                     FAILS

############################################

@api.model

def _selection_method(self):

some stuff

     list = [(2, 'John Smith'), (3, 'John Smith')]

return list

#############################################

This is my selection field

selected_object = fields.Selection('_selection_method', string="Some String")


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

1 follower(s)

Stats

Asked: 4/20/15, 10:28 AM
Seen: 651 times
Last updated: 4/20/15, 10:28 AM