Skip to Content
Menu
This question has been flagged
1 Reply
1396 Views

I want only to receive all records, which have tasks for my person and the tasks are open. I've tried:

self.env['mymodel.todolist'].search([ ('entires.user_id', '=', self._uid), ('entries.completed', '=', False) ])

but then I've got each todo list, which I have entries on and entries of another users are open.

This is the model for the example:

from odoo import models, fields

class TodoList(models.Model):
_name = 'mymodel.todolist'

name = fields.Char(string='Name', required=True)
entries = fields.One2many('mymodel.todolist.entry', 'todolist_id', string='Entires')

class TodoListEntry(models.Model):
_name = 'mymodel.todolist.entry'

name = fields.Char(string='Name', required=True)
todolist_id = fields.Many2one('mymodel.todolist', string='Todo List', required=True, ondelete="restrict")
user_id = fields.Many2one('res.users', string='Field Worker', ondelete="restrict")
completed = fields.Boolean('Completed')


Avatar
Discard
Best Answer

If you want we can help you do the customization but we need to know the model definition, etc properly. Just looking at that line we cannot answer your question.

Avatar
Discard
Author

No problem. I have added the model definition to my initial post.