[IMP]pms_api_rest: use active_test context to avoid get archived rooms

This commit is contained in:
Darío Lodeiros
2023-03-21 16:45:51 +01:00
parent f2d9d0ee05
commit 2366f1b7bf
3 changed files with 21 additions and 11 deletions

View File

@@ -95,14 +95,18 @@ class PmsAvailabilityPlanService(Component):
if not record_availability_plan_id:
raise MissingError
rooms = self.env["pms.room"].search(
[
(
"pms_property_id",
"=",
availability_plan_rule_search_param.pmsPropertyId,
)
]
rooms = (
self.env["pms.room"]
.with_context(active_test=True)
.search(
[
(
"pms_property_id",
"=",
availability_plan_rule_search_param.pmsPropertyId,
)
]
)
)
room_type_ids = rooms.mapped("room_type_id").ids
selected_fields = [

View File

@@ -332,7 +332,9 @@ class PmsCalendarService(Component):
{
"room_type_id": room_type.id,
"rooms_total": len(
self.env["pms.room"].search(
self.env["pms.room"]
.with_context(active_test=True)
.search(
[
("room_type_id", "=", room_type.id),
("pms_property_id", "=", pms_property_id),

View File

@@ -109,8 +109,12 @@ class PmsPricelistService(Component):
)
if not record_pricelist:
raise MissingError
rooms = self.env["pms.room"].search(
[("pms_property_id", "=", pricelist_item_search_param.pmsPropertyId)]
rooms = (
self.env["pms.room"]
.with_context(active_test=True)
.search(
[("pms_property_id", "=", pricelist_item_search_param.pmsPropertyId)]
)
)
room_types = rooms.mapped("room_type_id")
result = []