Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
4880 Переглядів

I have some selection field such as: 

salutation = fields.Selection(

        [('Mr.','Mr.'),

         ('Mrs.','Mrs.'), 

         ('Ms.','Ms.')],

        string='Salutation')


Now I want to add demo data in a record for this field, but I can't find the right syntax. I've tried used eval, but without success. 


<record id="object0" model="my.model">

    <field name="salutation" eval="[('Mr.','Mr.')]"/>

</record>

 


Can anyone give me a hint?


Аватар
Відмінити
Найкраща відповідь

Hi,
You can simply set value for a selection field as follows.

<record id="object0" model="my.model">
<field name="salutation">Mr.</field>
</record

in your case both values are 'Mr.'. selection field always store the 1st element of the tuple. I hope it will help.
Regards

Аватар
Відмінити
Автор Найкраща відповідь

Thanks a lot! that was the right answer! 

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
груд. 17
16886
0
квіт. 15
3909
1
бер. 15
9464
1
груд. 24
1549
0
черв. 19
3790