Skip to content

[FIX] donation_base: use default_res_ids instead of deprecated default_res_id#152

Open
dbruehlmeier wants to merge 1 commit intoOCA:18.0from
dbruehlmeier:fix/tax-receipt-send-mail-default-res-ids
Open

[FIX] donation_base: use default_res_ids instead of deprecated default_res_id#152
dbruehlmeier wants to merge 1 commit intoOCA:18.0from
dbruehlmeier:fix/tax-receipt-send-mail-default-res-ids

Conversation

@dbruehlmeier
Copy link

@dbruehlmeier dbruehlmeier commented Mar 16, 2026

Summary

Fixes two bugs in action_send_tax_receipt that prevent sending tax receipt confirmation emails in Odoo 18.0.

Bug 1: Deprecated default_res_id context key

mail.compose.message.default_get() raises a ValueError when default_res_id is passed in context, as it has been replaced by default_res_ids in Odoo 18.0.

ValueError: Deprecated usage of 'default_res_id', should use 'default_res_ids'.

Bug 2: Wrong XML ID for default_email_layout_xmlid

default_email_layout_xmlid was set to donation_base.tax_receipt_email_template, which is a mail.template record. This context key expects an ir.ui.view QWeb email layout, causing an AssertionError in ir.ui.view._get_view_id.

AssertionError: Call _get_view_id, expected 'ir.ui.view', got 'mail.template'

Fix

- default_res_id=self.id,
+ default_res_ids=self.ids,
- layout_xmlid = "donation_base.tax_receipt_email_template"
+ layout_xmlid = "mail.mail_notification_light"

@OCA-git-bot
Copy link
Contributor

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

Two issues prevented sending tax receipt confirmation emails:

1. Used deprecated 'default_res_id' context key instead of 'default_res_ids'.
   In Odoo 18.0, mail.compose.message.default_get() raises a ValueError
   when 'default_res_id' is used.

2. Set 'default_email_layout_xmlid' to the mail template XML ID
   ('donation_base.tax_receipt_email_template') instead of an ir.ui.view
   email layout. This caused an AssertionError in ir.ui.view._get_view_id.
   Changed to 'mail.mail_notification_light' which is the standard light
   email notification layout.
@dbruehlmeier dbruehlmeier force-pushed the fix/tax-receipt-send-mail-default-res-ids branch from 57d03c4 to 7f11dd6 Compare March 16, 2026 13:58
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