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

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.

形象
丢弃
相关帖文 回复 查看 活动
1
3月 18
11360
1
9月 22
2150
2
4月 20
4069
4
5月 18
11019
1
11月 17
3763