[IMP] pms: prevent delete/cancel of past out-of-service blocks#396
Merged
OCA-git-bot merged 2 commits intoMay 11, 2026
Merged
Conversation
Add a per-property setting (block_modify_past_out_service) that prevents deleting or cancelling out-of-service reservations once they have past days. Two cases: * If the block still has present/future days, the user is told to shorten the block instead of deleting/cancelling it. * If the block is already fully in the past, the operation is rejected. The same control is applied at reservation_line level to prevent removing past days one by one (which would otherwise bypass the reservation-level check). Spanish translations are included.
Cover the six core behaviors: * delete fully-past block raises with "already in the past" * cancel block with past+future days raises with "shorten the block" * unlink of a past reservation_line is rejected * unlink of a future reservation_line shortens the block successfully * with the flag disabled, past blocks remain deletable * non-out-of-service reservations are not affected by the flag
Member
Author
|
/ocabot merge minor |
Contributor
|
What a great day to merge this nice PR. Let's do it! |
Contributor
|
Congratulations, your PR was merged at d145f55. Thanks a lot for contributing to OCA. ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a per-property setting
block_modify_past_out_service(off by default) that prevents deleting or cancelling out-of-service reservations once they contain past days.When the flag is enabled on a property:
The check covers all paths that destroy or cancel an out-of-service reservation: direct
unlink, cascade from folio deletion,action_cancel, andpms.folio.action_cancel(which iterates and callspms.reservation.action_cancel).Spanish translations included.
Test plan
block_modify_past_out_serviceon a property.outreservation in the past is unaffected by the new check.