mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] reservation state cancel key, improvement views and refactoring
This commit is contained in:
@@ -4,25 +4,22 @@
|
|||||||
<record model="ir.sequence" id="seq_pms_folio">
|
<record model="ir.sequence" id="seq_pms_folio">
|
||||||
<field name="name">PMS Folio</field>
|
<field name="name">PMS Folio</field>
|
||||||
<field name="code">pms.folio</field>
|
<field name="code">pms.folio</field>
|
||||||
<field name="prefix">F/%(y)s</field>
|
<field name="prefix">F%(y)s</field>
|
||||||
<field name="suffix">%(sec)s</field>
|
<field name="padding">5</field>
|
||||||
<field name="padding">4</field>
|
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="ir.sequence" id="seq_pms_reservation">
|
<record model="ir.sequence" id="seq_pms_reservation">
|
||||||
<field name="name">PMS Reservation</field>
|
<field name="name">PMS Reservation</field>
|
||||||
<field name="code">pms.reservation</field>
|
<field name="code">pms.reservation</field>
|
||||||
<field name="prefix">R/%(y)s</field>
|
<field name="prefix">R%(y)s</field>
|
||||||
<field name="suffix">%(sec)s</field>
|
<field name="padding">6</field>
|
||||||
<field name="padding">4</field>
|
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="ir.sequence" id="seq_pms_checkin">
|
<record model="ir.sequence" id="seq_pms_checkin">
|
||||||
<field name="name">PMS Checkin</field>
|
<field name="name">PMS Checkin</field>
|
||||||
<field name="code">pms.checkin.partner</field>
|
<field name="code">pms.checkin.partner</field>
|
||||||
<field name="prefix">C/%(y)s</field>
|
<field name="prefix">%(y)s</field>
|
||||||
<field name="suffix">%(sec)s</field>
|
<field name="padding">6</field>
|
||||||
<field name="padding">4</field>
|
|
||||||
</record>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
'checkin': (DateTime.today() + timedelta(days=14)),
|
'checkin': (DateTime.today() + timedelta(days=14)),
|
||||||
'checkout': (DateTime.today() + timedelta(days=16)),
|
'checkout': (DateTime.today() + timedelta(days=16)),
|
||||||
'adults': 1,
|
'adults': 1,
|
||||||
'state': 'cancelled',
|
'state': 'cancel',
|
||||||
})]"
|
})]"
|
||||||
/>
|
/>
|
||||||
</record>
|
</record>
|
||||||
@@ -388,7 +388,7 @@
|
|||||||
'checkin': (DateTime.today() + timedelta(days=22)),
|
'checkin': (DateTime.today() + timedelta(days=22)),
|
||||||
'checkout': (DateTime.today() + timedelta(days=23)),
|
'checkout': (DateTime.today() + timedelta(days=23)),
|
||||||
'adults': 1,
|
'adults': 1,
|
||||||
'state': 'cancelled',
|
'state': 'cancel',
|
||||||
})]"
|
})]"
|
||||||
/>
|
/>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class PmsCheckinPartner(models.Model):
|
|||||||
("precheckin", "Pending arrival"),
|
("precheckin", "Pending arrival"),
|
||||||
("onboard", "On Board"),
|
("onboard", "On Board"),
|
||||||
("done", "Out"),
|
("done", "Out"),
|
||||||
("cancelled", "Cancelled"),
|
("cancel", "Cancelled"),
|
||||||
],
|
],
|
||||||
compute="_compute_state",
|
compute="_compute_state",
|
||||||
)
|
)
|
||||||
@@ -279,23 +279,6 @@ class PmsCheckinPartner(models.Model):
|
|||||||
elif not record.nationality_id:
|
elif not record.nationality_id:
|
||||||
record.nationality_id = False
|
record.nationality_id = False
|
||||||
|
|
||||||
@api.depends("reservation_id", "folio_id", "reservation_id.preferred_room_id")
|
|
||||||
def _compute_identifier(self):
|
|
||||||
for record in self:
|
|
||||||
# TODO: Identifier
|
|
||||||
checkins = []
|
|
||||||
if record.reservation_id.filtered("preferred_room_id"):
|
|
||||||
checkins = record.reservation_id.checkin_partner_ids
|
|
||||||
record.identifier = (
|
|
||||||
record.reservation_id.preferred_room_id.name
|
|
||||||
+ "-"
|
|
||||||
+ str(len(checkins) - 1)
|
|
||||||
)
|
|
||||||
elif record.folio_id:
|
|
||||||
record.identifier = record.folio_id.name + "-" + str(len(checkins) - 1)
|
|
||||||
else:
|
|
||||||
record.identifier = False
|
|
||||||
|
|
||||||
@api.depends("reservation_id", "reservation_id.folio_id")
|
@api.depends("reservation_id", "reservation_id.folio_id")
|
||||||
def _compute_folio_id(self):
|
def _compute_folio_id(self):
|
||||||
for record in self.filtered("reservation_id"):
|
for record in self.filtered("reservation_id"):
|
||||||
@@ -306,9 +289,9 @@ class PmsCheckinPartner(models.Model):
|
|||||||
for record in self:
|
for record in self:
|
||||||
if not record.state:
|
if not record.state:
|
||||||
record.state = "draft"
|
record.state = "draft"
|
||||||
if record.reservation_id.state == "cancelled":
|
if record.reservation_id.state == "cancel":
|
||||||
record.state = "cancelled"
|
record.state = "cancel"
|
||||||
elif record.state in ("draft", "cancelled"):
|
elif record.state in ("draft", "cancel"):
|
||||||
if any(
|
if any(
|
||||||
not getattr(record, field)
|
not getattr(record, field)
|
||||||
for field in record._checkin_mandatory_fields()
|
for field in record._checkin_mandatory_fields()
|
||||||
@@ -509,7 +492,7 @@ class PmsCheckinPartner(models.Model):
|
|||||||
else vals["pms_property_id"]
|
else vals["pms_property_id"]
|
||||||
)
|
)
|
||||||
pms_property = self.env["pms.property"].browse(pms_property_id)
|
pms_property = self.env["pms.property"].browse(pms_property_id)
|
||||||
vals["identifier"] = pms_property.folio_sequence_id._next_do()
|
vals["identifier"] = pms_property.checkin_sequence_id._next_do()
|
||||||
return super(PmsCheckinPartner, self).create(vals)
|
return super(PmsCheckinPartner, self).create(vals)
|
||||||
if len(draft_checkins) > 0:
|
if len(draft_checkins) > 0:
|
||||||
draft_checkins[0].write(vals)
|
draft_checkins[0].write(vals)
|
||||||
|
|||||||
@@ -572,14 +572,14 @@ class PmsFolio(models.Model):
|
|||||||
def _compute_number_of_rooms(self):
|
def _compute_number_of_rooms(self):
|
||||||
for folio in self:
|
for folio in self:
|
||||||
folio.number_of_rooms = len(
|
folio.number_of_rooms = len(
|
||||||
folio.reservation_ids.filtered(lambda a: a.state != "cancelled")
|
folio.reservation_ids.filtered(lambda a: a.state != "cancel")
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.depends("reservation_ids", "reservation_ids.state")
|
@api.depends("reservation_ids", "reservation_ids.state")
|
||||||
def _compute_number_of_cancelled_rooms(self):
|
def _compute_number_of_cancelled_rooms(self):
|
||||||
for folio in self:
|
for folio in self:
|
||||||
folio.number_of_cancelled_rooms = len(
|
folio.number_of_cancelled_rooms = len(
|
||||||
folio.reservation_ids.filtered(lambda a: a.state == "cancelled")
|
folio.reservation_ids.filtered(lambda a: a.state == "cancel")
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.depends("service_ids", "service_ids.product_qty")
|
@api.depends("service_ids", "service_ids.product_qty")
|
||||||
@@ -912,7 +912,7 @@ class PmsFolio(models.Model):
|
|||||||
total = record.amount_total
|
total = record.amount_total
|
||||||
# REVIEW: Must We ignored services in cancelled folios
|
# REVIEW: Must We ignored services in cancelled folios
|
||||||
# pending amount?
|
# pending amount?
|
||||||
if record.state == "cancelled":
|
if record.state == "cancel":
|
||||||
total = total - sum(record.service_ids.mapped("price_total"))
|
total = total - sum(record.service_ids.mapped("price_total"))
|
||||||
# Compute 'payment_state'.
|
# Compute 'payment_state'.
|
||||||
if total <= paid_out:
|
if total <= paid_out:
|
||||||
@@ -938,7 +938,7 @@ class PmsFolio(models.Model):
|
|||||||
for record in self:
|
for record in self:
|
||||||
if record.reservation_type == "normal" and record.reservation_ids:
|
if record.reservation_type == "normal" and record.reservation_ids:
|
||||||
filtered_reservs = record.reservation_ids.filtered(
|
filtered_reservs = record.reservation_ids.filtered(
|
||||||
lambda x: x.state != "cancelled"
|
lambda x: x.state != "cancel"
|
||||||
)
|
)
|
||||||
mapped_checkin_partner = filtered_reservs.mapped(
|
mapped_checkin_partner = filtered_reservs.mapped(
|
||||||
"checkin_partner_ids.id"
|
"checkin_partner_ids.id"
|
||||||
@@ -1122,7 +1122,7 @@ class PmsFolio(models.Model):
|
|||||||
def action_cancel(self):
|
def action_cancel(self):
|
||||||
for folio in self:
|
for folio in self:
|
||||||
for reservation in folio.reservation_ids.filtered(
|
for reservation in folio.reservation_ids.filtered(
|
||||||
lambda res: res.state != "cancelled"
|
lambda res: res.state != "cancel"
|
||||||
):
|
):
|
||||||
reservation.action_cancel()
|
reservation.action_cancel()
|
||||||
self.write(
|
self.write(
|
||||||
|
|||||||
@@ -236,8 +236,8 @@ class PmsReservation(models.Model):
|
|||||||
compute="_compute_pending_checkin_data",
|
compute="_compute_pending_checkin_data",
|
||||||
)
|
)
|
||||||
ratio_checkin_data = fields.Integer(
|
ratio_checkin_data = fields.Integer(
|
||||||
string="Pending Checkin Data",
|
string="Complete cardex",
|
||||||
help="Proportion of guest data pending at checkin",
|
help="Proportion of guest data complete at checkin",
|
||||||
compute="_compute_ratio_checkin_data",
|
compute="_compute_ratio_checkin_data",
|
||||||
)
|
)
|
||||||
ready_for_checkin = fields.Boolean(
|
ready_for_checkin = fields.Boolean(
|
||||||
@@ -265,7 +265,7 @@ class PmsReservation(models.Model):
|
|||||||
allowed_cancel = fields.Boolean(
|
allowed_cancel = fields.Boolean(
|
||||||
string="Allowed cancel",
|
string="Allowed cancel",
|
||||||
help="Technical field, Indicates that reservation can be cancelled,"
|
help="Technical field, Indicates that reservation can be cancelled,"
|
||||||
"that happened when state is 'cancelled', 'done', or 'departure_delayed'",
|
"that happened when state is 'cancel', 'done', or 'departure_delayed'",
|
||||||
compute="_compute_allowed_cancel",
|
compute="_compute_allowed_cancel",
|
||||||
search="_search_allowed_cancel",
|
search="_search_allowed_cancel",
|
||||||
)
|
)
|
||||||
@@ -333,7 +333,7 @@ class PmsReservation(models.Model):
|
|||||||
("confirm", "Pending arrival"),
|
("confirm", "Pending arrival"),
|
||||||
("onboard", "On Board"),
|
("onboard", "On Board"),
|
||||||
("done", "Out"),
|
("done", "Out"),
|
||||||
("cancelled", "Cancelled"),
|
("cancel", "Cancelled"),
|
||||||
("arrival_delayed", "Arrival Delayed"),
|
("arrival_delayed", "Arrival Delayed"),
|
||||||
("departure_delayed", "Departure delayed"),
|
("departure_delayed", "Departure delayed"),
|
||||||
],
|
],
|
||||||
@@ -609,8 +609,8 @@ class PmsReservation(models.Model):
|
|||||||
"departure_delayed",
|
"departure_delayed",
|
||||||
):
|
):
|
||||||
record.priority = 1
|
record.priority = 1
|
||||||
elif record.state == "cancelled":
|
elif record.state == "cancel":
|
||||||
record.priority = record.cancelled_priority()
|
record.priority = record.cancel_priority()
|
||||||
elif record.state == "onboard":
|
elif record.state == "onboard":
|
||||||
record.priority = record.onboard_priority()
|
record.priority = record.onboard_priority()
|
||||||
elif record.state in ("draf", "confirm"):
|
elif record.state in ("draf", "confirm"):
|
||||||
@@ -618,7 +618,7 @@ class PmsReservation(models.Model):
|
|||||||
elif record.state == "done":
|
elif record.state == "done":
|
||||||
record.priority = record.reservations_past_priority()
|
record.priority = record.reservations_past_priority()
|
||||||
|
|
||||||
def cancelled_priority(self):
|
def cancel_priority(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if self.folio_pending_amount > 0:
|
if self.folio_pending_amount > 0:
|
||||||
return 2
|
return 2
|
||||||
@@ -731,7 +731,7 @@ class PmsReservation(models.Model):
|
|||||||
def _compute_allowed_room_ids(self):
|
def _compute_allowed_room_ids(self):
|
||||||
for reservation in self:
|
for reservation in self:
|
||||||
if reservation.checkin and reservation.checkout:
|
if reservation.checkin and reservation.checkout:
|
||||||
if reservation.overbooking or reservation.state in ("cancelled"):
|
if reservation.overbooking or reservation.state in ("cancel"):
|
||||||
reservation.allowed_room_ids = self.env["pms.room"].search(
|
reservation.allowed_room_ids = self.env["pms.room"].search(
|
||||||
[("active", "=", True)]
|
[("active", "=", True)]
|
||||||
)
|
)
|
||||||
@@ -930,7 +930,9 @@ class PmsReservation(models.Model):
|
|||||||
@api.depends("pending_checkin_data")
|
@api.depends("pending_checkin_data")
|
||||||
def _compute_ratio_checkin_data(self):
|
def _compute_ratio_checkin_data(self):
|
||||||
self.ratio_checkin_data = 0
|
self.ratio_checkin_data = 0
|
||||||
for reservation in self.filtered(lambda r: r.adults > 0):
|
for reservation in self.filtered(
|
||||||
|
lambda r: r.adults > 0 and r.state != "cancel"
|
||||||
|
):
|
||||||
reservation.ratio_checkin_data = (
|
reservation.ratio_checkin_data = (
|
||||||
(reservation.adults - reservation.pending_checkin_data)
|
(reservation.adults - reservation.pending_checkin_data)
|
||||||
* 100
|
* 100
|
||||||
@@ -966,7 +968,7 @@ class PmsReservation(models.Model):
|
|||||||
for record in self:
|
for record in self:
|
||||||
record.allowed_cancel = (
|
record.allowed_cancel = (
|
||||||
True
|
True
|
||||||
if (record.state not in ["cancelled", "done", "departure_delayed"])
|
if (record.state not in ["cancel", "done", "departure_delayed"])
|
||||||
else False
|
else False
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1341,7 +1343,7 @@ class PmsReservation(models.Model):
|
|||||||
_("Invalid domain right operand %s for left of cancel", value)
|
_("Invalid domain right operand %s for left of cancel", value)
|
||||||
)
|
)
|
||||||
return [
|
return [
|
||||||
("state", "not in", ("cancelled", "done", "departure_delayed")),
|
("state", "not in", ("cancel", "done", "departure_delayed")),
|
||||||
]
|
]
|
||||||
|
|
||||||
def _search_checkin_partner_pending(self, operator, value):
|
def _search_checkin_partner_pending(self, operator, value):
|
||||||
@@ -1573,7 +1575,7 @@ class PmsReservation(models.Model):
|
|||||||
raise ValidationError(_("Partner contact name is required"))
|
raise ValidationError(_("Partner contact name is required"))
|
||||||
vals.update(default_vals)
|
vals.update(default_vals)
|
||||||
elif "pms_property_id" in vals and (
|
elif "pms_property_id" in vals and (
|
||||||
"partner_id" in vals or "agency_id" in vals
|
"partner_name" in vals or "partner_id" in vals or "agency_id" in vals
|
||||||
):
|
):
|
||||||
folio_vals = {
|
folio_vals = {
|
||||||
"pms_property_id": vals["pms_property_id"],
|
"pms_property_id": vals["pms_property_id"],
|
||||||
@@ -1598,9 +1600,7 @@ class PmsReservation(models.Model):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise ValidationError(
|
raise ValidationError(_("The Property are mandatory in the reservation"))
|
||||||
_("The client and Property are mandatory in the reservation")
|
|
||||||
)
|
|
||||||
if vals.get("name", _("New")) == _("New") or "name" not in vals:
|
if vals.get("name", _("New")) == _("New") or "name" not in vals:
|
||||||
pms_property_id = (
|
pms_property_id = (
|
||||||
self.env.user.get_active_property_ids()[0]
|
self.env.user.get_active_property_ids()[0]
|
||||||
@@ -1632,7 +1632,7 @@ class PmsReservation(models.Model):
|
|||||||
def autocheckout(self):
|
def autocheckout(self):
|
||||||
reservations = self.env["pms.reservation"].search(
|
reservations = self.env["pms.reservation"].search(
|
||||||
[
|
[
|
||||||
("state", "not in", ["done", "cancelled"]),
|
("state", "not in", ["done", "cancel"]),
|
||||||
("checkout", "<", fields.Date.today()),
|
("checkout", "<", fields.Date.today()),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@@ -1669,7 +1669,7 @@ class PmsReservation(models.Model):
|
|||||||
|
|
||||||
def action_cancel(self):
|
def action_cancel(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
# else state = cancelled
|
# else state = cancel
|
||||||
if not record.allowed_cancel:
|
if not record.allowed_cancel:
|
||||||
raise UserError(_("This reservation cannot be cancelled"))
|
raise UserError(_("This reservation cannot be cancelled"))
|
||||||
else:
|
else:
|
||||||
@@ -1680,8 +1680,8 @@ class PmsReservation(models.Model):
|
|||||||
)
|
)
|
||||||
if self._context.get("no_penalty", False):
|
if self._context.get("no_penalty", False):
|
||||||
_logger.info("Modified Reservation - No Penalty")
|
_logger.info("Modified Reservation - No Penalty")
|
||||||
record.write({"state": "cancelled", "cancelled_reason": cancel_reason})
|
record.write({"state": "cancel", "cancelled_reason": cancel_reason})
|
||||||
# record._compute_cancelled_discount()
|
# record._compute_cancel_discount()
|
||||||
record.folio_id._compute_amount()
|
record.folio_id._compute_amount()
|
||||||
|
|
||||||
def action_assign(self):
|
def action_assign(self):
|
||||||
|
|||||||
@@ -367,10 +367,7 @@ class PmsReservationLine(models.Model):
|
|||||||
@api.depends("reservation_id.state", "reservation_id.overbooking")
|
@api.depends("reservation_id.state", "reservation_id.overbooking")
|
||||||
def _compute_occupies_availability(self):
|
def _compute_occupies_availability(self):
|
||||||
for line in self:
|
for line in self:
|
||||||
if (
|
if line.reservation_id.state == "cancel" or line.reservation_id.overbooking:
|
||||||
line.reservation_id.state == "cancelled"
|
|
||||||
or line.reservation_id.overbooking
|
|
||||||
):
|
|
||||||
line.occupies_availability = False
|
line.occupies_availability = False
|
||||||
else:
|
else:
|
||||||
line.occupies_availability = True
|
line.occupies_availability = True
|
||||||
@@ -383,7 +380,7 @@ class PmsReservationLine(models.Model):
|
|||||||
# TODO: Review cancel logic
|
# TODO: Review cancel logic
|
||||||
# reservation = line.reservation_id
|
# reservation = line.reservation_id
|
||||||
# pricelist = reservation.pricelist_id
|
# pricelist = reservation.pricelist_id
|
||||||
# if reservation.state == "cancelled":
|
# if reservation.state == "cancel":
|
||||||
# if (
|
# if (
|
||||||
# reservation.cancelled_reason
|
# reservation.cancelled_reason
|
||||||
# and pricelist
|
# and pricelist
|
||||||
@@ -468,7 +465,7 @@ class PmsReservationLine(models.Model):
|
|||||||
@api.constrains("state")
|
@api.constrains("state")
|
||||||
def constrains_service_cancel(self):
|
def constrains_service_cancel(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
if record.state == "cancelled":
|
if record.state == "cancel":
|
||||||
room_services = record.reservation_id.service_ids
|
room_services = record.reservation_id.service_ids
|
||||||
for service in room_services:
|
for service in room_services:
|
||||||
cancel_lines = service.service_line_ids.filtered(
|
cancel_lines = service.service_line_ids.filtered(
|
||||||
|
|||||||
@@ -176,9 +176,9 @@ class PmsServiceLine(models.Model):
|
|||||||
# TODO: Review cancel logic
|
# TODO: Review cancel logic
|
||||||
# reservation = line.reservation_id.reservation_id
|
# reservation = line.reservation_id.reservation_id
|
||||||
# pricelist = reservation.pricelist_id
|
# pricelist = reservation.pricelist_id
|
||||||
# if reservation.state == "cancelled":
|
# if reservation.state == "cancel":
|
||||||
# if (
|
# if (
|
||||||
# reservation.cancelled_reason
|
# reservation.cancel_reason
|
||||||
# and pricelist
|
# and pricelist
|
||||||
# and pricelist.cancelation_rule_id
|
# and pricelist.cancelation_rule_id
|
||||||
# ):
|
# ):
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 12 KiB |
@@ -182,7 +182,7 @@ class TestPmsFolioSaleLine(TestPms):
|
|||||||
|
|
||||||
def test_comp_fsl_rooms_one_full_cancel_discount(self):
|
def test_comp_fsl_rooms_one_full_cancel_discount(self):
|
||||||
# TEST CASE
|
# TEST CASE
|
||||||
# 2-night reservation with 100% cancelled discount for 1 night
|
# 2-night reservation with 100% cancel discount for 1 night
|
||||||
# should generate just 1 reservation sale line because the
|
# should generate just 1 reservation sale line because the
|
||||||
# full cancel discount shouldn't be present @ invoice lines
|
# full cancel discount shouldn't be present @ invoice lines
|
||||||
|
|
||||||
@@ -560,7 +560,7 @@ class TestPmsFolioSaleLine(TestPms):
|
|||||||
|
|
||||||
def test_comp_fsl_board_services_one_full_cancel_discount(self):
|
def test_comp_fsl_board_services_one_full_cancel_discount(self):
|
||||||
# TEST CASE
|
# TEST CASE
|
||||||
# 2-night reservation with 100% cancelled discount for 1 board service
|
# 2-night reservation with 100% cancel discount for 1 board service
|
||||||
# should generate just 1 board service sale line because the
|
# should generate just 1 board service sale line because the
|
||||||
# full cancel discount shouldn't be present @ invoice lines
|
# full cancel discount shouldn't be present @ invoice lines
|
||||||
|
|
||||||
|
|||||||
@@ -896,7 +896,7 @@ class TestPmsReservations(common.SavepointCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@freeze_time("1981-11-10")
|
@freeze_time("1981-11-10")
|
||||||
def test_cancelled_pending_amount_priority_reservation(self):
|
def test_cancel_pending_amount_priority_reservation(self):
|
||||||
"""
|
"""
|
||||||
Cancelled with pending payments reservation must have priority = 2
|
Cancelled with pending payments reservation must have priority = 2
|
||||||
------
|
------
|
||||||
@@ -1672,7 +1672,7 @@ class TestPmsReservations(common.SavepointCase):
|
|||||||
def test_reservation_action_cancel(self):
|
def test_reservation_action_cancel(self):
|
||||||
# TEST CASE
|
# TEST CASE
|
||||||
# the reservation action cancel
|
# the reservation action cancel
|
||||||
# change the state of the reservation to 'cancelled'
|
# change the state of the reservation to 'cancel'
|
||||||
# ARRANGE
|
# ARRANGE
|
||||||
self.create_common_scenario()
|
self.create_common_scenario()
|
||||||
res = self.env["pms.reservation"].create(
|
res = self.env["pms.reservation"].create(
|
||||||
@@ -1687,7 +1687,7 @@ class TestPmsReservations(common.SavepointCase):
|
|||||||
# ACT
|
# ACT
|
||||||
res.action_cancel()
|
res.action_cancel()
|
||||||
# ASSERT
|
# ASSERT
|
||||||
self.assertEqual(res.state, "cancelled", "The reservation should be cancelled")
|
self.assertEqual(res.state, "cancel", "The reservation should be cancelled")
|
||||||
|
|
||||||
@freeze_time("1981-11-01")
|
@freeze_time("1981-11-01")
|
||||||
def test_reservation_action_checkout(self):
|
def test_reservation_action_checkout(self):
|
||||||
@@ -2210,7 +2210,7 @@ class TestPmsReservations(common.SavepointCase):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
reservation.state = "cancelled"
|
reservation.state = "cancel"
|
||||||
|
|
||||||
with self.assertRaises(UserError):
|
with self.assertRaises(UserError):
|
||||||
reservation.action_cancel()
|
reservation.action_cancel()
|
||||||
|
|||||||
@@ -89,7 +89,7 @@
|
|||||||
editable="bottom"
|
editable="bottom"
|
||||||
decoration-danger="state == 'draft'"
|
decoration-danger="state == 'draft'"
|
||||||
decoration-info="state == 'done'"
|
decoration-info="state == 'done'"
|
||||||
decoration-muted="state == 'cancelled'"
|
decoration-muted="state == 'cancel'"
|
||||||
decoration-success="state == 'onboard'"
|
decoration-success="state == 'onboard'"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
create="false"
|
create="false"
|
||||||
decoration-danger="state == 'draft'"
|
decoration-danger="state == 'draft'"
|
||||||
decoration-info="state == 'done'"
|
decoration-info="state == 'done'"
|
||||||
decoration-muted="state == 'cancelled'"
|
decoration-muted="state == 'cancel'"
|
||||||
decoration-success="state == 'onboard'"
|
decoration-success="state == 'onboard'"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
@@ -174,7 +174,7 @@
|
|||||||
<tree
|
<tree
|
||||||
create="false"
|
create="false"
|
||||||
decoration-danger="state == 'draft'"
|
decoration-danger="state == 'draft'"
|
||||||
decoration-muted="state == 'cancelled' or state =='done'"
|
decoration-muted="state == 'cancel' or state =='done'"
|
||||||
decoration-success="state == 'onboard'"
|
decoration-success="state == 'onboard'"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
@@ -262,7 +262,7 @@
|
|||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
alt="Cancelled"
|
alt="Cancelled"
|
||||||
t-if="record.state.raw_value === 'cancelled'"
|
t-if="record.state.raw_value === 'cancel'"
|
||||||
t-att-src=""pms/static/description/avatar.png""
|
t-att-src=""pms/static/description/avatar.png""
|
||||||
/>
|
/>
|
||||||
</t>
|
</t>
|
||||||
@@ -401,7 +401,7 @@
|
|||||||
string="Future"
|
string="Future"
|
||||||
name="future"
|
name="future"
|
||||||
domain="[('checkin', '>=', context_today().strftime('%Y-%m-%d')),
|
domain="[('checkin', '>=', context_today().strftime('%Y-%m-%d')),
|
||||||
('state', 'not in', ['cancelled'])]"
|
('state', 'not in', ['cancel'])]"
|
||||||
help="Show all future checkins"
|
help="Show all future checkins"
|
||||||
/>
|
/>
|
||||||
<group expand="0" string="Group By">
|
<group expand="0" string="Group By">
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
class="oe_stat_button"
|
class="oe_stat_button"
|
||||||
name="%(open_pms_reservation_form_tree_all)d"
|
name="%(open_pms_reservation_form_tree_all)d"
|
||||||
icon="fa-window-close"
|
icon="fa-window-close"
|
||||||
context="{'search_default_folio_id': id, 'default_folio_id': id, 'search_default_cancelled': True}"
|
context="{'search_default_folio_id': id, 'default_folio_id': id, 'search_default_cancel': True}"
|
||||||
attrs="{'invisible': [('number_of_cancelled_rooms', '=', 0)]}"
|
attrs="{'invisible': [('number_of_cancelled_rooms', '=', 0)]}"
|
||||||
>
|
>
|
||||||
<field
|
<field
|
||||||
@@ -565,7 +565,7 @@
|
|||||||
<field
|
<field
|
||||||
name="payment_state"
|
name="payment_state"
|
||||||
decoration-success="payment_state == 'paid'"
|
decoration-success="payment_state == 'paid'"
|
||||||
decoration-danger="payment_state == 'not_paid' and state in ['cancelled','onboard','done','arrival_delayed','departure_delayed']"
|
decoration-danger="payment_state == 'not_paid' and state in ['cancel','onboard','done','arrival_delayed','departure_delayed']"
|
||||||
decoration-info="payment_state == 'not_paid' and state in ['draft','confirm',]"
|
decoration-info="payment_state == 'not_paid' and state in ['draft','confirm',]"
|
||||||
decoration-warning="payment_state == 'partial'"
|
decoration-warning="payment_state == 'partial'"
|
||||||
widget="badge"
|
widget="badge"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
string="Confirm"
|
string="Confirm"
|
||||||
class="oe_highlight"
|
class="oe_highlight"
|
||||||
type="object"
|
type="object"
|
||||||
attrs="{'invisible':[('state','not in',('draft','cancelled'))]}"
|
attrs="{'invisible':[('state','not in',('draft','cancel'))]}"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
name="action_assign"
|
name="action_assign"
|
||||||
@@ -223,7 +223,7 @@
|
|||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="card bg-danger mb8"
|
class="card bg-danger mb8"
|
||||||
attrs="{'invisible': [('state', 'not in', ('cancelled'))]}"
|
attrs="{'invisible': [('state', 'not in', ('cancel'))]}"
|
||||||
>
|
>
|
||||||
<div class="card-body bg-danger">
|
<div class="card-body bg-danger">
|
||||||
<i class="fa fa-danger" /> Cancelled Reservation!
|
<i class="fa fa-danger" /> Cancelled Reservation!
|
||||||
@@ -346,7 +346,7 @@
|
|||||||
/>-->
|
/>-->
|
||||||
<field
|
<field
|
||||||
name="cancelled_reason"
|
name="cancelled_reason"
|
||||||
attrs="{'invisible': [('state', 'not in', ('cancelled'))]}"
|
attrs="{'invisible': [('state', 'not in', ('cancel'))]}"
|
||||||
/>
|
/>
|
||||||
<field
|
<field
|
||||||
name="adults"
|
name="adults"
|
||||||
@@ -471,7 +471,7 @@
|
|||||||
<field name="discount" />
|
<field name="discount" />
|
||||||
<field
|
<field
|
||||||
name="cancel_discount"
|
name="cancel_discount"
|
||||||
attrs="{'column_invisible': [('parent.state','!=','cancelled')]}"
|
attrs="{'column_invisible': [('parent.state','!=','cancel')]}"
|
||||||
/>
|
/>
|
||||||
<field name="pms_property_id" invisible="1" />
|
<field name="pms_property_id" invisible="1" />
|
||||||
</tree>
|
</tree>
|
||||||
@@ -659,22 +659,14 @@
|
|||||||
decoration-bf="splitted"
|
decoration-bf="splitted"
|
||||||
js_class="pms_booking_engine_request_tree"
|
js_class="pms_booking_engine_request_tree"
|
||||||
>
|
>
|
||||||
<!--TODO: charget booking engine button (view type list is not present
|
<field name="folio_id" optional="show" decoration-bf="1" />
|
||||||
in the view registry -->
|
<field name="name" optional="show" />
|
||||||
<!--js_class="pms_booking_engine_request_tree"-->
|
|
||||||
<field name="splitted" invisible="1" />
|
<field name="splitted" invisible="1" />
|
||||||
<field name="pricelist_id" invisible="1" />
|
<field name="pricelist_id" invisible="1" />
|
||||||
<field name="rooms" />
|
<field name="rooms" />
|
||||||
<field name="checkin" />
|
<field name="checkin" />
|
||||||
<field name="checkout" />
|
<field name="checkout" />
|
||||||
<field name="nights" />
|
<field name="nights" />
|
||||||
<button
|
|
||||||
type="object"
|
|
||||||
class="oe_stat_button"
|
|
||||||
icon="fa-file"
|
|
||||||
name="open_folio"
|
|
||||||
/>
|
|
||||||
<field name="folio_id" decoration-bf="1" />
|
|
||||||
<field name="allowed_room_ids" invisible="1" />
|
<field name="allowed_room_ids" invisible="1" />
|
||||||
<field name="partner_id" invisible="1" />
|
<field name="partner_id" invisible="1" />
|
||||||
<field name="partner_name" />
|
<field name="partner_name" />
|
||||||
@@ -696,7 +688,7 @@
|
|||||||
decoration-success="state == 'onboard'"
|
decoration-success="state == 'onboard'"
|
||||||
decoration-info="state == 'confirm'"
|
decoration-info="state == 'confirm'"
|
||||||
decoration-primary="state == 'departure_delayed'"
|
decoration-primary="state == 'departure_delayed'"
|
||||||
decoration-danger="state == 'cancelled'"
|
decoration-danger="state == 'cancel'"
|
||||||
decoration-bf="state == 'draft'"
|
decoration-bf="state == 'draft'"
|
||||||
decoration-warning="state == 'arrival_delayed'"
|
decoration-warning="state == 'arrival_delayed'"
|
||||||
widget="badge"
|
widget="badge"
|
||||||
@@ -705,7 +697,7 @@
|
|||||||
<field
|
<field
|
||||||
name="folio_payment_state"
|
name="folio_payment_state"
|
||||||
decoration-success="folio_payment_state == 'paid'"
|
decoration-success="folio_payment_state == 'paid'"
|
||||||
decoration-danger="folio_payment_state == 'not_paid' and state in ['cancelled','onboard','done','arrival_delayed','departure_delayed']"
|
decoration-danger="folio_payment_state == 'not_paid' and state in ['cancel','onboard','done','arrival_delayed','departure_delayed']"
|
||||||
decoration-info="folio_payment_state == 'not_paid' and state in ['draft','confirm',]"
|
decoration-info="folio_payment_state == 'not_paid' and state in ['draft','confirm',]"
|
||||||
decoration-warning="folio_payment_state == 'partial'"
|
decoration-warning="folio_payment_state == 'partial'"
|
||||||
widget="badge"
|
widget="badge"
|
||||||
@@ -790,8 +782,8 @@
|
|||||||
/>
|
/>
|
||||||
<filter
|
<filter
|
||||||
string="Cancelled"
|
string="Cancelled"
|
||||||
name="cancelled"
|
name="cancel"
|
||||||
domain="[('state', '=', 'cancelled')]"
|
domain="[('state', '=', 'cancel')]"
|
||||||
/>
|
/>
|
||||||
<filter
|
<filter
|
||||||
string="On Board"
|
string="On Board"
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ class ReservationLinesToSplit(models.TransientModel):
|
|||||||
reservation = line.reservation_wizard_id.reservation_id
|
reservation = line.reservation_wizard_id.reservation_id
|
||||||
rooms_available = False
|
rooms_available = False
|
||||||
if line.date and reservation:
|
if line.date and reservation:
|
||||||
if reservation.overbooking or reservation.state in ("cancelled"):
|
if reservation.overbooking or reservation.state in ("cancel"):
|
||||||
line.allowed_room_ids = self.env["pms.room"].search(
|
line.allowed_room_ids = self.env["pms.room"].search(
|
||||||
[("active", "=", True)]
|
[("active", "=", True)]
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user