mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] pms_api_rest: show records with all properties when it isn't specified
This commit is contained in:
committed by
Darío Lodeiros
parent
329f3e9186
commit
3f97281dc4
@@ -14,7 +14,7 @@ class PmsCalendarSwapInfo(Datamodel):
|
|||||||
swapTo = fields.String(required=True, allow_none=False)
|
swapTo = fields.String(required=True, allow_none=False)
|
||||||
roomIdA = fields.Integer(required=True, allow_none=False)
|
roomIdA = fields.Integer(required=True, allow_none=False)
|
||||||
roomIdB = fields.Integer(required=True, allow_none=False)
|
roomIdB = fields.Integer(required=True, allow_none=False)
|
||||||
pms_property_id = fields.Integer(required=True, allow_none=False)
|
pms_property_id = fields.Integer(required=False, allow_none=True)
|
||||||
|
|
||||||
|
|
||||||
class PmsCalendarSearchParam(Datamodel):
|
class PmsCalendarSearchParam(Datamodel):
|
||||||
|
|||||||
@@ -29,18 +29,23 @@ class PmsPricelistService(Component):
|
|||||||
pricelists_all_properties = self.env["product.pricelist"].search(
|
pricelists_all_properties = self.env["product.pricelist"].search(
|
||||||
[("pms_property_ids", "=", False)]
|
[("pms_property_ids", "=", False)]
|
||||||
)
|
)
|
||||||
pricelists = set()
|
if pms_search_param.pms_property_ids:
|
||||||
for index, prop in enumerate(pms_search_param.pms_property_ids):
|
pricelists = set()
|
||||||
pricelists_with_query_property = self.env["product.pricelist"].search(
|
for index, prop in enumerate(pms_search_param.pms_property_ids):
|
||||||
[("pms_property_ids", "=", prop)]
|
pricelists_with_query_property = self.env["product.pricelist"].search(
|
||||||
)
|
[("pms_property_ids", "=", prop)]
|
||||||
if index == 0:
|
|
||||||
pricelists = set(pricelists_with_query_property.ids)
|
|
||||||
else:
|
|
||||||
pricelists = pricelists.intersection(
|
|
||||||
set(pricelists_with_query_property.ids)
|
|
||||||
)
|
)
|
||||||
pricelists_total = list(set(list(pricelists) + pricelists_all_properties.ids))
|
if index == 0:
|
||||||
|
pricelists = set(pricelists_with_query_property.ids)
|
||||||
|
else:
|
||||||
|
pricelists = pricelists.intersection(
|
||||||
|
set(pricelists_with_query_property.ids)
|
||||||
|
)
|
||||||
|
pricelists_total = list(
|
||||||
|
set(list(pricelists) + pricelists_all_properties.ids)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
pricelists_total = list(pricelists_all_properties.ids)
|
||||||
domain = [
|
domain = [
|
||||||
("id", "in", pricelists_total),
|
("id", "in", pricelists_total),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -26,18 +26,23 @@ class PmsRoomTypeService(Component):
|
|||||||
room_type_all_properties = self.env["pms.room.type"].search(
|
room_type_all_properties = self.env["pms.room.type"].search(
|
||||||
[("pms_property_ids", "=", False)]
|
[("pms_property_ids", "=", False)]
|
||||||
)
|
)
|
||||||
room_types = set()
|
if room_type_search_param.pms_property_ids:
|
||||||
for index, prop in enumerate(room_type_search_param.pms_property_ids):
|
room_types = set()
|
||||||
room_types_with_query_property = self.env["pms.room.type"].search(
|
for index, prop in enumerate(room_type_search_param.pms_property_ids):
|
||||||
[("pms_property_ids", "=", prop)]
|
room_types_with_query_property = self.env["pms.room.type"].search(
|
||||||
)
|
[("pms_property_ids", "=", prop)]
|
||||||
if index == 0:
|
|
||||||
room_types = set(room_types_with_query_property.ids)
|
|
||||||
else:
|
|
||||||
room_types = room_types.intersection(
|
|
||||||
set(room_types_with_query_property.ids)
|
|
||||||
)
|
)
|
||||||
room_types_total = list(set(list(room_types) + room_type_all_properties.ids))
|
if index == 0:
|
||||||
|
room_types = set(room_types_with_query_property.ids)
|
||||||
|
else:
|
||||||
|
room_types = room_types.intersection(
|
||||||
|
set(room_types_with_query_property.ids)
|
||||||
|
)
|
||||||
|
room_types_total = list(
|
||||||
|
set(list(room_types) + room_type_all_properties.ids)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
room_types_total = list(room_type_all_properties.ids)
|
||||||
domain = [
|
domain = [
|
||||||
("id", "in", room_types_total),
|
("id", "in", room_types_total),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user