odoo/openerp/osv
Olivier Dony b7865502e4 [FIX] orm.browse_record: access error due to prefetch of indirectly referenced records (OPW #596679)
The browse_record prefetching algorithm attempts to
load data for all known records from the requested
model (i.e. all IDs present in the browse cache),
regardless of how indirectly/remotely they were
referenced. An indirect parent record may therefore
be prefetched along with its directly browsed children,
possibly crossing company boundaries involuntarily.

This patch implements a fallback mechanism when
the prefetching failed due to what looks like an
ACL restriction. This being a fuzzy concept at the
moment, it does its best to only catch a restricted
set of exceptions, and retry loading the data for
the directly requested ID only.

This may cause a small performance penalty in case
of real errors (with some spurious logging too),
but should only be triggered in very few cases.

The downside when this happens is that the prefetching for that
model gets effectively disabled, requiring multiple
SQL queries for further access to the data of
the other directly browsed records.

This EAFP approach seems safer and faster than
a LBYL technique where we would have to filter
all indirect m2o references according to ACLs
before allowing them to enter the cache.

lp bug: https://launchpad.net/bugs/1238042 fixed
lp bug: https://launchpad.net/bugs/1212429 fixed

bzr revid: odo@openerp.com-20131120100627-031fljyf4ckprc9b
2013-11-20 11:06:27 +01:00
..
__init__.py API docs: settings file and titles at modules 2011-06-23 12:03:57 +03:00
expression.py [FIX] expression: a valid leaf must have a non empty string as first element or be the magic TRUE_LEAF/FALSE_LEAF 2013-07-19 11:19:03 +02:00
fields.py [FIX] allow falsy extra attributes on fields. 2013-10-24 15:54:48 +02:00
orm.py [FIX] orm.browse_record: access error due to prefetch of indirectly referenced records (OPW #596679) 2013-11-20 11:06:27 +01:00
osv.py [FIX] *: fix/rationalize db logging to avoid incorrect values during logging 2013-03-01 13:07:44 +01:00
query.py [REM] unnecessary parens 2012-12-14 13:38:03 +01:00