Refact use of reservation_type to allow inherit conditions #364
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.
This pull request refactors the handling of reservation types and their pricing logic in the PMS module. The main improvement is the introduction of dedicated methods to determine which reservation types use night-based, service-based, or any pricing rules. This change centralizes and simplifies the logic, making it easier to extend and maintain. Additionally, UI visibility conditions are updated to align with the new logic, ensuring consistency between backend rules and the user interface.
Backend logic improvements:
pms_folio.py—_get_reservation_types_with_night_pricing,_get_reservation_types_with_service_pricing, and_get_reservation_types_with_any_pricing—to centralize and allow easy extension of reservation type pricing logic.pms_folio.pymethods (_compute_sale_line_ids,_compute_pricelist_id,_compute_amount) to use the new reservation type methods instead of hardcoded values, ensuring consistency and flexibility. [1] [2] [3] [4] [5]_get_price_unit_lineinpms_service.pyto use the new service pricing reservation type method, replacing hardcoded checks.User interface consistency:
pms_folio_views.xml,pms_reservation_views.xml) to adjust visibility conditions for fields and pages, now hiding elements only whenreservation_typeis'out', matching the backend logic. [1] [2] [3] [4] [5]