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

For example i have 2 models. 

One2many is relation goes to another model. in create method how to get the id of record.

####

example

record_set_partner = self.env['res.partner'].browse(vals['partner_id'])

this statement get the id of res.partner.How to get the id based on one2many field.

i tried like this 

internal_activities_record = self.env['lmc.phone'].browse(vals['tasks_ids'])

But get an error unhaustable type 'list'

Notes

please help me how to solve this issue.Thanks in advance



อวตาร
ละทิ้ง

format for self.browse is self.env['res.partner'].browse([1,4]).

Plz check if vals['task_ids'] is in this format

คำตอบที่ดีที่สุด

internal_activities_record = vals['task_ids']

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi Muhammed Aslam,

Hope below code help you.

new_task_id = []

for task_id in vals['tasks_ids']:

      task_id.append(task_id.id)

if new_task_id:

    internal_activities_record = self.env['lmc.phone'].browse(new_task_id)

 Best Thanks,

Ankit H Gandhi.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 18
11471
1
ก.ย. 22
2186
2
เม.ย. 20
4106
4
พ.ค. 18
11114
1
พ.ย. 17
3815