Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
3631 มุมมอง

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 :)

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ค. 22
4587
3
ธ.ค. 21
4346
3
ก.ค. 23
5717
2
มี.ค. 24
5727
1
พ.ย. 22
5533