The key 'partner_memoizer' is never set in the context, so a search on all the partners is always executed.
Then, the full list of IDs is used in the next query in "WHERE id IN %s" which is really inefficient.
I guess this is dead code and propose to remove it completely.
If someone claims that there is a reason to have this key in the context (used by another module I may be unaware of), then the former search is still useless as we already know the IDs.
In all cases, a search should be done to apply the record rules, but *after* the big query so it will be done only on a subset of a few IDs.
See: bazaar. launchpad. net/~banking- addons- team/banking- addons/ bank-statement- reconcile- 70/view/ head:/account_ statement_ base_completion /statement. py#L317
http://
The key 'partner_memoizer' is never set in the context, so a search on all the partners is always executed.
Then, the full list of IDs is used in the next query in "WHERE id IN %s" which is really inefficient.
I guess this is dead code and propose to remove it completely.
If someone claims that there is a reason to have this key in the context (used by another module I may be unaware of), then the former search is still useless as we already know the IDs.
In all cases, a search should be done to apply the record rules, but *after* the big query so it will be done only on a subset of a few IDs.