mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] Roommatic get reservation
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
|
||||
import json
|
||||
from odoo import api, models
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class HotelFolio(models.Model):
|
||||
@@ -13,8 +15,8 @@ class HotelFolio(models.Model):
|
||||
def rm_get_reservation(self, Code):
|
||||
# BÚSQUEDA DE RESERVA POR LOCALIZADOR
|
||||
folio_res = self.env['hotel.folio'].search([('id', '=', Code)])
|
||||
json_response = dict()
|
||||
if any(folio_res):
|
||||
_logger.info('ROOMMATIK serving Folio: %s', folio_res.id)
|
||||
folio_lin = folio_res.room_lines
|
||||
json_response = {
|
||||
'Id': folio_res.id,
|
||||
@@ -33,6 +35,9 @@ class HotelFolio(models.Model):
|
||||
'RoomTypeName': line.room_type_id.name,
|
||||
'RoomName': line.room_id.name,
|
||||
})
|
||||
else:
|
||||
_logger.info('ROOMMATIK Not Found Folio search %s', Code)
|
||||
json_response = {'Error': 'Not Found ' + str(Code)}
|
||||
json_response = json.dumps(json_response)
|
||||
|
||||
return json_response
|
||||
|
||||
@@ -7,12 +7,13 @@ from odoo import api, models
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class RoomMatik(models.Model):
|
||||
_name = 'roommatik.api'
|
||||
|
||||
@api.model
|
||||
def rm_get_date(self):
|
||||
# RoomMatik API FECHA/HORA
|
||||
# RoomMatik API Gets the current business date/time. (MANDATORY)
|
||||
utc_s = '+01:00'
|
||||
# TODO Need know UTC in the machine/hotel
|
||||
json_response = {
|
||||
@@ -21,16 +22,25 @@ class RoomMatik(models.Model):
|
||||
json_response = json.dumps(json_response)
|
||||
return json_response
|
||||
|
||||
@api.model
|
||||
def rm_get_reservation(self, reservation_code):
|
||||
# RoomMatik Gets a reservation ready for check-in
|
||||
# through the provided code. (MANDATORY)
|
||||
apidata = self.env['hotel.folio']
|
||||
return apidata.rm_get_reservation(reservation_code)
|
||||
|
||||
@api.model
|
||||
def rm_add_customer(self, customer):
|
||||
# RoomMatik API CREACIÓN DE CLIENTE
|
||||
# RoomMatik API Adds a new PMS customer through the provided parameters
|
||||
# Addition will be ok if the returned customer has ID. (MANDATORY)
|
||||
_logger.info('ROOMMATIK Customer Creation')
|
||||
apidata = self.env['res.partner']
|
||||
return apidata.rm_add_customer(customer)
|
||||
|
||||
@api.model
|
||||
def rm_checkin_partner(self, stay):
|
||||
# RoomMatik API CHECK-IN
|
||||
# RoomMatik API Check-in a stay.
|
||||
# Addition will be ok if the returned stay has ID. (MANDATORY)
|
||||
_logger.info('ROOMMATIK Check-IN')
|
||||
apidata = self.env['hotel.folio']
|
||||
return apidata.rm_checkin_partner(stay)
|
||||
|
||||
Reference in New Issue
Block a user