mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] pms-api-rest: fix precommit
This commit is contained in:
committed by
Darío Lodeiros
parent
7c94f2ae86
commit
4da5273417
@@ -36,7 +36,6 @@ class HttpRestRequestPms(HttpRestRequest):
|
|||||||
if isinstance(exception, SessionExpiredException):
|
if isinstance(exception, SessionExpiredException):
|
||||||
# we don't want to return the login form as plain html page
|
# we don't want to return the login form as plain html page
|
||||||
# we want to raise a proper exception
|
# we want to raise a proper exception
|
||||||
print("session expired exception")
|
|
||||||
return wrapJsonException(Unauthorized(ustr(exception)))
|
return wrapJsonException(Unauthorized(ustr(exception)))
|
||||||
try:
|
try:
|
||||||
return super(HttpRequest, self)._handle_exception(exception)
|
return super(HttpRequest, self)._handle_exception(exception)
|
||||||
@@ -46,7 +45,6 @@ class HttpRestRequestPms(HttpRestRequest):
|
|||||||
NotFound(ustr(e)), include_description=True, extra_info=extra_info
|
NotFound(ustr(e)), include_description=True, extra_info=extra_info
|
||||||
)
|
)
|
||||||
except (AccessError, AccessDenied) as e:
|
except (AccessError, AccessDenied) as e:
|
||||||
print("access error / access denied exception")
|
|
||||||
extra_info = getattr(e, "rest_json_info", None)
|
extra_info = getattr(e, "rest_json_info", None)
|
||||||
return wrapJsonException(
|
return wrapJsonException(
|
||||||
Forbidden(ustr(e)), include_description=True, extra_info=extra_info
|
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)
|
extra_info = getattr(e, "rest_json_info", None)
|
||||||
return wrapJsonException(e, include_description=True, extra_info=extra_info)
|
return wrapJsonException(e, include_description=True, extra_info=extra_info)
|
||||||
except Unauthorized as e:
|
except Unauthorized as e:
|
||||||
print("Unauthorized exception")
|
|
||||||
extra_info = getattr(e, "rest_json_info", None)
|
extra_info = getattr(e, "rest_json_info", None)
|
||||||
return (
|
return (
|
||||||
wrapJsonException(e, include_description=True, extra_info=extra_info),
|
wrapJsonException(e, include_description=True, extra_info=extra_info),
|
||||||
|
|||||||
@@ -186,7 +186,8 @@ class PmsAvailabilityPlanService(Component):
|
|||||||
[
|
[
|
||||||
(
|
(
|
||||||
[
|
[
|
||||||
"/<int:availability_plan_id>/availability-plan-rules/<int:availability_plan_rule_id>",
|
"/<int:availability_plan_id>/"
|
||||||
|
"availability-plan-rules/<int:availability_plan_rule_id>",
|
||||||
],
|
],
|
||||||
"PATCH",
|
"PATCH",
|
||||||
)
|
)
|
||||||
@@ -202,7 +203,6 @@ class PmsAvailabilityPlanService(Component):
|
|||||||
[
|
[
|
||||||
("availability_plan_id", "=", availability_plan_id),
|
("availability_plan_id", "=", availability_plan_id),
|
||||||
("id", "=", availability_plan_rule_id),
|
("id", "=", availability_plan_rule_id),
|
||||||
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
if avail_rule:
|
if avail_rule:
|
||||||
|
|||||||
@@ -34,12 +34,18 @@ class PmsFolioService(Component):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if folio_search_param.date_to and folio_search_param.date_from:
|
if folio_search_param.date_to and folio_search_param.date_from:
|
||||||
reservation_lines = self.env["pms.reservation.line"].search(
|
reservation_lines = (
|
||||||
[
|
self.env["pms.reservation.line"]
|
||||||
("date", ">=", folio_search_param.date_from),
|
.search(
|
||||||
("date", "<", folio_search_param.date_to),
|
[
|
||||||
]
|
("date", ">=", folio_search_param.date_from),
|
||||||
).mapped("reservation_id").mapped("folio_id").ids
|
("date", "<", folio_search_param.date_to),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
.mapped("reservation_id")
|
||||||
|
.mapped("folio_id")
|
||||||
|
.ids
|
||||||
|
)
|
||||||
domain_fields.append(("folio_id", "in", reservation_lines))
|
domain_fields.append(("folio_id", "in", reservation_lines))
|
||||||
|
|
||||||
domain_filter = list()
|
domain_filter = list()
|
||||||
@@ -156,7 +162,7 @@ class PmsFolioService(Component):
|
|||||||
else "",
|
else "",
|
||||||
"pendingAmount": reservation.folio_id.pending_amount,
|
"pendingAmount": reservation.folio_id.pending_amount,
|
||||||
"toAssign": reservation.to_assign,
|
"toAssign": reservation.to_assign,
|
||||||
"reservationType": reservation.reservation_type
|
"reservationType": reservation.reservation_type,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
result_folios.append(
|
result_folios.append(
|
||||||
|
|||||||
@@ -183,7 +183,9 @@ class PmsPricelistService(Component):
|
|||||||
input_param=Datamodel("pms.pricelist.item.info", is_list=False),
|
input_param=Datamodel("pms.pricelist.item.info", is_list=False),
|
||||||
auth="jwt_api_pms",
|
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(
|
product_pricelist_item = self.env["product.pricelist.item"].search(
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user