Created on 2022-05-13.00:01:09 by ced, last changed 3 weeks ago by roundup-bot.
New changeset b5babfb92919 by Cédric Krier in branch 'default': Do not skip eager load for field in cache but depending on non-cached fields https://hg.tryton.org/tryton-env/rev/b5babfb92919
New changeset 3695d028b14f by Cédric Krier in branch 'default': Do not skip eager load for field in cache but depending on non-cached fields https://hg.tryton.org/trytond/rev/3695d028b14f
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.
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-06-08 09:22:11 | roundup-bot | set | messages: + msg77010 |
2022-06-08 09:22:07 | roundup-bot | set | messages:
+ msg77009 nosy: + roundup-bot status: testing -> resolved |
2022-05-13 00:18:30 | reviewbot | set | messages:
+ msg76618 nosy: + reviewbot |
2022-05-13 00:03:25 | ced | set | keyword:
+ review reviews: 419131003 status: in-progress -> testing |
2022-05-13 00:01:09 | ced | create |
Showing 10 items. Show all history (warning: this could be VERY long)