From 8391c48eb2a3a0635ffdddec3bc526c0e967542b Mon Sep 17 00:00:00 2001 From: Sara Lago Date: Fri, 3 Sep 2021 11:14:46 +0200 Subject: [PATCH] [IMP] Change date format in checkin and checkout --- pms_api_rest/services/folio_services.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pms_api_rest/services/folio_services.py b/pms_api_rest/services/folio_services.py index 779c79eedd0..3da29c61f69 100644 --- a/pms_api_rest/services/folio_services.py +++ b/pms_api_rest/services/folio_services.py @@ -1,6 +1,7 @@ from odoo.addons.base_rest import restapi from odoo.addons.base_rest_datamodel.restapi import Datamodel from odoo.addons.component.core import Component +from datetime import datetime class PmsFolioService(Component): @@ -32,8 +33,8 @@ def get_folios(self, folio_search_param): PmsFolioShortInfo = self.env.datamodels["pms.folio.short.info"] for folio in ( self.env["pms.folio"] - .sudo() - .search( + .sudo() + .search( domain, ) ): @@ -42,8 +43,8 @@ def get_folios(self, folio_search_param): reservations.append( { "id": reservation.id, - "checkin": str(reservation.checkin), - "checkout": str(reservation.checkout), + "checkin": datetime.combine(reservation.checkin, datetime.min.time()).isoformat(), + "checkout": datetime.combine(reservation.checkout, datetime.min.time()).isoformat(), "preferredRoomId": reservation.preferred_room_id.name if reservation.preferred_room_id else "", @@ -53,6 +54,9 @@ def get_folios(self, folio_search_param): "priceTotal": reservation.price_total, "adults": reservation.adults, "pricelist": reservation.pricelist_id.name, + "boardService": reservation.board_service_room_id.pms_board_service_id.name + if reservation.board_service_room_id + else "", } )