'Invalidate the record caches after some records have been modified.
If both ``fnames`` and ``ids`` are ``None``, the whole cache is cleared.
:param fnames: the list of modified fields, or ``None`` for all fields
:param ids: the list of modified record ids, or ``None`` for all'

@api.model
def invalidate_cache(self, fnames=None, ids=None):

    if (fnames is None):
        if (ids is None):
            return self.env.invalidate_all()
        fields = self._fields.values()
    else:
        fields = map(self._fields.__getitem__, fnames)
    spec = ([(f, ids) for f in fields] + [(invf, None) for f in fields for invf in self._field_inverses[f]])
    self.env.invalidate(spec)
