Skip to content

Comments

[IMP] l10n_latam_check_ux: optimize partner credit calculation with read_group#855

Open
rov-adhoc wants to merge 2 commits intoingadhoc:18.0from
adhoc-dev:18.0-t-52412-rov-4
Open

[IMP] l10n_latam_check_ux: optimize partner credit calculation with read_group#855
rov-adhoc wants to merge 2 commits intoingadhoc:18.0from
adhoc-dev:18.0-t-52412-rov-4

Conversation

@rov-adhoc
Copy link
Contributor

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.

…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.
Copilot AI review requested due to automatic review settings December 22, 2025 11:57
@roboadhoc
Copy link
Contributor

Pull request status dashboard

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_group con agregación amount:sum agrupada por partner_id
  • Implementación de diccionario para lookup O(1) de los montos por partner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants