mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX]pms: compute_pricelist_id is_new instance wrong computed
This commit is contained in:
@@ -882,12 +882,12 @@ class PmsFolio(models.Model):
|
|||||||
)
|
)
|
||||||
def _compute_pricelist_id(self):
|
def _compute_pricelist_id(self):
|
||||||
for folio in 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"):
|
if folio.reservation_type in ("out", "staff"):
|
||||||
folio.pricelist_id = False
|
folio.pricelist_id = False
|
||||||
elif len(folio.reservation_ids.pricelist_id) == 1:
|
elif len(folio.reservation_ids.pricelist_id) == 1:
|
||||||
folio.pricelist_id = folio.reservation_ids.pricelist_id
|
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
|
folio.pricelist_id = folio.agency_id.property_product_pricelist
|
||||||
elif (
|
elif (
|
||||||
is_new
|
is_new
|
||||||
|
|||||||
@@ -1018,7 +1018,7 @@ class PmsReservation(models.Model):
|
|||||||
@api.depends("partner_id", "agency_id")
|
@api.depends("partner_id", "agency_id")
|
||||||
def _compute_pricelist_id(self):
|
def _compute_pricelist_id(self):
|
||||||
for reservation in 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
|
reservation.id, models.NewId
|
||||||
)
|
)
|
||||||
if reservation.reservation_type in ("out", "staff"):
|
if reservation.reservation_type in ("out", "staff"):
|
||||||
|
|||||||
Reference in New Issue
Block a user