Skip to content

Commit

Permalink
[FIX] pms-api-rest: fix precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelpadin committed Oct 6, 2022
1 parent 3ce4156 commit a76f973
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 21 deletions.
4 changes: 3 additions & 1 deletion pms_api_rest/datamodels/pms_folio.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class PmsFolioInfo(Datamodel):
lastCheckout = fields.String(required=False, allow_none=True)
pmsPropertyId = fields.Integer(required=False, allow_none=False)
partnerId = fields.Integer(required=False, allow_none=False)
reservations = fields.List(NestedModel("pms.reservation.info"), required=False, allow_none=False)
reservations = fields.List(
NestedModel("pms.reservation.info"), required=False, allow_none=False
)
pricelistId = fields.Integer(required=False, allow_none=False)
saleChannelId = fields.Integer(required=False, allow_none=False)
agency = fields.Integer(required=False, allow_none=False)
Expand Down
5 changes: 3 additions & 2 deletions pms_api_rest/datamodels/pms_reservation.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ class PmsReservationInfo(Datamodel):
priceOnlyRoom = fields.Float(required=False, allow_none=True)

reservationLines = fields.List(NestedModel("pms.reservation.line.info"))
services = fields.List(NestedModel("pms.service.info"), required=False, allow_none=True)

services = fields.List(
NestedModel("pms.service.info"), required=False, allow_none=True
)

# TODO: Refact
# messages = fields.List(fields.Dict(required=False, allow_none=True))
4 changes: 1 addition & 3 deletions pms_api_rest/datamodels/pms_room_closure_reason.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

from odoo.addons.datamodel.core import Datamodel


class PmsRoomClosureReasonInfo(Datamodel):
_name = "pms.room.closure.reason.info"
id = fields.Integer(required=False, allow_none=True)
name = fields.String(required=False, allow_none=True)
description = fields.String(required=False, allow_none=True)



6 changes: 3 additions & 3 deletions pms_api_rest/services/pms_folio_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def get_folio_reservations(self, folio_id):
auth="jwt_api_pms",
)
def create_folio(self, pms_folio_info):
if pms_folio_info.reservationType == 'out':
if pms_folio_info.reservationType == "out":
vals = {
"pms_property_id": pms_folio_info.pmsPropertyId,
"reservation_type": pms_folio_info.reservationType,
Expand Down Expand Up @@ -370,7 +370,7 @@ def create_folio(self, pms_folio_info):
"reservation_type": pms_folio_info.reservationType,
"children": reservation.children,
}
reservation_record = self.env['pms.reservation'].create(vals)
reservation_record = self.env["pms.reservation"].create(vals)
if reservation.services:
for service in reservation.services:
vals = {
Expand All @@ -389,7 +389,7 @@ def create_folio(self, pms_folio_info):
},
)
for line in service.serviceLines
]
],
}
self.env["pms.service"].create(vals)

Expand Down
15 changes: 3 additions & 12 deletions pms_api_rest/services/pms_room_closure_reason_service.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
from datetime import datetime, timedelta

from odoo import _, fields
from odoo.exceptions import MissingError
from odoo.osv import expression

from odoo.addons.base_rest import restapi
from odoo.addons.base_rest_datamodel.restapi import Datamodel
from odoo.addons.component.core import Component
Expand All @@ -30,13 +24,10 @@ class PmsClosureReasonService(Component):
def get_closure_reasons(self):
closure_reasons = []
PmsRoomClosureReasonInfo = self.env.datamodels["pms.room.closure.reason.info"]
for cl in self.env['room.closure.reason'].search([]):
for cl in self.env["room.closure.reason"].search([]):
closure_reasons.append(
PmsRoomClosureReasonInfo(
id=cl.id,
name=cl.name,
description=cl.description

)
id=cl.id, name=cl.name, description=cl.description
)
)
return closure_reasons

0 comments on commit a76f973

Please sign in to comment.