From 4da5273417fdf7cf23c0baf3d066539cd8436fe4 Mon Sep 17 00:00:00 2001 From: miguelpadin Date: Thu, 23 Jun 2022 19:12:29 +0200 Subject: [PATCH] [FIX] pms-api-rest: fix precommit --- pms_api_rest/http.py | 3 --- .../services/pms_availability_plan_service.py | 4 ++-- pms_api_rest/services/pms_folio_service.py | 20 ++++++++++++------- .../services/pms_pricelist_service.py | 4 +++- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/pms_api_rest/http.py b/pms_api_rest/http.py index 3e65ed52a..762d36c67 100644 --- a/pms_api_rest/http.py +++ b/pms_api_rest/http.py @@ -36,7 +36,6 @@ class HttpRestRequestPms(HttpRestRequest): if isinstance(exception, SessionExpiredException): # we don't want to return the login form as plain html page # we want to raise a proper exception - print("session expired exception") return wrapJsonException(Unauthorized(ustr(exception))) try: return super(HttpRequest, self)._handle_exception(exception) @@ -46,7 +45,6 @@ class HttpRestRequestPms(HttpRestRequest): NotFound(ustr(e)), include_description=True, extra_info=extra_info ) except (AccessError, AccessDenied) as e: - print("access error / access denied exception") extra_info = getattr(e, "rest_json_info", None) return wrapJsonException( Forbidden(ustr(e)), include_description=True, extra_info=extra_info @@ -60,7 +58,6 @@ class HttpRestRequestPms(HttpRestRequest): extra_info = getattr(e, "rest_json_info", None) return wrapJsonException(e, include_description=True, extra_info=extra_info) except Unauthorized as e: - print("Unauthorized exception") extra_info = getattr(e, "rest_json_info", None) return ( wrapJsonException(e, include_description=True, extra_info=extra_info), diff --git a/pms_api_rest/services/pms_availability_plan_service.py b/pms_api_rest/services/pms_availability_plan_service.py index e7483fe0d..c878b078c 100644 --- a/pms_api_rest/services/pms_availability_plan_service.py +++ b/pms_api_rest/services/pms_availability_plan_service.py @@ -186,7 +186,8 @@ class PmsAvailabilityPlanService(Component): [ ( [ - "//availability-plan-rules/", + "//" + "availability-plan-rules/", ], "PATCH", ) @@ -202,7 +203,6 @@ class PmsAvailabilityPlanService(Component): [ ("availability_plan_id", "=", availability_plan_id), ("id", "=", availability_plan_rule_id), - ] ) if avail_rule: diff --git a/pms_api_rest/services/pms_folio_service.py b/pms_api_rest/services/pms_folio_service.py index 70087abee..8b01f9a5d 100644 --- a/pms_api_rest/services/pms_folio_service.py +++ b/pms_api_rest/services/pms_folio_service.py @@ -34,12 +34,18 @@ class PmsFolioService(Component): ) if folio_search_param.date_to and folio_search_param.date_from: - reservation_lines = self.env["pms.reservation.line"].search( - [ - ("date", ">=", folio_search_param.date_from), - ("date", "<", folio_search_param.date_to), - ] - ).mapped("reservation_id").mapped("folio_id").ids + reservation_lines = ( + self.env["pms.reservation.line"] + .search( + [ + ("date", ">=", folio_search_param.date_from), + ("date", "<", folio_search_param.date_to), + ] + ) + .mapped("reservation_id") + .mapped("folio_id") + .ids + ) domain_fields.append(("folio_id", "in", reservation_lines)) domain_filter = list() @@ -156,7 +162,7 @@ class PmsFolioService(Component): else "", "pendingAmount": reservation.folio_id.pending_amount, "toAssign": reservation.to_assign, - "reservationType": reservation.reservation_type + "reservationType": reservation.reservation_type, } ) result_folios.append( diff --git a/pms_api_rest/services/pms_pricelist_service.py b/pms_api_rest/services/pms_pricelist_service.py index bbf76713c..039d739c5 100644 --- a/pms_api_rest/services/pms_pricelist_service.py +++ b/pms_api_rest/services/pms_pricelist_service.py @@ -183,7 +183,9 @@ class PmsPricelistService(Component): input_param=Datamodel("pms.pricelist.item.info", is_list=False), auth="jwt_api_pms", ) - def write_pricelist_item(self, pricelist_id, pricelist_item_id, pms_pricelist_item_info): + def write_pricelist_item( + self, pricelist_id, pricelist_item_id, pms_pricelist_item_info + ): product_pricelist_item = self.env["product.pricelist.item"].search( [