Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
4932 Vizualizări

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?


Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Autor Cel mai bun răspuns

Thanks a lot! that was the right answer! 

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
dec. 17
16958
0
apr. 15
3983
1
mar. 15
9534
1
dec. 24
1615
0
iun. 19
3815