Repository navigation
[16.0][FIX] pms: pair folio sale lines by shared nights and order them by date - #465
Merged
OCA-git-bot merged 1 commit intoOct 17, 2026
Conversation
read_group returns the groups of nights sorted by price, and _get_reservation_sale_lines paired them with the existing sale lines by position. A new night cheaper than the invoiced ones sorted first and took the invoiced sale line, so the locked folio check refused the change: an invoiced stay could not be extended with cheaper nights. Reservation and folio services used the same pairing. Each existing sale line is now reused by the group it shares most lines with; groups sharing none take the unused sale lines in order, as before. Groups are ordered by their first date, so folio and invoice lines follow the stay instead of the price. The sale lines to drop are accumulated across the services of a reservation instead of keeping only those of the last service.
Member
Author
|
/ocabot merge minor |
Contributor
|
On my way to merge this fine PR! |
Contributor
|
Congratulations, your PR was merged at 9f8d2ff. 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.
Problem
Extending an invoiced stay with nights cheaper than the invoiced ones fails with "It is forbidden to modify the following fields in a locked folio (fields already invoiced)".
_get_reservation_sale_linesgroups the nights withread_group, which sorts the groups by price, and pairs them with the existing sale lines by position. The cheaper group sorts first and is handed the invoiced sale line, whose price is protected. Reservation services and folio services use the same pairing.The same sort lists the room lines of the folio, and therefore of the invoice, by price instead of by date.
Fix
_get_sale_line_groups: orders the groups by their first date and reuses each existing sale line for the group it shares most lines with. Groups sharing no line take the unused sale lines in order, as before.On existing folios every group lands on its own sale line, so only
sequencechanges. Posted invoices are not touched.Tests