跳至内容
菜单
此问题已终结
2 回复
4936 查看

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! 

形象
丢弃
相关帖文 回复 查看 活动
2
12月 17
16961
0
4月 15
3985
1
3月 15
9536
1
12月 24
1615
0
6月 19
3817