[IMP] pms: add tests for multi channel in reservations and folio, solve their problems and precommit

This commit is contained in:
Sara Lago
2022-03-23 18:21:00 +01:00
committed by Darío Lodeiros
parent 4be7a309a5
commit 95eb5bc7e0
10 changed files with 813 additions and 90 deletions

View File

@@ -2009,6 +2009,8 @@ class PmsReservation(models.Model):
default_vals["email"] = folio.email
elif vals.get("reservation_type") != "out":
raise ValidationError(_("Partner contact name is required"))
if folio.sale_channel_origin_id and "sale_channel_origin_id" not in vals:
default_vals["sale_channel_origin_id"] = folio.sale_channel_origin_id.id
vals.update(default_vals)
elif (
"pms_property_id" in vals

View File

@@ -1098,7 +1098,7 @@ class TestPmsCheckinPartner(TestPms):
"pms_property_id": self.pms_property1.id,
"partner_name": partner.name,
"email": partner.email,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ACT
@@ -1141,7 +1141,7 @@ class TestPmsCheckinPartner(TestPms):
"room_type_id": self.room_type1.id,
"pms_property_id": self.pms_property1.id,
"partner_name": partner.name,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ACT
@@ -1187,7 +1187,7 @@ class TestPmsCheckinPartner(TestPms):
"room_type_id": self.room_type1.id,
"pms_property_id": self.pms_property1.id,
"partner_name": partner.name,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
checkin = self.env["pms.checkin.partner"].create(
@@ -1249,7 +1249,7 @@ class TestPmsCheckinPartner(TestPms):
"room_type_id": self.room_type1.id,
"pms_property_id": self.pms_property1.id,
"partner_name": partner1.name,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -1297,7 +1297,7 @@ class TestPmsCheckinPartner(TestPms):
"room_type_id": self.room_type1.id,
"pms_property_id": self.pms_property1.id,
"partner_name": "Rosa Costa",
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
checkin = self.env["pms.checkin.partner"].create(
@@ -1551,7 +1551,7 @@ class TestPmsCheckinPartner(TestPms):
"partner_id": self.host1.id,
"adults": 1,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
checkin_partner_id = self.reservation.checkin_partner_ids[0]

View File

@@ -63,7 +63,6 @@ class TestPmsFolio(TestPms):
}
)
def create_sale_channel_scenario(self):
"""
Method to simplified scenario on sale channel tests:
@@ -419,7 +418,7 @@ class TestPmsFolio(TestPms):
"adults": 2,
"partner_id": self.env.ref("base.res_partner_12").id,
"room_type_id": self.demo_room_type_double.id,
"sale_channel_origin_id":self.sale_channel_direct1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -466,7 +465,7 @@ class TestPmsFolio(TestPms):
"adults": 2,
"partner_id": self.env.ref("base.res_partner_12").id,
"room_type_id": self.demo_room_type_double.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -594,7 +593,7 @@ class TestPmsFolio(TestPms):
"pricelist_id": self.pricelist1.id,
"reservation_type": "out",
"closure_reason_id": closure_reason.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -1121,3 +1120,419 @@ class TestPmsFolio(TestPms):
folio1.partner_invoice_ids.ids,
"A checkin partner was not added as a billing contact",
)
@freeze_time("2001-10-10")
def test_folio_sale_channel_origin_in_reservation(self):
"""
Check that the reservation has sale_channel_origin_id
as the folio sale_channel_origin_id in
which reservation was created
When a reservation is created on a folio
that already has a sale_channel_origin
that reservation will have the same sale_channel_origin
"""
# ARRANGE
partner1 = self.env["res.partner"].create({"name": "partner1"})
folio1 = self.env["pms.folio"].create(
{
"pms_property_id": self.pms_property1.id,
"partner_name": partner1.name,
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ACT
reservation1 = self.env["pms.reservation"].create(
{
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
"adults": 2,
"room_type_id": self.room_type_double.id,
"folio_id": folio1.id,
}
)
# ASSERT
self.assertEqual(
reservation1.sale_channel_origin_id.id,
folio1.sale_channel_origin_id.id,
"Sale channel of reservation must be the same that it folio",
)
@freeze_time("2001-10-19")
def test_folio_sale_channel_ids(self):
"""
Check if sale_channel_ids of folio correspond to
sale_channel_origin_id of its reservations at the
time of creating a new reservation in the folio
"""
# ARRANGE
sale_channel_phone = self.env["pms.sale.channel"].create(
{
"name": "phone",
"channel_type": "direct",
}
)
partner1 = self.env["res.partner"].create({"name": "partner1"})
folio1 = self.env["pms.folio"].create(
{
"pms_property_id": self.pms_property1.id,
"partner_name": partner1.name,
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
self.env["pms.reservation"].create(
{
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
"adults": 2,
"room_type_id": self.room_type_double.id,
"folio_id": folio1.id,
}
)
self.env["pms.reservation"].create(
{
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
"adults": 2,
"room_type_id": self.room_type_double.id,
"folio_id": folio1.id,
"sale_channel_origin_id": sale_channel_phone.id,
}
)
# ACT
expected_sale_channels = []
for reservation in folio1.reservation_ids:
expected_sale_channels.append(reservation.sale_channel_origin_id.id)
# ASSERT
self.assertItemsEqual(
folio1.sale_channel_ids.ids,
list(set(expected_sale_channels)),
"Sale_channel_ids of folio must be the same as "
"sale_channel_origin of its reservation ",
)
@freeze_time("2001-10-22")
def test_folio_sale_channel_ids_reservations_several_origin(self):
"""
Check that sale_channel_ids of folio correspond to sale_channel_origin_id
of its reservations
In this case, folio1 has two reservations(reservation1, reservation2)
with the same sale_channel_origin.
sale_channel_origin_id sale_channel_ids
-------------------------
Folio1 --------> sale_channel_direct1 || sale_channel_direct1
reservation1 --> sale_channel_direct1
reservation2 --> sale_channel_direct1
Then, reservation2 update sale_channel_origin_id for a diferent one. So the folio
has several reservations with different sale_channel_origin_id.
It should be noted that the check would force having to update
the folio sale_channel_origin_id (force_update_origin) isn't marked.
Expected result:
sale_channel_origin_id sale_channel_ids
----------------------
Folio1 --------> sale_channel_direct1 | (sale_channel_direct1, sale_channel_phone)
reservation1 --> sale_channel_direct1
reservation2 --> sale_channel_phone
In this test case, sale_channel_ids will be checked
"""
# ARRANGE
sale_channel_phone = self.env["pms.sale.channel"].create(
{
"name": "phone",
"channel_type": "direct",
}
)
partner1 = self.env["res.partner"].create({"name": "partner1"})
folio1 = self.env["pms.folio"].create(
{
"pms_property_id": self.pms_property1.id,
"partner_name": partner1.name,
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
self.env["pms.reservation"].create(
{
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
"adults": 2,
"room_type_id": self.room_type_double.id,
"folio_id": folio1.id,
}
)
reservation2 = self.env["pms.reservation"].create(
{
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
"adults": 2,
"room_type_id": self.room_type_double.id,
"folio_id": folio1.id,
}
)
# ACT
reservation_vals = {
"sale_channel_origin_id": sale_channel_phone.id,
"force_update_origin": False,
}
reservation2.write(reservation_vals)
expected_sale_channels = []
for reservation in folio1.reservation_ids:
expected_sale_channels.append(reservation.sale_channel_origin_id.id)
# ASSERT
self.assertItemsEqual(
folio1.sale_channel_ids.ids,
list(set(expected_sale_channels)),
"Sale_channel_ids of folio must be the same as "
"sale_channel_origin of its reservation ",
)
@freeze_time("2001-10-22")
def test_sale_channel_origin_id_reservation_not_update_origin(self):
"""
Check that sale_channel_origin_id of folio doesn't change
when sale_channel_origin_id of one of its reservations is updated
but the check isn't checked
In this case, folio1 has two reservations(reservation1, reservation2)
with the same sale_channel_origin.
sale_channel_origin_id
-------------------------
Folio1 --------> sale_channel_direct1
reservation1 --> sale_channel_direct1
reservation2 --> sale_channel_direct1
Then, reservation2 update sale_channel_origin_id for a diferent one. So the folio
has several reservations with different sale_channel_origin_id.
And the check would force having to update
the folio sale_channel_origin_id (force_update_origin) isn't marked.
So sale_channel_origin_id of folio shouldn't change.
Expected result:
sale_channel_origin_id
-------------------------
Folio1 --------> sale_channel_direct1
reservation1 --> sale_channel_direct1
reservation2 --> sale_channel_phone
In this test case, sale_channel_origin_id of folio will be checked
"""
# ARRANGE
sale_channel_phone = self.env["pms.sale.channel"].create(
{
"name": "phone",
"channel_type": "direct",
}
)
partner1 = self.env["res.partner"].create({"name": "partner1"})
folio1 = self.env["pms.folio"].create(
{
"pms_property_id": self.pms_property1.id,
"partner_name": partner1.name,
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
self.env["pms.reservation"].create(
{
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
"adults": 2,
"room_type_id": self.room_type_double.id,
"folio_id": folio1.id,
}
)
reservation2 = self.env["pms.reservation"].create(
{
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
"adults": 2,
"room_type_id": self.room_type_double.id,
"folio_id": folio1.id,
}
)
# ACT
reservation_vals = {
"sale_channel_origin_id": sale_channel_phone.id,
"force_update_origin": False,
}
reservation2.write(reservation_vals)
# ASSERT
self.assertNotEqual(
folio1.sale_channel_origin_id,
reservation2.sale_channel_origin_id,
"Sale_channel_origin_id of folio shouldn't be the same as "
"sale_channel_origin of reservation2",
)
@freeze_time("2001-10-25")
def test_sale_channel_origin_id_reservation_update_origin(self):
"""
Check that sale_channel_origin_id of the folio changes when
you change sale_channel_origin_id of one of its reservations
and check that forces the update of sale_channel_origin_id of folio
sale_channel_origin_id
-------------------------
Folio1 --------> sale_channel_direct1
reservation1 --> sale_channel_direct1
reservation2 --> sale_channel_direct1
Then, reservation2 update sale_channel_origin_id for a diferent one. So the folio
has several reservations with different sale_channel_origin_id.
And the check would force having to update
the folio sale_channel_origin_id (force_update_origin) is marked.
So sale_channel_origin_id of folio must change.
Expected result:
sale_channel_origin_id
-------------------------
Folio1 --------> sale_channel_phone
reservation1 --> sale_channel_phone
reservation2 --> sale_channel_phone
In this test case, sale_channel_origin_id of folio1 will be checked
"""
# ARRANGE
sale_channel_phone = self.env["pms.sale.channel"].create(
{
"name": "phone",
"channel_type": "direct",
}
)
partner1 = self.env["res.partner"].create({"name": "partner1"})
folio1 = self.env["pms.folio"].create(
{
"pms_property_id": self.pms_property1.id,
"partner_name": partner1.name,
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
self.env["pms.reservation"].create(
{
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
"adults": 2,
"room_type_id": self.room_type_double.id,
"folio_id": folio1.id,
}
)
reservation2 = self.env["pms.reservation"].create(
{
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
"adults": 2,
"room_type_id": self.room_type_double.id,
"folio_id": folio1.id,
}
)
# ACT
reservation_vals = {
"sale_channel_origin_id": sale_channel_phone.id,
"force_update_origin": True,
}
reservation2.write(reservation_vals)
# ASSERT
self.assertEqual(
folio1.sale_channel_origin_id,
reservation2.sale_channel_origin_id,
"Sale_channel_origin_id of folio should be updated",
)
@freeze_time("2001-10-25")
def test_sale_channel_origin_id_reservation_update_reservations(self):
"""
Check that sale_channel_origin_id of a reservation changes when
another reservation of the same folio changes sale_channel_origin_id
and marks the check.
By changing sale_channel_origin_ id of a reservation and marking the check
that forces the update, changes both sale_channel_origin of folio and
sale_channel_origin of reservations that had the same
sale_channel_origin_id
-------------------------
Folio1 --------> sale_channel_direct1
reservation1 --> sale_channel_direct1
reservation2 --> sale_channel_direct1
Then, reservation2 update sale_channel_origin_id for a diferent one.
And the check would force having to update
the folio sale_channel_origin_id (force_update_origin) is marked.
So sale_channel_origin_id of folio and other reservations with the same
sale_channel_origin must change.
Expected result:
sale_channel_origin_id
-------------------------
Folio1 --------> sale_channel_phone
reservation1 --> sale_channel_phone
reservation2 --> sale_channel_phone
In this test case, sale_channel_origin_id of reservation1 will be checked
"""
# ARRANGE
sale_channel_phone = self.env["pms.sale.channel"].create(
{
"name": "phone",
"channel_type": "direct",
}
)
partner1 = self.env["res.partner"].create({"name": "partner1"})
folio1 = self.env["pms.folio"].create(
{
"pms_property_id": self.pms_property1.id,
"partner_name": partner1.name,
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
reservation1 = self.env["pms.reservation"].create(
{
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
"adults": 2,
"room_type_id": self.room_type_double.id,
"folio_id": folio1.id,
}
)
reservation2 = self.env["pms.reservation"].create(
{
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
"adults": 2,
"room_type_id": self.room_type_double.id,
"folio_id": folio1.id,
}
)
# ACT
reservation_vals = {
"sale_channel_origin_id": sale_channel_phone.id,
"force_update_origin": True,
}
reservation2.write(reservation_vals)
# ASSERT
self.assertEqual(
reservation1.sale_channel_origin_id,
reservation2.sale_channel_origin_id,
"sale_channel_origin_id of reservations that coincided "
"with sale_channel_origin_id of folio de should be updated",
)

View File

@@ -161,7 +161,7 @@ class TestPmsFolioInvoice(TestPms):
"adults": 2,
"room_type_id": self.room_type_double.id,
"partner_id": self.partner_id.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
state_expected = "invoiced"
@@ -192,7 +192,7 @@ class TestPmsFolioInvoice(TestPms):
"adults": 2,
"room_type_id": self.room_type_double.id,
"partner_id": self.partner_id.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
dict_lines = dict()
@@ -218,7 +218,7 @@ class TestPmsFolioInvoice(TestPms):
"adults": 2,
"room_type_id": self.room_type_double.id,
"partner_id": self.partner_id.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
dict_lines = dict()
@@ -271,7 +271,7 @@ class TestPmsFolioInvoice(TestPms):
"adults": 2,
"room_type_id": self.room_type_double.id,
"partner_id": self.env.ref("base.res_partner_12").id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
tcs = [-1, 0, 3]
@@ -306,7 +306,7 @@ class TestPmsFolioInvoice(TestPms):
"adults": 2,
"room_type_id": self.room_type_double.id,
"partner_id": self.partner_id.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -334,7 +334,7 @@ class TestPmsFolioInvoice(TestPms):
"adults": 2,
"room_type_id": self.room_type_double.id,
"partner_id": self.partner_id.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
qty_to_invoice_expected = sum(
@@ -362,7 +362,7 @@ class TestPmsFolioInvoice(TestPms):
"adults": 2,
"room_type_id": self.room_type_double.id,
"partner_id": self.partner_id.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.folio_id._create_invoices()
@@ -392,7 +392,7 @@ class TestPmsFolioInvoice(TestPms):
"room_type_id": self.room_type_double.id,
"partner_id": self.partner_id.id,
"service_ids": [(6, 0, [self.service1.id])],
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -436,7 +436,7 @@ class TestPmsFolioInvoice(TestPms):
"room_type_id": self.room_type_double.id,
"partner_id": self.partner_id.id,
"service_ids": [(6, 0, [self.service1.id])],
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -481,7 +481,7 @@ class TestPmsFolioInvoice(TestPms):
"room_type_id": self.room_type_double.id,
"partner_id": self.partner_id.id,
"service_ids": [(6, 0, [self.service1.id])],
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -544,7 +544,7 @@ class TestPmsFolioInvoice(TestPms):
"room_type_id": self.room_type_double.id,
"partner_id": self.partner_id.id,
"board_service_room_id": self.board_service_room_type1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
dict_lines = dict()
@@ -600,7 +600,7 @@ class TestPmsFolioInvoice(TestPms):
"room_type_id": self.room_type_double.id,
"partner_id": self.partner_id.id,
"board_service_room_id": self.board_service_room_type1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
dict_lines = dict()
@@ -657,7 +657,7 @@ class TestPmsFolioInvoice(TestPms):
"room_type_id": self.room_type_double.id,
"partner_id": self.partner_id.id,
"board_service_room_id": self.board_service_room_type1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
dict_lines = dict()

View File

@@ -87,6 +87,7 @@ class TestPmsFolioSaleLine(TestPms):
"channel_type": "direct",
}
)
# RESERVATION LINES
def test_comp_fsl_rooms_all_same_group(self):
"""

View File

@@ -128,7 +128,7 @@ class TestPmsPricelist(TestPms):
"pms_property_id": self.pms_property1.id,
"pricelist_id": self.pricelist2.id,
"board_service_room_id": self.board_service_room_type1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -176,7 +176,7 @@ class TestPmsPricelist(TestPms):
"pms_property_id": self.pms_property1.id,
"pricelist_id": self.pricelist2.id,
"board_service_room_id": self.board_service_room_type1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -221,7 +221,7 @@ class TestPmsPricelist(TestPms):
"pms_property_id": self.pms_property1.id,
"pricelist_id": self.pricelist2.id,
"board_service_room_id": self.board_service_room_type1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -270,7 +270,7 @@ class TestPmsPricelist(TestPms):
"pms_property_id": self.pms_property1.id,
"pricelist_id": self.pricelist2.id,
"board_service_room_id": self.board_service_room_type1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -317,7 +317,7 @@ class TestPmsPricelist(TestPms):
"preferred_room_id": self.room1.id,
"pms_property_id": self.pms_property1.id,
"pricelist_id": self.pricelist2.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -364,7 +364,7 @@ class TestPmsPricelist(TestPms):
"preferred_room_id": self.room1.id,
"pms_property_id": self.pms_property1.id,
"pricelist_id": self.pricelist2.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -407,7 +407,7 @@ class TestPmsPricelist(TestPms):
"preferred_room_id": self.room1.id,
"pms_property_id": self.pms_property1.id,
"pricelist_id": self.pricelist2.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -454,7 +454,7 @@ class TestPmsPricelist(TestPms):
"preferred_room_id": self.room1.id,
"pms_property_id": self.pms_property1.id,
"pricelist_id": self.pricelist2.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -501,7 +501,7 @@ class TestPmsPricelist(TestPms):
"pms_property_id": self.pms_property1.id,
"pricelist_id": self.pricelist2.id,
"service_ids": [(0, 0, {"product_id": self.product1.id})],
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -548,7 +548,7 @@ class TestPmsPricelist(TestPms):
"pms_property_id": self.pms_property1.id,
"pricelist_id": self.pricelist2.id,
"service_ids": [(0, 0, {"product_id": self.product1.id})],
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -591,7 +591,7 @@ class TestPmsPricelist(TestPms):
"pms_property_id": self.pms_property1.id,
"pricelist_id": self.pricelist2.id,
"service_ids": [(0, 0, {"product_id": self.product1.id})],
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -638,7 +638,7 @@ class TestPmsPricelist(TestPms):
"pms_property_id": self.pms_property1.id,
"pricelist_id": self.pricelist2.id,
"service_ids": [(0, 0, {"product_id": self.product1.id})],
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -802,7 +802,7 @@ class TestPmsPricelist(TestPms):
"preferred_room_id": self.room.id,
"pms_property_id": self.pms_property1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ACT
@@ -1251,7 +1251,7 @@ class TestPmsPricelist(TestPms):
"preferred_room_id": self.room.id,
"pms_property_id": self.pms_property1.id,
"pricelist_id": self.pricelist1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
reservation_price = reservation.price_subtotal

View File

@@ -3796,6 +3796,7 @@ class TestPmsReservations(TestPms):
self.commission
+ service.price_total * self.agency1.default_commission / 100
)
# ASSERT
self.assertEqual(
self.commission,
reservation.commission_amount,
@@ -3867,3 +3868,309 @@ class TestPmsReservations(TestPms):
"The out of service reservation should be created properly with "
"a closure reason.",
)
# tests for several sale channels in reservation
@freeze_time("2000-11-10")
def test_reservation_sale_channel_origin_in_reservation_lines(self):
"""
Check that reservation_lines have sale_channel_id
corresponding to sale_channel_origin_id of their reservation
When a reservation was created with a sale channel, it corresponds
to the sale_channel_origin.
Reservation lines will have as sale_channel_id the sale_channel_origin_id
of reservation when creating them
"""
# ARRANGE
checkin = fields.date.today()
checkout = checkin + datetime.timedelta(days=3)
reservation_vals = {
"checkin": checkin,
"checkout": checkout,
"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,
}
# ACT
reservation = self.env["pms.reservation"].create(reservation_vals)
# ASSERT
self.assertEqual(
reservation.sale_channel_origin_id,
reservation.reservation_line_ids.mapped("sale_channel_id"),
"Sale channel of reservation lines must be the same that their reservation",
)
@freeze_time("2000-10-10")
def test_reservation_sale_channel_origin_in_folio(self):
"""
Check that folio have sale_channel_origin_id
corresponding to sale_channel_origin_id of the reservation
that was created before the folio
When a reservation was created with a sale channel, it corresponds
to the sale_channel_origin.
If reservation didn't have folio previously, the folio to be created
will have the same sale_channel_origin as the reservation
"""
# ARRANGE
checkin = fields.date.today()
checkout = checkin + datetime.timedelta(days=3)
reservation_vals = {
"checkin": checkin,
"checkout": checkout,
"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,
}
# ACT
reservation = self.env["pms.reservation"].create(reservation_vals)
# ASSERT
self.assertEqual(
reservation.sale_channel_origin_id,
reservation.folio_id.sale_channel_origin_id,
"Sale channel of folio must be the same that it reservation",
)
@freeze_time("2001-10-15")
def test_reservation_sale_channel_origin_of_folio(self):
"""
Check that the reservation has sale_channel_origin_id
as the folio sale_channel_origin_id in
which reservation was created when a folio has already
another reservations.
Testing whether it works when the folio sale_channel_origin_id
is given by a previously created reservation
When a reservation is created on a folio
that already has a sale_channel_origin
that reservation will have the same sale_channel_origin
"""
# ARRANGE
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
reservation2 = self.env["pms.reservation"].create(
{
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
"adults": 2,
"room_type_id": self.room_type_double.id,
"partner_id": self.partner1.id,
"folio_id": reservation1.folio_id.id,
}
)
# ASSERT
self.assertEqual(
reservation1.sale_channel_origin_id.id,
reservation2.sale_channel_origin_id.id,
"Sale channel of reservations must be the same",
)
@freeze_time("2000-10-19")
def test_reservation_lines_same_sale_channel(self):
"""
Check if sale_channel_ids of reservation correspond to
sale_channel_id of its reservation.
In this case, the reservation has several reservation_lines
with the same sale_channel_id. Reservation lines are created
with sale_channel_origin_id of the reservation and haven't been
modified.
"""
# ARRANGE
reservation_vals = {
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=4),
"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,
}
# ACT
reservation1 = self.env["pms.reservation"].create(reservation_vals)
# ASSERT
self.assertEqual(
reservation1.sale_channel_ids,
reservation1.reservation_line_ids.mapped("sale_channel_id"),
"Sale_channel_ids of reservation must be the same as "
"sale channels of its reservation lines",
)
@freeze_time("2000-10-24")
def test_reservation_sale_channel_origin_change_check_lines(self):
"""
Check that sale_channel_id of reservation_lines changes when
sale_channel_origin_id of its reservation has changed
"""
# ARRANGE
sale_channel_direct2 = self.env["pms.sale.channel"].create(
{
"name": "sale channel 2",
"channel_type": "direct",
}
)
reservation_vals = {
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=4),
"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
reservation1.sale_channel_origin_id = sale_channel_direct2.id
# ASSERT
self.assertEqual(
reservation1.sale_channel_origin_id,
reservation1.reservation_line_ids.mapped("sale_channel_id"),
"Sale_channel_id of reservation lines must also be changed",
)
@freeze_time("2000-10-29")
def test_reservation_lines_not_change_sale_channel(self):
"""
Check that when changing sale_channel_origin_id of a reservation,
reservation lines that didn't have the same sale_channel_id didn't
change it
Reservation1:
--> sale_channel_origin_id : sale_channel1.id
--> reservation_lines:
--> 1: sale_channel_id: sale_channel1.id
--> 2: sale_channel_id: sale_channel1.id
--> 3: sale_channel_id: sale_channel1.id
--> 4: sale_channel_id: sale_channel_phone.id
Change reservation1.sale_channel_origin_id = sale_channel_mail.id
Expected result:
Reservation1:
--> sale_channel_origin_id : sale_channel_mail.id
--> reservation_lines:
--> 1: sale_channel_id: sale_channel_mail.id
--> 2: sale_channel_id: sale_channel_mail.id
--> 3: sale_channel_id: sale_channel_mail.id
--> 4: sale_channel_id: sale_channel_phone.id
In short, sale channel of those reservations lines of the reservation
that didn't coincide with sale chanel origin that has been modified,
shouldn't be changed. That is, the last reservation_line must have
sale_channel_id = sale_channel_phone
"""
# ARRANGE
sale_channel_phone = self.env["pms.sale.channel"].create(
{
"name": "phone",
"channel_type": "direct",
}
)
sale_channel_mail = self.env["pms.sale.channel"].create(
{
"name": "mail",
"channel_type": "direct",
}
)
reservation_vals = {
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=4),
"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
reservation_lines = reservation1.reservation_line_ids
reservation_lines[
len(reservation_lines) - 1
].sale_channel_id = sale_channel_phone.id
reservation1.sale_channel_origin_id = sale_channel_mail
# ASSERT
self.assertNotEqual(
reservation1.sale_channel_origin_id,
reservation_lines[len(reservation_lines) - 1].sale_channel_id,
"Sale_channel_id of that reservation line shouldn't have changed",
)
@freeze_time("2000-11-29")
def test_several_sale_channel_in_lines(self):
"""
Check that when a reservation has more than one sale_channel_id
in its reservation_lines, sale_channel_ids of reservation is well
calculated
"""
# 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=4),
"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
reservation_lines = reservation1.reservation_line_ids
reservation_lines[0].sale_channel_id = sale_channel_phone.id
expected_sale_channels = []
for line in reservation_lines:
expected_sale_channels.append(line.sale_channel_id.id)
# ASSERT
self.assertItemsEqual(
reservation1.sale_channel_ids.ids,
list(set(expected_sale_channels)),
"Sale_channel_ids of that reservation must match those of its lines",
)
@freeze_time("2000-12-01")
def test_reservation_no_sale_channel_origin(self):
"""
Check that you cann't create a reservation without sale_channel_origin
"""
# ACT & ASSERT
with self.assertRaises(
ValidationError,
msg="Error, it has been allowed to create a reservation without sale channel",
):
self.env["pms.reservation"].create(
{
"room_type_id": self.room_type_double.id,
"partner_id": self.partner1.id,
"pms_property_id": self.pms_property1.id,
"checkin": datetime.datetime.now(),
"checkout": datetime.datetime.now() + datetime.timedelta(days=4),
}
)

View File

@@ -64,7 +64,6 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
}
)
# UNIFY TESTS # review
def test_unify_reservation_avail_should(self):
"""
@@ -92,7 +91,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()
@@ -129,7 +128,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room2.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r2 = self.env["pms.reservation"].create(
@@ -140,7 +139,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1 = self.env["pms.reservation"].create(
@@ -151,7 +150,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"room_type_id": self.test_room_type_double.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r2.flush()
@@ -177,7 +176,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r2 = self.env["pms.reservation"].create(
@@ -188,7 +187,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room2.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r2.flush()
@@ -230,7 +229,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r2 = self.env["pms.reservation"].create(
@@ -241,7 +240,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room2.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()
@@ -291,7 +290,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r2 = self.env["pms.reservation"].create(
@@ -302,7 +301,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room2.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()
@@ -351,7 +350,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r2 = self.env["pms.reservation"].create(
@@ -362,7 +361,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room2.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()
@@ -415,7 +414,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r2 = self.env["pms.reservation"].create(
@@ -426,7 +425,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room2.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()
@@ -479,7 +478,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r2 = self.env["pms.reservation"].create(
@@ -490,7 +489,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room2.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()
@@ -540,7 +539,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room2.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -587,7 +586,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -599,7 +598,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r2 = self.env["pms.reservation"].create(
@@ -610,7 +609,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room2.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()
@@ -662,7 +661,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -674,7 +673,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r2 = self.env["pms.reservation"].create(
@@ -685,7 +684,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room2.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()
@@ -731,7 +730,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room2.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -769,7 +768,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()
@@ -807,7 +806,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()
@@ -854,7 +853,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()
@@ -897,7 +896,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()
@@ -937,7 +936,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()
@@ -968,7 +967,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()
@@ -998,7 +997,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room2.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1 = self.env["pms.reservation"].create(
@@ -1009,7 +1008,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"adults": 2,
"preferred_room_id": self.room1.id,
"partner_id": self.partner1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.flush()

View File

@@ -76,7 +76,7 @@ class TestProductTemplate(TestPms):
"pms_property_id": self.pms_property1.id,
"partner_id": self.partner.id,
"board_service_room_id": board_service_room_type.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -123,7 +123,7 @@ class TestProductTemplate(TestPms):
"pms_property_id": self.pms_property1.id,
"partner_id": self.partner.id,
"board_service_room_id": board_service_room_type.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
# ASSERT
@@ -171,7 +171,7 @@ class TestProductTemplate(TestPms):
"pms_property_id": self.pms_property1.id,
"partner_id": self.partner.id,
"board_service_room_id": board_service_room_type.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
reservation.flush()
@@ -221,7 +221,7 @@ class TestProductTemplate(TestPms):
"pms_property_id": self.pms_property1.id,
"partner_id": self.partner.id,
"board_service_room_id": board_service_room_type.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
reservation.flush()
@@ -278,7 +278,7 @@ class TestProductTemplate(TestPms):
"partner_id": self.partner.id,
"board_service_room_id": board_service_room_type.id,
"adults": 2,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -310,7 +310,7 @@ class TestProductTemplate(TestPms):
"pms_property_id": self.pms_property1.id,
"partner_id": self.partner.id,
"service_ids": [extra_bed_service.id],
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
reservation._check_adults()

View File

@@ -93,7 +93,6 @@ class TestPmsSharedRoom(TestPms):
}
)
def test_count_avail_beds_with_room_occupied(self):
"""
Check that not allow to create a bed reservation with a room occupied
@@ -113,7 +112,7 @@ class TestPmsSharedRoom(TestPms):
"checkin": today,
"checkout": tomorrow,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -147,7 +146,7 @@ class TestPmsSharedRoom(TestPms):
"checkin": today,
"checkout": tomorrow,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -193,7 +192,7 @@ class TestPmsSharedRoom(TestPms):
"checkin": today,
"checkout": tomorrow,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -229,7 +228,7 @@ class TestPmsSharedRoom(TestPms):
"checkin": today,
"checkout": tomorrow,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
res1.flush()
@@ -263,7 +262,7 @@ class TestPmsSharedRoom(TestPms):
"checkin": today,
"checkout": tomorrow,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -299,7 +298,7 @@ class TestPmsSharedRoom(TestPms):
"checkin": today,
"checkout": tomorrow,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -336,7 +335,7 @@ class TestPmsSharedRoom(TestPms):
"checkin": today,
"checkout": tomorrow,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -371,7 +370,7 @@ class TestPmsSharedRoom(TestPms):
"checkin": today,
"checkout": tomorrow,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -387,7 +386,7 @@ class TestPmsSharedRoom(TestPms):
"checkin": today,
"checkout": tomorrow,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r_test.flush()
@@ -412,7 +411,7 @@ class TestPmsSharedRoom(TestPms):
"checkin": today,
"checkout": tomorrow,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
@@ -429,7 +428,7 @@ class TestPmsSharedRoom(TestPms):
"checkin": today,
"checkout": tomorrow,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r_test.flush()
@@ -455,7 +454,7 @@ class TestPmsSharedRoom(TestPms):
"checkin": today,
"checkout": tomorrow,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.action_cancel()
@@ -492,7 +491,7 @@ class TestPmsSharedRoom(TestPms):
"checkin": today,
"checkout": tomorrow,
"pms_property_id": self.pms_property1.id,
"sale_channel_origin_id": self.sale_channel_direct1.id
"sale_channel_origin_id": self.sale_channel_direct1.id,
}
)
r1.action_cancel()