Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3881 Lượt xem

I need to find for example all projects that have tasks.

task_ids = fields.One2Many('project.task', 'project_id')

Like: search([('task_ids', '>', 0)])?

Is there a way to do that or do I have to get tasks and then loop trough them to get project ids?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất
task_ids","!=",False
Ảnh đại diện
Huỷ bỏ

you can do this but many ways to do it

either you can these ways that i know:

for rec in self:

if rec.task_ids:

#statement

or self.search([('task_ids', '!=', False)])

Tác giả

Thanks it works!

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 12 22
16357
1
thg 9 22
2252
1
thg 4 20
142
1
thg 6 19
4285
1
thg 11 18
2886