Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
3483 Näkymät

how to pass value to reference field from code?

Avatar
Hylkää
Paras vastaus

HI,

The field value is .

Reference field Basically stored as a :class:`string ` following the pattern "res_model,res_id" in the database. It Display as the selection . If you want to pass the value to the reference field, then you have to pass the formation value in the field where the first argument is the record model and second argument will be the id of that model.
Like:

    reference_record = '%s,%s' % (res_model, res_id)

    reference_field_record = '%s,%s' % ('ir.actions.act_window', 11)

Hope it will help you.
Thanks.

Avatar
Hylkää
Tekijä Paras vastaus

thanks, i also know that _name return the model name :)

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
heinäk. 22
4458
3
jouluk. 21
4204
3
heinäk. 23
5599
2
maalisk. 24
5598
1
marrask. 22
5377