[FIX]pms: compute_pricelist_id is_new instance wrong computed

This commit is contained in:
Darío Lodeiros
2023-10-27 12:04:13 +02:00
parent a34e398045
commit 1d28720ac0
2 changed files with 3 additions and 3 deletions

View File

@@ -882,12 +882,12 @@ class PmsFolio(models.Model):
)
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

View File

@@ -1018,7 +1018,7 @@ class PmsReservation(models.Model):
@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"):