mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
@@ -595,18 +595,14 @@ class PmsReservation(models.Model):
|
||||
compute="_compute_services_discount",
|
||||
tracking=True,
|
||||
)
|
||||
date_order = fields.Date(
|
||||
date_order = fields.Datetime(
|
||||
string="Date Order",
|
||||
help="Order date of reservation",
|
||||
compute="_compute_date_order",
|
||||
default=fields.Datetime.now,
|
||||
store=True,
|
||||
readonly=False,
|
||||
)
|
||||
|
||||
def _compute_date_order(self):
|
||||
for record in self:
|
||||
record.date_order = datetime.datetime.today()
|
||||
|
||||
@api.depends(
|
||||
"checkin",
|
||||
"checkout",
|
||||
|
||||
@@ -1731,7 +1731,7 @@ class TestPmsReservations(TestPms):
|
||||
with self.assertRaises(UserError):
|
||||
self.reservation_test.write(test_case)
|
||||
|
||||
def _test_check_date_order(self):
|
||||
def test_check_date_order(self):
|
||||
"""
|
||||
Check that the date order of a reservation is correct.
|
||||
---------------
|
||||
@@ -1746,14 +1746,24 @@ class TestPmsReservations(TestPms):
|
||||
}
|
||||
)
|
||||
|
||||
date_order = reservation.date_order
|
||||
date_order_expected = datetime.datetime(
|
||||
date_order.year,
|
||||
date_order.month,
|
||||
date_order.day,
|
||||
date_order.hour,
|
||||
date_order.minute,
|
||||
date_order.second,
|
||||
)
|
||||
|
||||
reservation.flush()
|
||||
self.assertEqual(
|
||||
str(reservation.date_order),
|
||||
str(fields.date.today()),
|
||||
date_order,
|
||||
date_order_expected,
|
||||
"Date Order isn't correct",
|
||||
)
|
||||
|
||||
def _test_check_checkin_datetime(self):
|
||||
def test_check_checkin_datetime(self):
|
||||
"""
|
||||
Check that the checkin datetime of a reservation is correct.
|
||||
------------------
|
||||
@@ -1770,7 +1780,7 @@ class TestPmsReservations(TestPms):
|
||||
)
|
||||
r = reservation.checkin
|
||||
checkin_expected = datetime.datetime(r.year, r.month, r.day, 14, 00)
|
||||
# checkin_expected = checkin_expected.astimezone(self.property.tz.value)
|
||||
checkin_expected = self.pms_property1.date_property_timezone(checkin_expected)
|
||||
|
||||
self.assertEqual(
|
||||
str(reservation.checkin_datetime),
|
||||
@@ -2305,14 +2315,14 @@ class TestPmsReservations(TestPms):
|
||||
reservation.cancelled_reason, "intime", "Cancelled reason must be 'intime'"
|
||||
)
|
||||
|
||||
def _test_cancelation_reason_late(self):
|
||||
def test_cancelation_reason_late(self):
|
||||
"""
|
||||
Check that if a reservation is canceled outside the cancellation
|
||||
period, the canceled_reason field of the reservation must be "late" .
|
||||
---------
|
||||
Create a cancellation rule with the days_late = 3 field.
|
||||
A reservation is created with a check-in date for tomorrow and the
|
||||
action_cancel method is launched. As the reservation was canceled
|
||||
Create a cancellation rule with the field days_intime = 3.
|
||||
A reservation is created with a checkin date for tomorrow and the
|
||||
action_cancel() method is launched. As the reservation was canceled
|
||||
after the deadline, the canceled_reason field must be late
|
||||
"""
|
||||
Pricelist = self.env["product.pricelist"]
|
||||
@@ -2320,7 +2330,7 @@ class TestPmsReservations(TestPms):
|
||||
{
|
||||
"name": "Cancelation Rule Test",
|
||||
"pms_property_ids": [self.pms_property1.id],
|
||||
"days_late": 3,
|
||||
"days_intime": 3,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user