Skip to content

[16.0][FIX] pms: don't take a partner pricelist restricted to another property - #468

Open
DarioLodeiros wants to merge 1 commit into
OCA:16.0from
DarioLodeiros:16.0-fix-pms-pricelist-partner-other-property
Open

DarioLodeiros wants to merge 1 commit into
OCA:16.0from
DarioLodeiros:16.0-fix-pms-pricelist-partner-other-property

Conversation

@DarioLodeiros

Copy link
Copy Markdown
Member

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_id of a new folio takes the contact's property_product_pricelist whenever it is available in the PMS, without checking pms_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

  • New helper 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.
  • Used in the agency and partner branches of _compute_pricelist_id of 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.
  • Agency pricelists not available in the PMS, which _check_agency_pricelist does not allow, are skipped too.

Pricelists that are not restricted, or restricted to the record's property, are applied as before.

Tests

  • folio in another property than the partner pricelist: takes the property default pricelist
  • folio in the property of the partner pricelist: still takes the partner pricelist
  • folio form with the partner chosen before the property: keeps the partner pricelist
  • reservation without pricelist for that partner in another property: the reservation and its folio take the property default pricelist
  • same for an agency that applies its pricelist
  • booking engine in another property: proposes the property default pricelist

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants