## Impacted versions:
 8.0 / 9.0 / 10.0
## Steps to reproduce:
* see https://github.com/odoo/odoo/issues/11841
* in a shell
  1. create an in memory record `order = self.env['purcahse.order'].new({....})`
  2. create an in memory record with a reference to the first one `order_line = self.env['purchase.order.line'].new({'order_id': order, ....})`
  3. order_line.order_id is an in memory recordset
  4. create a record for a model that inherits from mail.thread `self.env['product.product'].create({....})`
  5. At this stage order_line.order_id is an empty recordset

## Current behavior:
 In memory records are dropped when a call is done to self.invalidate_cache
## Expected behavior:
In memory records are preserved when a call is done to self.invalidate_cache


There are lot of places where the method `invalidate_cache` is called and the silent removal of the in memory records from all environments has unpredictable effects on fields modified by a computed method or an onchange or even related fields .... Moreover since all caches are invalidated each time you create / write / unlink  (https://github.com/odoo/odoo/blob/10.0/addons/mail/models/mail_followers.py#L111) an instance of a model that inherits from 'mail.thread', the performances of the server are severely penalized.

OPW703903

addons/mail/tests/test_mail_features.py
mail_mail_id = self.mail_mail.create(cr, uid, {'model': 'mail.group', 'res_id': group_pigs.id})
        mail = self.mail_mail.browse(cr, uid, mail_mail_id)
        url = mail_mail._get_partner_access_link(self.mail_mail, cr, uid, mail, partner=partner_raoul)
        self.assertIn(base_url, url,
                      'notification email: link should contain web.base.url')
        self.assertIn('db=%s' % cr.dbname, url,
                      'notification email: link should contain database name')
        self.assertIn('action=mail.action_mail_redirect', url,
                      'notification email: link should contain the redirect action')
        self.assertIn('login=%s' % partner_raoul.user_ids[0].login, url,
                      'notification email: link should contain the user login')
        self.assertIn('model=mail.group', url,
                      'notification email: link should contain the model when having not notification email on a record')
        self.assertIn('res_id=%s' % group_pigs.id, url,
                      'notification email: link should contain the res_id when having not notification email on a record')
        
        mail_mail_id = self.mail_mail.create(cr, uid, {'notification': True, 'model': 'mail.group', 'res_id': group_pigs.id})
        mail = self.mail_mail.browse(cr, uid, mail_mail_id)
        url = mail_mail._get_partner_access_link(self.mail_mail, cr, uid, mail, partner=partner_raoul)
        self.assertIn(base_url, url,
                      'notification email: link should contain web.base.url')
        self.assertIn('db=%s' % cr.dbname, url,
                      'notification email: link should contain database name')
        self.assertIn('action=mail.action_mail_redirect', url,
                      'notification email: link should contain the redirect action')
        self.assertIn('login=%s' % partner_raoul.user_ids[0].login, url,
                      'notification email: link should contain the user login')
        self.assertIn('message_id=%s' % mail.mail_message_id.id, url,
                      'notification email: link based on message should contain the mail_message id')