Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
4942 Zobrazení

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?


Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Autor Nejlepší odpověď

Thanks a lot! that was the right answer! 

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
pro 17
16988
0
dub 15
4005
1
bře 15
9565
1
pro 24
1633
0
čvn 19
3828