## 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
if procurement.rule_id.action == 'buy' and procurement.purchase_line_id:
            purchase_line_obj = self.pool.get('purchase.order.line')
            if procurement.purchase_line_id.state not in ('draft', 'cancel'):
                    raise osv.except_osv(_('Error!'),
                        _('Can not cancel this procurement as the related purchase order has been confirmed already.  Please cancel the purchase order first. '))
            new_qty, new_price = self._calc_new_qty_price(cr, uid, procurement, cancel=True, context=context)
            if new_qty != procurement.purchase_line_id.product_qty:
                purchase_line_obj.write(cr, uid, [procurement.purchase_line_id.id], {'product_qty': new_qty, 'price_unit': new_price}, context=context)
            if float_compare(new_qty, 0.0, precision_rounding=procurement.product_uom.rounding) != 1:
                purchase_line_obj.action_cancel(cr, uid, [procurement.purchase_line_id.id], context=context)
                purchase_line_obj.unlink(cr, uid, [procurement.purchase_line_id.id], context=context)
        return super(procurement_order, self).propagate_cancel(cr, uid, procurement, context=context)
    def _run(self, cr, uid, procurement, context=None):
        if procurement.rule_id and procurement.rule_id.action == 'buy':
            
            return self.make_po(cr, uid, [procurement.id], context=context)[procurement.id]
        return super(procurement_order, self)._run(cr, uid, procurement, context=context)
    def _check(self, cr, uid, procurement, context=None):
        if procurement.purchase_line_id:
            if procurement.purchase_line_id.order_id.shipped:
                return True
            elif procurement.move_ids:
                moves = self.pool.get('stock.move').browse(cr, uid, [x.id for x in procurement.move_ids], context=context)
                return all(move.state == 'done' for move in moves)
        return super(procurement_order, self)._check(cr, uid, procurement, context=context)
    def _check_supplier_info(self, cr, uid, ids, context=None):