mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX]pms: prices and pending checkins in staff reservations are allowed
This commit is contained in:
@@ -814,7 +814,7 @@ class PmsFolio(models.Model):
|
||||
def _compute_sale_line_ids(self):
|
||||
for folio in self.filtered(lambda f: isinstance(f.id, int)):
|
||||
sale_lines_vals = []
|
||||
if folio.reservation_type == "normal":
|
||||
if folio.reservation_type in ("normal", "staff"):
|
||||
sale_lines_vals_to_drop = []
|
||||
seq = 0
|
||||
for reservation in sorted(
|
||||
@@ -884,7 +884,7 @@ class PmsFolio(models.Model):
|
||||
def _compute_pricelist_id(self):
|
||||
for folio in self:
|
||||
is_new = not folio.pricelist_id or isinstance(folio.id, models.NewId)
|
||||
if folio.reservation_type in ("out", "staff"):
|
||||
if folio.reservation_type == "out":
|
||||
folio.pricelist_id = False
|
||||
elif len(folio.reservation_ids.pricelist_id) == 1:
|
||||
folio.pricelist_id = folio.reservation_ids.pricelist_id
|
||||
@@ -1246,7 +1246,7 @@ class PmsFolio(models.Model):
|
||||
)
|
||||
def _compute_amount(self):
|
||||
for record in self:
|
||||
if record.reservation_type in ("staff", "out"):
|
||||
if record.reservation_type == "out":
|
||||
record.amount_total = 0
|
||||
vals = {
|
||||
"payment_state": "nothing_to_pay",
|
||||
@@ -1371,7 +1371,10 @@ class PmsFolio(models.Model):
|
||||
|
||||
def _compute_checkin_partner_count(self):
|
||||
for record in self:
|
||||
if record.reservation_type == "normal" and record.reservation_ids:
|
||||
if (
|
||||
record.reservation_type in ("normal", "staff")
|
||||
and record.reservation_ids
|
||||
):
|
||||
filtered_reservs = record.reservation_ids.filtered(
|
||||
lambda x: x.state != "cancel"
|
||||
)
|
||||
|
||||
@@ -1026,7 +1026,7 @@ class PmsReservation(models.Model):
|
||||
is_new = not reservation.pricelist_id or isinstance(
|
||||
reservation.id, models.NewId
|
||||
)
|
||||
if reservation.reservation_type in ("out", "staff"):
|
||||
if reservation.reservation_type == "out":
|
||||
reservation.pricelist_id = False
|
||||
elif (
|
||||
is_new
|
||||
@@ -1390,7 +1390,7 @@ class PmsReservation(models.Model):
|
||||
line.invoice_status = "no"
|
||||
else:
|
||||
line.invoice_status = "no"
|
||||
if line.reservation_type != "normal":
|
||||
if line.reservation_type not in ("normal", "staff"):
|
||||
line.invoice_status = "no"
|
||||
|
||||
@api.depends("reservation_line_ids")
|
||||
|
||||
@@ -542,7 +542,7 @@ class PmsService(models.Model):
|
||||
|
||||
def _get_price_unit_line(self, date=False):
|
||||
self.ensure_one()
|
||||
if self.reservation_id.reservation_type == "normal":
|
||||
if self.reservation_id.reservation_type in ("normal", "staff"):
|
||||
folio = self.folio_id
|
||||
reservation = self.reservation_id
|
||||
origin = reservation if reservation else folio
|
||||
|
||||
Reference in New Issue
Block a user