mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms_api_rest: use active_test context to avoid get archived rooms
This commit is contained in:
@@ -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 = [
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user