Repository navigation
[16.0][FIX] pms: don't take a partner pricelist restricted to another property - #468
Open
DarioLodeiros wants to merge 1 commit into
Open
DarioLodeiros wants to merge 1 commit into
DarioLodeiros wants to merge 1 commit into
Conversation
A new folio or reservation took the pricelist of its partner, or of its agency, whenever it was available in the PMS, without checking that it could be used in the record's property. In multi-property databases most PMS pricelists belong to a single property, so creating a folio in another property for that partner failed on the property check with "Incompatible properties on records", even when its reservations were sent with a valid pricelist. Partners without a pricelist of their own are affected too, as Odoo falls back to the first active pricelist. The booking engine proposed that same pricelist and failed the same way. A partner or agency pricelist restricted to other properties is now skipped like a pricelist not available in the PMS, and the pricelist comes from the next rule: the partner after the agency, then the folio or the property default. Agency pricelists not available in the PMS, which agencies cannot be given, are skipped too. While the property is not set yet, as in a new form, only the PMS availability is checked.
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
In databases with several properties, creating a folio for an existing contact fails with "Incompatible properties on records: 'Pricelist' (pricelist_id: ...) belongs to another properties", even when the reservations are given a valid pricelist of the property.
_compute_pricelist_idof a new folio takes the contact'sproperty_product_pricelistwhenever it is available in the PMS, without checkingpms_property_ids. When that pricelist is restricted to another property, the property check rejects the folio. Clients that create the folio first and then its reservations with their own pricelist always hit it. The reservation compute, the agency branch (apply_pricelist) of both computes and the booking engine follow the same pattern.It also affects contacts without a pricelist of their own: Odoo falls back to the first active pricelist, so when that pricelist belongs to a single property, no contact can be booked in the others.
Fix
product.pricelist._is_pms_usable(pms_property): the pricelist is available in the PMS and not restricted to other properties. While the property is not set yet (e.g. a new form), only the PMS availability is checked, as before._compute_pricelist_idof folios and reservations, and in the booking engine. An unusable pricelist is skipped like a pricelist not available in the PMS, so the pricelist comes from the next rule: the partner after the agency, then the folio or the property default._check_agency_pricelistdoes not allow, are skipped too.Pricelists that are not restricted, or restricted to the record's property, are applied as before.
Tests