Skip to content

Commit

Permalink
[FIX]pms: compute_pricelist_id is_new instance wrong computed
Browse files Browse the repository at this point in the history
  • Loading branch information
DarioLodeiros committed Oct 27, 2023
1 parent a34e398 commit 1d28720
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pms/models/pms_folio.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,12 +882,12 @@ def _compute_company_id(self):
)
def _compute_pricelist_id(self):
for folio in self:
is_new = not folio.pricelist_id or not isinstance(folio.id, models.NewId)
is_new = not folio.pricelist_id or isinstance(folio.id, models.NewId)
if folio.reservation_type in ("out", "staff"):
folio.pricelist_id = False
elif len(folio.reservation_ids.pricelist_id) == 1:
folio.pricelist_id = folio.reservation_ids.pricelist_id
elif folio.agency_id and folio.agency_id.apply_pricelist and is_new:
elif is_new and folio.agency_id and folio.agency_id.apply_pricelist:
folio.pricelist_id = folio.agency_id.property_product_pricelist
elif (
is_new
Expand Down
2 changes: 1 addition & 1 deletion pms/models/pms_reservation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ def _compute_service_ids(self):
@api.depends("partner_id", "agency_id")
def _compute_pricelist_id(self):
for reservation in self:
is_new = not reservation.pricelist_id or not isinstance(
is_new = not reservation.pricelist_id or isinstance(
reservation.id, models.NewId
)
if reservation.reservation_type in ("out", "staff"):
Expand Down

0 comments on commit 1d28720

Please sign in to comment.