216 lines
7.1 KiB
Python
216 lines
7.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
import requests
|
|
import logging
|
|
from odoo import models, fields, api, _
|
|
from datetime import datetime, timedelta
|
|
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
STATES = ['Active', 'Cancelled']
|
|
|
|
|
|
class HmsEmail(models.Model):
|
|
_name = 'hms.email'
|
|
_description = 'Hms Email'
|
|
_rec_name = 'email'
|
|
|
|
email = fields.Char(string="Email")
|
|
|
|
|
|
class HmsPhones(models.Model):
|
|
_name = 'hms.phones'
|
|
_description = 'Hms Phones'
|
|
_rec_name = 'phone'
|
|
|
|
phone = fields.Char(string="Phone")
|
|
|
|
|
|
class HmsCustomer(models.Model):
|
|
_name = 'hms.customer'
|
|
_description = 'Hms Customer'
|
|
_rec_name = 'bid'
|
|
|
|
bid = fields.Char(string="Customer ID", index=True)
|
|
lastName = fields.Char(string="Last Name")
|
|
firstName = fields.Char(string="First Name")
|
|
middleName = fields.Char(string="Middle Name")
|
|
birthDate = fields.Char(string="Birth Date")
|
|
citizenshipCode = fields.Char(string="Citizenship Code")
|
|
status = fields.Json(string="Status")
|
|
emails = fields.Many2many(comodel_name="hms.email", string="Emails")
|
|
phones = fields.Many2many(comodel_name="hms.phones", string="Phones")
|
|
gender = fields.Char(string="Gender")
|
|
|
|
|
|
class HmsRooms(models.Model):
|
|
_name = 'hms.rooms'
|
|
_description = 'Hms Rooms'
|
|
_rec_name = 'name'
|
|
|
|
bid = fields.Char(string="Room ID", index=True)
|
|
name = fields.Char(string="Name")
|
|
roomTypeId = fields.Many2one(comodel_name="hms.room.types", string="Room Type")
|
|
floorId = fields.Many2one(comodel_name="hms.floors", string="Floor")
|
|
|
|
|
|
class HmsRoomTypes(models.Model):
|
|
_name = 'hms.room.types'
|
|
_description = 'Hms Room Types'
|
|
_rec_name = 'name'
|
|
|
|
bid = fields.Char(string="Room Type ID", index=True)
|
|
name = fields.Char(string="Name")
|
|
|
|
|
|
class HmsFloors(models.Model):
|
|
_name = 'hms.floors'
|
|
_description = 'Hms Floors'
|
|
_rec_name = 'name'
|
|
|
|
bid = fields.Char(string="Floor ID", index=True)
|
|
name = fields.Char(string="Name")
|
|
|
|
|
|
class HmsGuests(models.Model):
|
|
_name = 'hms.guests'
|
|
_description = 'Hms Guests'
|
|
_rec_name = 'bid'
|
|
|
|
bid = fields.Char(string="Guest ID", index=True)
|
|
lastName = fields.Char(string="Last Name")
|
|
firstName = fields.Char(string="First Name")
|
|
middleName = fields.Char(string="Middle Name")
|
|
birthDate = fields.Char(string="Birth Date")
|
|
citizenshipCode = fields.Char(string="Citizenship Code")
|
|
status = fields.Json(string="Status")
|
|
emails = fields.Many2many(comodel_name="hms.email", string="Emails")
|
|
phones = fields.Many2many(comodel_name="hms.phones", string="Phones")
|
|
gender = fields.Char(string="Gender")
|
|
|
|
|
|
class HmsAmenities(models.Model):
|
|
_name = 'hms.amenities'
|
|
_description = 'Hms Amenities'
|
|
_rec_name = 'name'
|
|
|
|
name = fields.Char(string="Name")
|
|
|
|
|
|
class HmsRoomStays(models.Model):
|
|
_name = 'hms.roomstays'
|
|
_description = 'Hms RoomStays'
|
|
_rec_name = 'bid'
|
|
|
|
bid = fields.Char(string="Room raw ID", index=True)
|
|
bookingId = fields.Char(string="Booking ID", index=True)
|
|
roomId = fields.Many2one(comodel_name="hms.rooms", string="Room ID")
|
|
roomTypeId = fields.Many2one(comodel_name="hms.room.types", string="Room Type ID")
|
|
guestsIds = fields.Many2many(comodel_name="hms.guests", string="Guests Ids")
|
|
checkInDateTime = fields.Char(string="Check In Date Time")
|
|
checkOutDateTime = fields.Char(string="Check Out Date Time")
|
|
actualCheckInDateTime = fields.Char(string="Actual Check In Date Time")
|
|
actualCheckOutDateTime = fields.Char(string="Actual Check Out Date Time")
|
|
status = fields.Many2one(comodel_name="hms.status", string="Status")
|
|
bookingStatus = fields.Many2one(comodel_name="hms.booking.status", string="Booking Status")
|
|
guestCountInfo = fields.Json(string="Guest Count Info")
|
|
totalPrice = fields.Json(string="Total Price")
|
|
amenities = fields.Many2many(comodel_name="hms.amenities", string="Amenities")
|
|
|
|
bookings_id = fields.Many2one(comodel_name="hms.bookings", string="Room Stay Id")
|
|
|
|
|
|
class HmsSourceChannel(models.Model):
|
|
_name = 'hms.source.channel'
|
|
_description = 'Hms Source Channel'
|
|
_rec_name = 'name'
|
|
|
|
name = fields.Char(string="Name")
|
|
|
|
|
|
class HmsBookings(models.Model):
|
|
_name = 'hms.bookings'
|
|
_description = 'Hms Bookings'
|
|
_rec_name = 'bid'
|
|
|
|
bid = fields.Char(string="Booking ID", index=True)
|
|
number = fields.Char(string="Booking Number", index=True)
|
|
customerLanguage = fields.Char(string="Customer Language")
|
|
visitPurpose = fields.Json(string="Visit Purpose")
|
|
customerComment = fields.Char(string="Customer Comment")
|
|
lastModified = fields.Char(string="Last Modified")
|
|
groupName = fields.Char(string="Group Name")
|
|
currencyId = fields.Char(string="Currency ID")
|
|
customer = fields.Many2one(comodel_name="hms.customer", string="Customer")
|
|
roomStays = fields.One2many(comodel_name="hms.roomstays", inverse_name="bookings_id", string="RoomStays")
|
|
customerCompany = fields.Json(string="Customer Company")
|
|
source = fields.Json(string="RoomStays (Json)")
|
|
sourceChannelName = fields.Many2one(comodel_name="hms.source.channel", string="Source Channel Name")
|
|
|
|
|
|
class HmsStatus(models.Model):
|
|
_name = 'hms.status'
|
|
_description = 'Hms Status'
|
|
|
|
name = fields.Char(string="Status", required=True)
|
|
|
|
|
|
class HmsBookingStatus(models.Model):
|
|
_name = 'hms.booking.status'
|
|
_description = 'Hms Booking Status'
|
|
|
|
name = fields.Char(string="Booking Status", required=True)
|
|
|
|
|
|
class HmsAgents(models.Model):
|
|
_name = 'hms.agents'
|
|
_description = 'Hms Agents'
|
|
_rec_name = 'name'
|
|
|
|
index = fields.Integer(string="Index")
|
|
bid = fields.Char(string="Agent ID", index=True)
|
|
name = fields.Char(string="Name")
|
|
inn = fields.Char(string="Tax ID")
|
|
kpp = fields.Char(string="Tax Registration Reason Code")
|
|
phone = fields.Many2one(comodel_name="hms.phones", string="Phone")
|
|
email = fields.Many2one(comodel_name="hms.email", string="Email")
|
|
legalAddress = fields.Char(string="Registered Address")
|
|
mailingAddress = fields.Char(string="Postal Address")
|
|
|
|
|
|
class HmsServiceKinds(models.Model):
|
|
_name = 'hms.service.kinds'
|
|
_description = 'Hms Service Kinds'
|
|
_rec_name = 'name'
|
|
|
|
name = fields.Char(string="Name")
|
|
hms_id = fields.Integer(string="ID")
|
|
|
|
|
|
class HmsServiceVatKinds(models.Model):
|
|
_name = 'hms.service.vat.kinds'
|
|
_description = 'Hms Service Vat Kinds'
|
|
_rec_name = 'name'
|
|
|
|
name = fields.Char(string="Name")
|
|
hms_id = fields.Integer(string="ID")
|
|
|
|
|
|
class HmsServices(models.Model):
|
|
_name = 'hms.services'
|
|
_description = 'Hms Services'
|
|
_rec_name = 'bid'
|
|
|
|
bid = fields.Char(string="ID")
|
|
kind = fields.Many2one(comodel_name="hms.service.kinds", string="Kind")
|
|
name = fields.Char(string="Name")
|
|
amount = fields.Float(string="Amount")
|
|
discount = fields.Float(string="Discount")
|
|
vat_kind = fields.Many2one(comodel_name="hms.service.vat.kinds", string="VAT Kind")
|
|
vat = fields.Float(string="VAT")
|
|
quantity = fields.Integer(string="Quantity")
|
|
service_date = fields.Datetime(string="Date")
|
|
reservationId = fields.Char(string="Reservation")
|
|
optionCategory = fields.Char(string="Option Category")
|
|
isIncluded = fields.Boolean(string="Is Included") |