Skip to content

[16.0][FIX] pms: autocheckout - replace deprecated message_post subtype kwarg#399

Merged
OCA-git-bot merged 1 commit into
OCA:16.0from
commitsun:16.0-fix-pms-autocheckout-message-post-subtype
May 16, 2026
Merged

[16.0][FIX] pms: autocheckout - replace deprecated message_post subtype kwarg#399
OCA-git-bot merged 1 commit into
OCA:16.0from
commitsun:16.0-fix-pms-autocheckout-message-post-subtype

Conversation

@DarioLodeiros
Copy link
Copy Markdown
Member

Summary

Fix PmsReservation.autocheckout() which was using the deprecated subtype kwarg of message_post(), causing the cron Automatic No Checkout Reservations to fail with:

ValueError: message_post does not support subtype parameter anymore.
Please give a valid subtype_id or subtype_xmlid value instead.

The subtype kwarg was removed in Odoo 16. It now requires either subtype_id (int) or subtype_xmlid (str).

Change

 reservation.message_post(
-    subject=_("No Checkins!"), subtype="mt_comment", body=msg
+    subject=_("No Checkins!"),
+    subtype_xmlid="mail.mt_comment",
+    body=msg,
 )

Note also that the legacy "mt_comment" was implicitly assumed to be prefixed with mail.; the explicit xmlid "mail.mt_comment" keeps the same behavior.

Reproduction

Trigger the Automatic No Checkout Reservations cron (server_action #341 in default install) — any reservation reaching the autocheckout path without confirmed check-ins raises the ValueError instead of posting the chatter message and marking the reservation.

Test plan

  • Cron stops failing in production after the fix
  • Chatter message "No Checkins!" appears on the affected reservation

The 'subtype' kwarg of message_post() was removed in Odoo 16: it now
requires either 'subtype_id' (int) or 'subtype_xmlid' (str).

Replace 'subtype="mt_comment"' with 'subtype_xmlid="mail.mt_comment"'
so the cron "Automatic No Checkout Reservations" stops failing with:

    ValueError: message_post does not support subtype parameter
    anymore. Please give a valid subtype_id or subtype_xmlid value
    instead.
@DarioLodeiros
Copy link
Copy Markdown
Member Author

/ocabot merge minor

@OCA-git-bot
Copy link
Copy Markdown
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-399-by-DarioLodeiros-bump-minor, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 10e6712 into OCA:16.0 May 16, 2026
7 checks passed
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 53c93a0. Thanks a lot for contributing to OCA. ❤️

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants