[TMP]pms: Disabled constrain channel type ids reservation

This commit is contained in:
Darío Lodeiros
2022-09-24 16:21:06 +02:00
parent 49ad1b22d2
commit 8726e8c630

View File

@@ -4214,36 +4214,41 @@ class TestPmsReservations(TestPms):
"sale_channel_origin of rservation",
)
@freeze_time("2000-12-10")
def test_check_sale_channel_origin_in_reservation_lines(self):
"""
Check that a reservation has at least one reservation_line woth the
same sale_channel_id as its sale_channel_origin_id
"""
# ARRANGE
sale_channel_phone = self.env["pms.sale.channel"].create(
{
"name": "phone",
"channel_type": "direct",
}
)
reservation_vals = {
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
"room_type_id": self.room_type_double.id,
"partner_id": self.partner1.id,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct.id,
}
reservation1 = self.env["pms.reservation"].create(reservation_vals)
# ACT & ASSERT
with self.assertRaises(
ValidationError,
msg="Error, there cannot be a reservation in which at least one of its reservation"
"lines doesn't have as sale_channel_id the sale_channel_origin_id of reservation",
):
reservation1.reservation_line_ids.write(
{"sale_channel_id": sale_channel_phone}
)
reservation1.flush()
# TEMPORAL UNABLE (_check_lines_with_sale_channel_id in pms_reservation.py
# unable to allow updagrade version)
# @freeze_time("2000-12-10")
# def test_check_sale_channel_origin_in_reservation_lines(self):
# """
# Check that a reservation has at least one reservation_line woth the
# same sale_channel_id as its sale_channel_origin_id
# """
# # ARRANGE
# sale_channel_phone = self.env["pms.sale.channel"].create(
# {
# "name": "phone",
# "channel_type": "direct",
# }
# )
# reservation_vals = {
# "checkin": datetime.datetime.now(),
# "checkout": datetime.datetime.now() + datetime.timedelta(days=1),
# "room_type_id": self.room_type_double.id,
# "partner_id": self.partner1.id,
# "pms_property_id": self.pms_property1.id,
# "sale_channel_origin_id": self.sale_channel_direct.id,
# }
# reservation1 = self.env["pms.reservation"].create(reservation_vals)
# reservation1.fetch()
# # ACT & ASSERT
# with self.assertRaises(
# ValidationError,
# msg="""
# Error, there cannot be a reservation
# in which at least one of its reservation
# """
# "lines doesn't have as sale_channel_id the sale_channel_origin_id of reservation",
# ):
# reservation1.reservation_line_ids.write(
# {"sale_channel_id": sale_channel_phone}
# )
# reservation1.flush()