Skip to content

[18.0][FIX] donation: fix partner donation count always showing 0#153

Open
dbruehlmeier wants to merge 1 commit intoOCA:18.0from
dbruehlmeier:fix/partner-donation-count
Open

[18.0][FIX] donation: fix partner donation count always showing 0#153
dbruehlmeier wants to merge 1 commit intoOCA:18.0from
dbruehlmeier:fix/partner-donation-count

Conversation

@dbruehlmeier
Copy link

Summary

  • Fix donation_count smart button on the partner form always displaying 0, even when the partner has confirmed donations.

Root Cause

In Odoo 18.0, _read_group() returns recordsets as group keys, not integer IDs. The mapped_data dictionary in _compute_donation_count was keyed by res.partner record objects, but the subsequent lookup used partner.id (an integer). Since a record object never equals an integer, .get(partner.id, 0) always fell through to the default 0.

Fix

Use partner.id as the dictionary key when building mapped_data so the lookup types match.

In Odoo 18.0, _read_group() returns recordsets as group keys, not
integer IDs. The mapped_data dictionary was keyed by res.partner
records but the lookup used partner.id (an integer), causing the
count to always resolve to the default value of 0.
@OCA-git-bot
Copy link
Contributor

Hi @alexis-via,
some modules you are maintaining are being modified, check this out!

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