## 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/purchase/purchase.py
''' Check the supplier info field of a product and write an error message on the procurement if needed.
        Returns True if all needed information is there, False if some configuration mistake is detected.
        '''
        partner_obj = self.pool.get('res.partner')
        user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
        for procurement in self.browse(cr, uid, ids, context=context):
            message = ''
            partner = procurement.product_id.seller_id 
            if not procurement.product_id.seller_ids:
                message = _('No supplier defined for this product !')
            elif not partner:
                message = _('No default supplier defined for this product')
            elif not partner_obj.address_get(cr, uid, [partner.id], ['delivery'])['delivery']:
                message = _('No address defined for the supplier')
            if message:
                if procurement.message != message:
                    cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id))
                return False
            if user.company_id and user.company_id.partner_id:
                if partner.id == user.company_id.partner_id.id:
                    raise osv.except_osv(_('Configuration Error!'), _('The product "%s" has been defined with your company as reseller which seems to be a configuration error!' % procurement.product_id.name))
        return True
    def create_procurement_purchase_order(self, cr, uid, procurement, po_vals, line_vals, context=None):