(self)
return res
Override unlink to delete messages and followers. This cannot be
        cascaded, because link is done through (res_model, res_id).
Override unlink to delete messages and followers. This cannot be
        cascaded, because link is done through (res_model, res_id).
Override unlink to delete messages and followers . This cannot be cascaded because link is done through ( res_model res_id ) .
def unlink(self):
        """ Override unlink to delete messages and followers. This cannot be
        cascaded, because link is done through (res_model, res_id). """
        if not self:
            return True
        # discard pending tracking
        self._discard_tracking()
        self.env['mail.message'].search([('model', '=', self._name), ('res_id', 'in', self.ids)]).sudo().unlink()
        res = super(MailThread, self).unlink()
        self.env['mail.followers'].sudo().search(
            [('res_model', '=', self._name), ('res_id', 'in', self.ids)]
        ).unlink()
        return res
def unlink ( self ) : if not self : return True # discard pending tracking self . _discard_tracking ( ) self . env [ 'mail.message' ] . search ( [ ( 'model' , '=' , self . _name ) , ( 'res_id' , 'in' , self . ids ) ] ) . sudo ( ) . unlink ( ) res = super ( MailThread , self ) . unlink ( ) self . env [ 'mail.followers' ] . sudo ( ) . search ( [ ( 'res_model' , '=' , self . _name ) , ( 'res_id' , 'in' , self . ids ) ] ) . unlink ( ) return res