[IMP] l10n_latam_check_ux: optimize partner credit calculation with read_group#855
Open
rov-adhoc wants to merge 2 commits intoingadhoc:18.0from
Open
[IMP] l10n_latam_check_ux: optimize partner credit calculation with read_group#855rov-adhoc wants to merge 2 commits intoingadhoc:18.0from
rov-adhoc wants to merge 2 commits intoingadhoc:18.0from
Conversation
…ead_group Replace multiple search queries with a single read_group operation in res.partner._credit_debit_get() method. Previously, the method executed one search query per partner with add_check_credit enabled, resulting in N queries when processing multiple partners. Now uses read_group to aggregate check amounts in a single database query, storing results in a dictionary for O(1) lookup. This significantly improves performance when calculating credit for multiple partners simultaneously.
Contributor
There was a problem hiding this comment.
Pull request overview
Este PR optimiza el cálculo de crédito de partners reemplazando múltiples queries individuales por una única operación read_group. La mejora de performance es significativa cuando se procesan múltiples partners simultáneamente.
Cambios principales:
- Reemplazo de N queries (una por partner con
add_check_credit) por una sola query agregada - Uso de
read_groupcon agregaciónamount:sumagrupada porpartner_id - Implementación de diccionario para lookup O(1) de los montos por partner
…in foreight currency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Replace multiple search queries with a single read_group operation in res.partner._credit_debit_get() method.
Previously, the method executed one search query per partner with add_check_credit enabled, resulting in N queries when processing multiple partners.
Now uses read_group to aggregate check amounts in a single database query, storing results in a dictionary for O(1) lookup. This significantly improves performance when calculating credit for multiple partners simultaneously.