Message 76617

Message id


A common pattern is to access a Many2One with a context (ex: account on account.move.line with the company set in the context).
The ModelStorage.__getattr__ is not efficient because if the Many2One is already in the _cache then it skip eager load. But indeed it will need to also read the fields in the context which may not be in the _cache (ex: the company of account.move.line which is a Function field). In this case we re-read one by one the field and the context fields if at least one is not in _cache (ex: company of account.move.line).

For me we should skip eager loading only if the accessed field has no context (and neither the datetime field).
Also we should filter out only sibling ids if all the read fields are not in any of the transaction and local cache.
This way we make an extra read but for all the siblings at once instead of one by one and we instantiate all the Many2One at once and store them in the local cache.

Date User Action Args
2022-05-13 00:01:09cedsetmessageid: <>
2022-05-13 00:01:09cedlinkissue11481 messages
2022-05-13 00:01:09cedcreate