account_statement_base_completion: useless query
Bug #1287708 reported by
Guewen Baconnier @ Camptocamp
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Banking Addons |
New
|
Undecided
|
Guewen Baconnier @ Camptocamp |
Bug Description
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.
To post a comment you must log in.
Hmm in fact it is set. In the method itself:
# We memoize allowed partner get('partner_ memoizer' ):
context[ 'partner_ memoizer' ] = tuple(self. pool['res. partner' ].search( cr, uid, [])) 'partner_ memoizer' ]:
if not context.
if not context[
return res
But I have some doubt on the efficiency of such a thing as anyway it always searches all the ids.