Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
4927 Vues

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
Ignorer
Meilleure réponse

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
Ignorer
Auteur Meilleure réponse

Thanks a lot! that was the right answer! 

Avatar
Ignorer
Publications associées Réponses Vues Activité
2
déc. 17
16955
0
avr. 15
3979
1
mars 15
9525
1
déc. 24
1611
0
juin 19
3812