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

how to pass value to reference field from code?

形象
丢弃
最佳答案

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.

形象
丢弃
编写者 最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
2
7月 22
4594
3
12月 21
4362
3
7月 23
5721
2
3月 24
5732
1
11月 22
5546