From 54f48d4a374d8efc600b57402f7b25f8a6c495fc Mon Sep 17 00:00:00 2001 From: miguelpadin Date: Thu, 13 Oct 2022 16:14:30 +0200 Subject: [PATCH] [FIX] pms-api-rest: fix filter by property (filter param in pms_property_ids or pms_property_ids = false ) @ cancelation rules service --- .../services/pms_cancelation_rule_service.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pms_api_rest/services/pms_cancelation_rule_service.py b/pms_api_rest/services/pms_cancelation_rule_service.py index e169e634a..2f16b5cbd 100644 --- a/pms_api_rest/services/pms_cancelation_rule_service.py +++ b/pms_api_rest/services/pms_cancelation_rule_service.py @@ -30,17 +30,20 @@ class PmsCancelationRuleService(Component): if cancelation_rule_search_param.pricelistId: domain.append( - ("pricelist_ids", "in", cancelation_rule_search_param.pricelistId) + ("pricelist_ids", "in", [cancelation_rule_search_param.pricelistId]) ) if cancelation_rule_search_param.pmsPropertyId: - domain.append( - ( - "pms_property_ids", - "in", - [cancelation_rule_search_param.pmsPropertyId], + domain.extend( + [ + '|', + ( + "pms_property_ids", + "in", + [cancelation_rule_search_param.pmsPropertyId], + ), + ("pms_property_ids", "=", False), + ] ) - ) - result_cancelation_rules = [] PmsCancelationRuleInfo = self.env.datamodels["pms.cancelation.rule.info"] for cancelation_rule in self.env["pms.cancelation.rule"].search(