[IMP] pms_api_rest: filter room service by property

This commit is contained in:
miguelpadin
2022-01-13 12:28:29 +01:00
committed by Darío Lodeiros
parent 86056dd6fc
commit 8a2e94ed24
2 changed files with 4 additions and 0 deletions

View File

@@ -7,3 +7,4 @@ class PmsRoomSearchParam(Datamodel):
_name = "pms.room.search.param"
id = fields.Integer(required=False, allow_none=True)
name = fields.String(required=False, allow_none=True)
pms_property_id = fields.Integer(required=False, allow_none=True)

View File

@@ -28,6 +28,9 @@ class PmsRoomService(Component):
domain.append(("name", "like", room_search_param.name))
if room_search_param.id:
domain.append(("id", "=", room_search_param.id))
if room_search_param.pms_property_id:
domain.append(("pms_property_id", "=", room_search_param.pms_property_id))
result_rooms = []
PmsRoomInfo = self.env.datamodels["pms.room.info"]
for room in (