I wanna asked why it delete all the Done(True) users in this code, it inherits the function from the parent module and override the function. I thought the function of child module will only delete the current user
====Child Module====
# -*- coding: utf-8 -*-
from odoo import fields,models,api
class TodoTask(models.Model):
_inherit = 'todo.task'
name = fields.Char(help='What needs to be done?')
user_id = fields.Many2one('res.users','Responsible')
date_deadline = fields.Date('Deadline')
@api.multi
def do_clear_done(self):
domain = [('is_Done', '=', True),
'|', ('user_id', '=', self.env.uid),
('user_id', '=', False)]
dones = self.search(domain)
dones.write({'active': False})
return True
====Parent Module====
# -*- coding: utf-8 -*-
from odoo import models,fields,api
class TodoTask(models.Model):
_name = 'todo.task'
_descrption = 'To-Do Task'
name = fields.Char('Description' , required=True)
is_Done = fields.Boolean('Done?')
active = fields.Boolean('Active?',default=True)
@api.multi
def do_toggle_done(self):
for task in self:
task.is_Done = not task.is_Done
return True
@api.multi
def do_clear_done(self):
dones = self.search([('is_Done','=',True)])
dones.write({'active':False})
return True
Thank u in advance :)