You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up from #522 (fix for #419), out of that PR's scope.
The override
spp_registry/controllers/mail.py still overrides POST /mail/attachment/delete (SPPAttachmentController.mail_attachment_delete). Unlike the update_content sibling removed in #522, it does run on Odoo 19 — but it enforces a different policy from stock, so it cannot simply be deleted as redundant:
Gate
spp_registry override
message author OR base.group_system, then ACLs (_delete_and_notify); portal/guest path via message author or a mail.compose.message access token
ir.attachment._has_attachments_ownership([access_token]) = write access on the attachment OR a scoped attachment_ownership token
Example divergence: an internal user with write access on the attachment who is neither the message author nor group_system is refused by the override and allowed by stock. Conversely the override lets the message author delete an attachment they have no write access to only if ACLs then allow it. Whether OpenSPP wants the author-or-admin policy or Odoo's ownership policy is a decision, not a cleanup.
Also worth knowing when deciding: with update_content back to stock (#522), the web client's message Delete (removeParams, attachment_ids: []) makes _message_update_content call message.attachment_ids._delete_and_notify() directly (mail_thread.py ~5093), i.e. a message's attachments are removed without passing through this override. So the override only governs the standalone "remove attachment" action, not attachments dropped with their message.
Placeholder tests
spp_registry/tests/test_mail_controllers.py::TestMailAttachmentDeleteController still carries two skipTest placeholders:
test_author_can_delete_own_attachment — "fixture limitation": the attachment is created by admin, so the author's _delete_and_notify fails on ACL. Fix the fixture (post via message_post as the author, or create the attachment as the author) rather than skipping.
test_missing_attachment_returns_without_error — not implemented; should patch bus.bus._sendone and assert the ir.attachment/delete payload for a stale id.
Suggested resolution
Decide policy (product/security call). If stock is acceptable → delete the override, drop its i18n string, and keep/rewrite the tests against stock like fix(registry): drop broken /mail/message/update_content override #522 did. If author-or-admin must stay → keep the override, document why in the module docstring, and finish the two tests.
Follow-up from #522 (fix for #419), out of that PR's scope.
The override
spp_registry/controllers/mail.pystill overridesPOST /mail/attachment/delete(SPPAttachmentController.mail_attachment_delete). Unlike theupdate_contentsibling removed in #522, it does run on Odoo 19 — but it enforces a different policy from stock, so it cannot simply be deleted as redundant:base.group_system, then ACLs (_delete_and_notify); portal/guest path via message author or amail.compose.messageaccess tokenmail/controllers/attachment.py:98-108)ir.attachment._has_attachments_ownership([access_token])= write access on the attachment OR a scopedattachment_ownershiptokenExample divergence: an internal user with write access on the attachment who is neither the message author nor
group_systemis refused by the override and allowed by stock. Conversely the override lets the message author delete an attachment they have no write access to only if ACLs then allow it. Whether OpenSPP wants the author-or-admin policy or Odoo's ownership policy is a decision, not a cleanup.Also worth knowing when deciding: with
update_contentback to stock (#522), the web client's message Delete (removeParams,attachment_ids: []) makes_message_update_contentcallmessage.attachment_ids._delete_and_notify()directly (mail_thread.py~5093), i.e. a message's attachments are removed without passing through this override. So the override only governs the standalone "remove attachment" action, not attachments dropped with their message.Placeholder tests
spp_registry/tests/test_mail_controllers.py::TestMailAttachmentDeleteControllerstill carries twoskipTestplaceholders:test_author_can_delete_own_attachment— "fixture limitation": the attachment is created by admin, so the author's_delete_and_notifyfails on ACL. Fix the fixture (post viamessage_postas the author, or create the attachment as the author) rather than skipping.test_missing_attachment_returns_without_error— not implemented; should patchbus.bus._sendoneand assert their.attachment/deletepayload for a stale id.Suggested resolution
Refs: #419, #522.