mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
* [IMP] add multiproperties demo data * [IMP] add multiproperties checks in res_users * [IMP] add test case in test_res_users * [IMP] Add multiproperty checks in pms_amenity and pms_amenity_type * [IMP] Add multiproperty in pms_board_service_room_type(pending review) * [IMP] Add test case in test_pms_room_type_availability_rule to check multiproperties * [IMP] Fixing test case in test_pms_room_type_availability_rule to check multiproperties * [IMP] Add test case in test_pms_room_type_availability_rule * [IMP] Removed field default_availability_plan_id from pms_property * [IMP] Add multiproperty in pms_room_type_available_plan * [IMP] pms: adding property in rooms_available * [IMP] Add multiproperty in pms_room_type_availability_rule and product_pricelist(work in progress) * [IMP] Add multiproperty in product_pricelist and product_pricelist_item * [IMP] add multiproperties demo data * [IMP] add multiproperties checks in res_users * [IMP] add test case in test_res_users and pms_room_type_availability_rule * [IMP] Add multiproperty checks in pms_amenity and pms_amenity_type * [IMP] Add multiproperty in pms_board_service_room_type(pending review) * [IMP] Removed field default_availability_plan_id from pms_property * [IMP] Add multiproperty in pms_room_type_available_plan * [IMP] pms: adding property in rooms_available * [IMP] Add multiproperty in pms_room_type_availability_rule and product_pricelist(work in progress) * [IMP] Add multiproperty in product_pricelist and product_pricelist_item * [IMP] Pms: add compute_folio method in pms.service * [IMP] Pms: add multiproperty integrity checks between room_type and its class * [IMP] Pms: pms_property_id related to folio * [IMP] Pms: add multiproperty integrity checks in pms_room with pms_room_type and pms_floor * [IMP] Pms: adding multiproperty checks in room_type(work in progress) * [IMP] Pms: Add property rules * [FIX]pms: external ids security rules * [FIX]pms: property checks * [FIX]pms: get product on pricelist item multiproperty check * [FIX]pms: delete test field default_plan * [FIX]pms: property constrain to product from room type model * [FIX]pms: ids references * [IMP]pms: folio wizard price flow on odoo standar Co-authored-by: Darío Lodeiros <dario@commitsun.com>
658 lines
22 KiB
Python
658 lines
22 KiB
Python
import datetime
|
|
|
|
from freezegun import freeze_time
|
|
|
|
from odoo import fields
|
|
|
|
from .common import TestHotel
|
|
|
|
|
|
@freeze_time("1980-12-01")
|
|
class TestPmsWizardMassiveChanges(TestHotel):
|
|
def create_common_scenario(self):
|
|
# PRICELIST CREATION
|
|
self.test_pricelist = self.env["product.pricelist"].create(
|
|
{
|
|
"name": "test pricelist 1",
|
|
}
|
|
)
|
|
self.test_pricelist.flush()
|
|
|
|
# AVAILABILITY PLAN CREATION
|
|
self.test_availability_plan = self.env[
|
|
"pms.room.type.availability.plan"
|
|
].create(
|
|
{
|
|
"name": "Availability plan for TEST",
|
|
"pms_pricelist_ids": [(6, 0, [self.test_pricelist.id])],
|
|
}
|
|
)
|
|
self.test_availability_plan.flush()
|
|
|
|
# PROPERTY CREATION (WITH DEFAULT PRICELIST AND AVAILABILITY PLAN
|
|
self.test_property = self.env["pms.property"].create(
|
|
{
|
|
"name": "MY PMS TEST",
|
|
"company_id": self.env.ref("base.main_company").id,
|
|
"default_pricelist_id": self.test_pricelist.id,
|
|
}
|
|
)
|
|
self.test_property.flush()
|
|
|
|
# CREATION OF ROOM TYPE CLASS
|
|
self.test_room_type_class = self.env["pms.room.type.class"].create(
|
|
{"name": "Room"}
|
|
)
|
|
self.test_room_type_class.flush()
|
|
|
|
# CREATION OF ROOM TYPE (WITH ROOM TYPE CLASS)
|
|
self.test_room_type_single = self.env["pms.room.type"].create(
|
|
{
|
|
"pms_property_ids": [self.test_property.id],
|
|
"name": "Single Test",
|
|
"code_type": "SNG_Test",
|
|
"class_id": self.test_room_type_class.id,
|
|
"list_price": 25.0,
|
|
}
|
|
)
|
|
self.test_room_type_single.flush()
|
|
|
|
# CREATION OF ROOM TYPE (WITH ROOM TYPE CLASS)
|
|
self.test_room_type_double = self.env["pms.room.type"].create(
|
|
{
|
|
"pms_property_ids": [self.test_property.id],
|
|
"name": "Double Test",
|
|
"code_type": "DBL_Test",
|
|
"class_id": self.test_room_type_class.id,
|
|
"list_price": 40.0,
|
|
}
|
|
)
|
|
self.test_room_type_double.flush()
|
|
|
|
# pms.room
|
|
self.test_room1_double = self.env["pms.room"].create(
|
|
{
|
|
"pms_property_id": self.test_property.id,
|
|
"name": "Double 201 test",
|
|
"room_type_id": self.test_room_type_double.id,
|
|
"capacity": 2,
|
|
}
|
|
)
|
|
self.test_room1_double.flush()
|
|
|
|
# pms.room
|
|
self.test_room2_double = self.env["pms.room"].create(
|
|
{
|
|
"pms_property_id": self.test_property.id,
|
|
"name": "Double 202 test",
|
|
"room_type_id": self.test_room_type_double.id,
|
|
"capacity": 2,
|
|
}
|
|
)
|
|
self.test_room2_double.flush()
|
|
|
|
# pms.room
|
|
self.test_room3_double = self.env["pms.room"].create(
|
|
{
|
|
"pms_property_id": self.test_property.id,
|
|
"name": "Double 203 test",
|
|
"room_type_id": self.test_room_type_double.id,
|
|
"capacity": 2,
|
|
}
|
|
)
|
|
self.test_room3_double.flush()
|
|
|
|
# pms.room
|
|
self.test_room4_double = self.env["pms.room"].create(
|
|
{
|
|
"pms_property_id": self.test_property.id,
|
|
"name": "Double 204 test",
|
|
"room_type_id": self.test_room_type_double.id,
|
|
"capacity": 2,
|
|
}
|
|
)
|
|
self.test_room4_double.flush()
|
|
|
|
# pms.room
|
|
self.test_room1_single = self.env["pms.room"].create(
|
|
{
|
|
"pms_property_id": self.test_property.id,
|
|
"name": "Single 101 test",
|
|
"room_type_id": self.test_room_type_single.id,
|
|
"capacity": 1,
|
|
}
|
|
)
|
|
self.test_room1_single.flush()
|
|
|
|
# pms.room
|
|
self.test_room2_single = self.env["pms.room"].create(
|
|
{
|
|
"pms_property_id": self.test_property.id,
|
|
"name": "Single 102 test",
|
|
"room_type_id": self.test_room_type_single.id,
|
|
"capacity": 1,
|
|
}
|
|
)
|
|
self.test_room2_single.flush()
|
|
|
|
# res.partner
|
|
self.partner_id = self.env["res.partner"].create(
|
|
{
|
|
"name": "Miguel",
|
|
"phone": "654667733",
|
|
"email": "miguel@example.com",
|
|
}
|
|
)
|
|
self.partner_id.flush()
|
|
|
|
def test_price_wizard_correct(self):
|
|
# TEST CASE
|
|
# Set values for the wizard and the total price is correct
|
|
# Also check the discount is correctly applied to get
|
|
# the total folio price
|
|
# (no pricelist applied)
|
|
|
|
# ARRANGE
|
|
# common scenario
|
|
self.create_common_scenario()
|
|
|
|
# checkin & checkout
|
|
checkin = fields.date.today()
|
|
checkout = fields.date.today() + datetime.timedelta(days=1)
|
|
days = (checkout - checkin).days
|
|
num_double_rooms = 4
|
|
discounts = [
|
|
{
|
|
"discount": 0,
|
|
"expected_price": days
|
|
* self.test_room_type_double.list_price
|
|
* num_double_rooms,
|
|
},
|
|
{
|
|
"discount": 0.5,
|
|
"expected_price": (
|
|
days * self.test_room_type_double.list_price * num_double_rooms
|
|
)
|
|
* 0.5,
|
|
},
|
|
]
|
|
|
|
# create folio wizard with partner id => pricelist & start-end dates
|
|
wizard_folio = self.env["pms.folio.wizard"].create(
|
|
{
|
|
"start_date": checkin,
|
|
"end_date": checkout,
|
|
"partner_id": self.partner_id.id,
|
|
}
|
|
)
|
|
|
|
# force pricelist load
|
|
wizard_folio.flush()
|
|
wizard_folio.availability_results._compute_dynamic_selection()
|
|
|
|
# availability items belonging to test property
|
|
lines_availability_test = self.env["pms.folio.availability.wizard"].search(
|
|
[
|
|
("room_type_id.pms_property_ids", "in", self.test_property.id),
|
|
]
|
|
)
|
|
|
|
# set value for room type double
|
|
value = self.env["pms.num.rooms.selection"].search(
|
|
[
|
|
("room_type_id", "=", str(self.test_room_type_double.id)),
|
|
("value", "=", num_double_rooms),
|
|
]
|
|
)
|
|
|
|
lines_availability_test[0].num_rooms_selected = value
|
|
|
|
for discount in discounts:
|
|
with self.subTest(k=discount):
|
|
# ACT
|
|
wizard_folio.discount = discount["discount"]
|
|
|
|
# ASSERT
|
|
self.assertEqual(
|
|
wizard_folio.total_price_folio,
|
|
discount["expected_price"],
|
|
"The total price calculation is wrong",
|
|
)
|
|
|
|
def test_price_wizard_correct_pricelist_applied(self):
|
|
# TEST CASE
|
|
# Set values for the wizard and the total price is correct
|
|
# (pricelist applied)
|
|
|
|
# ARRANGE
|
|
# common scenario
|
|
self.create_common_scenario()
|
|
|
|
# checkin & checkout
|
|
checkin = fields.date.today()
|
|
checkout = fields.date.today() + datetime.timedelta(days=1)
|
|
days = (checkout - checkin).days
|
|
|
|
# num. rooms of type double to book
|
|
num_double_rooms = 4
|
|
|
|
# price for today
|
|
price_today = 38.0
|
|
|
|
# expected price
|
|
expected_price_total = days * price_today * num_double_rooms
|
|
|
|
# set pricelist item for current day
|
|
product_tmpl_id = self.test_room_type_double.product_id.product_tmpl_id.id
|
|
pricelist_item = self.env["product.pricelist.item"].create(
|
|
{
|
|
"pricelist_id": self.test_pricelist.id,
|
|
"date_start_overnight": checkin,
|
|
"date_end_overnight": checkin,
|
|
"compute_price": "fixed",
|
|
"applied_on": "1_product",
|
|
"product_tmpl_id": product_tmpl_id,
|
|
"fixed_price": price_today,
|
|
"min_quantity": 0,
|
|
}
|
|
)
|
|
pricelist_item.flush()
|
|
|
|
# create folio wizard with partner id => pricelist & start-end dates
|
|
wizard_folio = self.env["pms.folio.wizard"].create(
|
|
{
|
|
"start_date": checkin,
|
|
"end_date": checkout,
|
|
"partner_id": self.partner_id.id,
|
|
"pricelist_id": self.test_pricelist.id,
|
|
}
|
|
)
|
|
wizard_folio.flush()
|
|
wizard_folio.availability_results._compute_dynamic_selection()
|
|
|
|
# availability items belonging to test property
|
|
lines_availability_test = self.env["pms.folio.availability.wizard"].search(
|
|
[
|
|
("room_type_id.pms_property_ids", "in", self.test_property.id),
|
|
]
|
|
)
|
|
|
|
# set value for room type double
|
|
value = self.env["pms.num.rooms.selection"].search(
|
|
[
|
|
("room_type_id", "=", str(self.test_room_type_double.id)),
|
|
("value", "=", num_double_rooms),
|
|
]
|
|
)
|
|
|
|
# ACT
|
|
lines_availability_test[0].num_rooms_selected = value
|
|
|
|
# ASSERT
|
|
self.assertEqual(
|
|
wizard_folio.total_price_folio,
|
|
expected_price_total,
|
|
"The total price calculation is wrong",
|
|
)
|
|
|
|
# REVIEW: This test is set to check min qty, but the workflow price, actually,
|
|
# always is set to 1 qty and the min_qty cant be applied.
|
|
# We could set qty to number of rooms??
|
|
|
|
# def test_price_wizard_correct_pricelist_applied_min_qty_applied(self):
|
|
# # TEST CASE
|
|
# # Set values for the wizard and the total price is correct
|
|
# # (pricelist applied)
|
|
|
|
# # ARRANGE
|
|
# # common scenario
|
|
# self.create_common_scenario()
|
|
|
|
# # checkin & checkout
|
|
# checkin = fields.date.today()
|
|
# checkout = fields.date.today() + datetime.timedelta(days=1)
|
|
# days = (checkout - checkin).days
|
|
|
|
# # set pricelist item for current day
|
|
# product_tmpl_id = self.test_room_type_double.product_id.product_tmpl_id.id
|
|
# pricelist_item = self.env["product.pricelist.item"].create(
|
|
# {
|
|
# "pricelist_id": self.test_pricelist.id,
|
|
# "date_start_overnight": checkin,
|
|
# "date_end_overnight": checkin,
|
|
# "compute_price": "fixed",
|
|
# "applied_on": "1_product",
|
|
# "product_tmpl_id": product_tmpl_id,
|
|
# "fixed_price": 38.0,
|
|
# "min_quantity": 4,
|
|
# }
|
|
# )
|
|
# pricelist_item.flush()
|
|
|
|
# # create folio wizard with partner id => pricelist & start-end dates
|
|
# wizard_folio = self.env["pms.folio.wizard"].create(
|
|
# {
|
|
# "start_date": checkin,
|
|
# "end_date": checkout,
|
|
# "partner_id": self.partner_id.id,
|
|
# "pricelist_id": self.test_pricelist.id,
|
|
# }
|
|
# )
|
|
# wizard_folio.flush()
|
|
# wizard_folio.availability_results._compute_dynamic_selection()
|
|
|
|
# # availability items belonging to test property
|
|
# lines_availability_test = self.env["pms.folio.availability.wizard"].search(
|
|
# [
|
|
# ("room_type_id.pms_property_ids", "in", self.test_property.id),
|
|
# ]
|
|
# )
|
|
|
|
# test_cases = [
|
|
# {
|
|
# "num_rooms": 3,
|
|
# "expected_price": 3 * self.test_room_type_double.list_price * days,
|
|
# },
|
|
# {"num_rooms": 4, "expected_price": 4 * pricelist_item.fixed_price * days},
|
|
# ]
|
|
# import wdb; wdb.set_trace()
|
|
# for tc in test_cases:
|
|
# with self.subTest(k=tc):
|
|
# # ARRANGE
|
|
# # set value for room type double
|
|
# value = self.env["pms.num.rooms.selection"].search(
|
|
# [
|
|
# ("room_type_id", "=", str(self.test_room_type_double.id)),
|
|
# ("value", "=", tc["num_rooms"]),
|
|
# ]
|
|
# )
|
|
# # ACT
|
|
# lines_availability_test[0].num_rooms_selected = value
|
|
|
|
# # ASSERT
|
|
# self.assertEqual(
|
|
# wizard_folio.total_price_folio,
|
|
# tc["expected_price"],
|
|
# "The total price calculation is wrong",
|
|
# )
|
|
|
|
def test_check_create_folio(self):
|
|
# TEST CASE
|
|
# Set values for the wizard check that folio is created
|
|
|
|
# ARRANGE
|
|
# common scenario
|
|
self.create_common_scenario()
|
|
|
|
# checkin & checkout
|
|
checkin = fields.date.today()
|
|
checkout = fields.date.today() + datetime.timedelta(days=1)
|
|
|
|
# create folio wizard with partner id => pricelist & start-end dates
|
|
wizard_folio = self.env["pms.folio.wizard"].create(
|
|
{
|
|
"start_date": checkin,
|
|
"end_date": checkout,
|
|
"partner_id": self.partner_id.id,
|
|
"pricelist_id": self.test_pricelist.id,
|
|
}
|
|
)
|
|
wizard_folio.flush()
|
|
wizard_folio.availability_results._compute_dynamic_selection()
|
|
|
|
# availability items belonging to test property
|
|
lines_availability_test = self.env["pms.folio.availability.wizard"].search(
|
|
[
|
|
("room_type_id.pms_property_ids", "in", self.test_property.id),
|
|
]
|
|
)
|
|
# set one room type double
|
|
value = self.env["pms.num.rooms.selection"].search(
|
|
[
|
|
("room_type_id", "=", str(self.test_room_type_double.id)),
|
|
("value", "=", 1),
|
|
]
|
|
)
|
|
lines_availability_test[0].num_rooms_selected = value
|
|
|
|
# ACT
|
|
wizard_folio.create_folio()
|
|
|
|
# ASSERT
|
|
folio = self.env["pms.folio"].search_count(
|
|
[("partner_id", "=", self.partner_id.id)]
|
|
)
|
|
|
|
self.assertTrue(folio, "Folio not created.")
|
|
|
|
def test_check_create_reservations(self):
|
|
# TEST CASE
|
|
# Set values for the wizard check that reservations are created
|
|
|
|
# ARRANGE
|
|
# common scenario
|
|
self.create_common_scenario()
|
|
|
|
# checkin & checkout
|
|
checkin = fields.date.today()
|
|
checkout = fields.date.today() + datetime.timedelta(days=1)
|
|
|
|
# create folio wizard with partner id => pricelist & start-end dates
|
|
wizard_folio = self.env["pms.folio.wizard"].create(
|
|
{
|
|
"start_date": checkin,
|
|
"end_date": checkout,
|
|
"partner_id": self.partner_id.id,
|
|
"pricelist_id": self.test_pricelist.id,
|
|
}
|
|
)
|
|
wizard_folio.flush()
|
|
wizard_folio.availability_results._compute_dynamic_selection()
|
|
|
|
# availability items belonging to test property
|
|
lines_availability_test = self.env["pms.folio.availability.wizard"].search(
|
|
[
|
|
("room_type_id.pms_property_ids", "in", self.test_property.id),
|
|
]
|
|
)
|
|
# set one room type double
|
|
value = self.env["pms.num.rooms.selection"].search(
|
|
[
|
|
("room_type_id", "=", str(self.test_room_type_double.id)),
|
|
("value", "=", 2),
|
|
]
|
|
)
|
|
lines_availability_test[0].num_rooms_selected = value
|
|
lines_availability_test[0].value_num_rooms_selected = 2
|
|
lines_availability_test.flush()
|
|
wizard_folio.flush()
|
|
|
|
# ACT
|
|
wizard_folio.create_folio()
|
|
|
|
folio = self.env["pms.folio"].search([("partner_id", "=", self.partner_id.id)])
|
|
folio.flush()
|
|
|
|
# ASSERT
|
|
self.assertEqual(len(folio.reservation_ids), 2, "Reservations not created.")
|
|
|
|
def test_values_folio_created(self):
|
|
# TEST CASE
|
|
# Set values for the wizard and values of folio are correct
|
|
|
|
# ARRANGE
|
|
# common scenario
|
|
self.create_common_scenario()
|
|
|
|
# checkin & checkout
|
|
checkin = fields.date.today()
|
|
checkout = fields.date.today() + datetime.timedelta(days=1)
|
|
|
|
# create folio wizard with partner id => pricelist & start-end dates
|
|
wizard_folio = self.env["pms.folio.wizard"].create(
|
|
{
|
|
"start_date": checkin,
|
|
"end_date": checkout,
|
|
"partner_id": self.partner_id.id,
|
|
"pricelist_id": self.test_pricelist.id,
|
|
}
|
|
)
|
|
wizard_folio.flush()
|
|
wizard_folio.availability_results._compute_dynamic_selection()
|
|
|
|
# availability items belonging to test property
|
|
lines_availability_test = self.env["pms.folio.availability.wizard"].search(
|
|
[
|
|
("room_type_id.pms_property_ids", "in", self.test_property.id),
|
|
]
|
|
)
|
|
# set one room type double
|
|
value = self.env["pms.num.rooms.selection"].search(
|
|
[
|
|
("room_type_id", "=", str(self.test_room_type_double.id)),
|
|
("value", "=", 1),
|
|
]
|
|
)
|
|
lines_availability_test[0].num_rooms_selected = value
|
|
lines_availability_test[0].value_num_rooms_selected = 1
|
|
|
|
# ACT
|
|
wizard_folio.create_folio()
|
|
vals = {
|
|
"partner_id": self.partner_id.id,
|
|
"pricelist_id": self.test_pricelist.id,
|
|
}
|
|
folio = self.env["pms.folio"].search([("partner_id", "=", self.partner_id.id)])
|
|
|
|
# ASSERT
|
|
for key in vals:
|
|
with self.subTest(k=key):
|
|
self.assertEqual(
|
|
folio[key].id,
|
|
vals[key],
|
|
"The value of " + key + " is not correctly established",
|
|
)
|
|
|
|
def test_values_reservation_created(self):
|
|
# TEST CASE
|
|
# Set values for the wizard and values of reservations are correct
|
|
|
|
# ARRANGE
|
|
# common scenario
|
|
self.create_common_scenario()
|
|
|
|
# checkin & checkout
|
|
checkin = fields.date.today()
|
|
checkout = fields.date.today() + datetime.timedelta(days=1)
|
|
|
|
# create folio wizard with partner id => pricelist & start-end dates
|
|
wizard_folio = self.env["pms.folio.wizard"].create(
|
|
{
|
|
"start_date": checkin,
|
|
"end_date": checkout,
|
|
"partner_id": self.partner_id.id,
|
|
"pricelist_id": self.test_pricelist.id,
|
|
}
|
|
)
|
|
wizard_folio.flush()
|
|
wizard_folio.availability_results._compute_dynamic_selection()
|
|
|
|
# availability items belonging to test property
|
|
lines_availability_test = self.env["pms.folio.availability.wizard"].search(
|
|
[
|
|
("room_type_id.pms_property_ids", "in", self.test_property.id),
|
|
]
|
|
)
|
|
# set one room type double
|
|
value = self.env["pms.num.rooms.selection"].search(
|
|
[
|
|
("room_type_id", "=", str(self.test_room_type_double.id)),
|
|
("value", "=", 1),
|
|
]
|
|
)
|
|
lines_availability_test[0].num_rooms_selected = value
|
|
lines_availability_test[0].value_num_rooms_selected = 1
|
|
|
|
# ACT
|
|
wizard_folio.create_folio()
|
|
|
|
folio = self.env["pms.folio"].search([("partner_id", "=", self.partner_id.id)])
|
|
|
|
vals = {
|
|
"folio_id": folio.id,
|
|
"checkin": checkin,
|
|
"checkout": checkout,
|
|
"room_type_id": self.test_room_type_double,
|
|
"partner_id": self.partner_id.id,
|
|
"pricelist_id": folio.pricelist_id.id,
|
|
}
|
|
|
|
# ASSERT
|
|
for reservation in folio.reservation_ids:
|
|
for key in vals:
|
|
with self.subTest(k=key):
|
|
self.assertEqual(
|
|
reservation[key].id
|
|
if key in ["folio_id", "partner_id", "pricelist_id"]
|
|
else reservation[key],
|
|
vals[key],
|
|
"The value of " + key + " is not correctly established",
|
|
)
|
|
|
|
def test_reservation_line_discounts(self):
|
|
# TEST CASE
|
|
# set a discount and its applied to the reservation line
|
|
|
|
# ARRANGE
|
|
# common scenario
|
|
self.create_common_scenario()
|
|
|
|
# checkin & checkout
|
|
checkin = fields.date.today()
|
|
checkout = fields.date.today() + datetime.timedelta(days=1)
|
|
discount = 0.5
|
|
|
|
# create folio wizard with partner id => pricelist & start-end dates
|
|
wizard_folio = self.env["pms.folio.wizard"].create(
|
|
{
|
|
"start_date": checkin,
|
|
"end_date": checkout,
|
|
"partner_id": self.partner_id.id,
|
|
"pricelist_id": self.test_pricelist.id,
|
|
"discount": discount,
|
|
}
|
|
)
|
|
wizard_folio.flush()
|
|
wizard_folio.availability_results._compute_dynamic_selection()
|
|
|
|
# availability items belonging to test property
|
|
lines_availability_test = self.env["pms.folio.availability.wizard"].search(
|
|
[
|
|
("room_type_id.pms_property_ids", "in", self.test_property.id),
|
|
]
|
|
)
|
|
# set one room type double
|
|
value = self.env["pms.num.rooms.selection"].search(
|
|
[
|
|
("room_type_id", "=", str(self.test_room_type_double.id)),
|
|
("value", "=", 1),
|
|
]
|
|
)
|
|
lines_availability_test[0].num_rooms_selected = value
|
|
lines_availability_test[0].value_num_rooms_selected = 1
|
|
|
|
# ACT
|
|
wizard_folio.create_folio()
|
|
|
|
folio = self.env["pms.folio"].search([("partner_id", "=", self.partner_id.id)])
|
|
|
|
# ASSERT
|
|
for reservation in folio.reservation_ids:
|
|
for line in reservation.reservation_line_ids:
|
|
with self.subTest(k=line):
|
|
self.assertEqual(
|
|
line.discount,
|
|
discount * 100,
|
|
"The discount is not correctly established",
|
|
)
|