Anastasia_
Anastasia_

Reputation: 299

Populate selection field from loop odoo 9

How populate selection field from loop?

Example:

date = fields.Selection([],string='Date')

list = []

for i in diff:
    print(i)  #return 07:00


self.date = list

Upvotes: 1

Views: 321

Answers (1)

You can get selection field key,value pair via following method.

    result=self.env[model].fields_get([field_name])
    key=False
    if result and result.get(field_name) and result.get(field_name).get('selection'):
        for dict_value in result.get(field_name).get('selection'):
            print dict_value

This may help you.

Upvotes: 0

Related Questions