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