parameters: (self)
return_statement: return res
docstring: Override unlink to delete messages and followers. This cannot be
          cascaded, because link is done through (res_model, res_id).
docstring_summary: Override unlink to delete messages and followers. This cannot be
          cascaded, because link is done through (res_model, res_id).
docstring_tokens: Override unlink to delete messages and followers . This cannot be cascaded because link is done through ( res_model res_id ) .
function: 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
function_tokens: 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