mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[WIP] moved settings to company / hotel / user models
This commit is contained in:
@@ -34,7 +34,6 @@
|
|||||||
'wizard/massive_price_reservation_days.xml',
|
'wizard/massive_price_reservation_days.xml',
|
||||||
'wizard/folio_make_invoice_advance_views.xml',
|
'wizard/folio_make_invoice_advance_views.xml',
|
||||||
'data/hotel_sequence.xml',
|
'data/hotel_sequence.xml',
|
||||||
'views/inherited_res_company_views.xml',
|
|
||||||
'views/inherited_res_users_views.xml',
|
'views/inherited_res_users_views.xml',
|
||||||
'views/hotel_property_views.xml',
|
'views/hotel_property_views.xml',
|
||||||
'views/hotel_floor_views.xml',
|
'views/hotel_floor_views.xml',
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ class HotelProperty(models.Model):
|
|||||||
|
|
||||||
# TODO: refactoring 'res.config.settings', 'tz_hotel' by the current hotel.property.tz (inherited in res.partner)
|
# TODO: refactoring 'res.config.settings', 'tz_hotel' by the current hotel.property.tz (inherited in res.partner)
|
||||||
|
|
||||||
|
default_cancel_policy_days = fields.Integer('Cancellation Days')
|
||||||
|
default_cancel_policy_percent = fields.Float('Percent to pay')
|
||||||
|
|
||||||
def _check_hours(self):
|
def _check_hours(self):
|
||||||
r = re.compile('[0-2][0-9]:[0-5][0-9]')
|
r = re.compile('[0-2][0-9]:[0-5][0-9]')
|
||||||
if not r.match(self.arrival_hour):
|
if not r.match(self.arrival_hour):
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class HotelRoomTypeRestriction(models.Model):
|
|||||||
help='If unchecked, it will allow you to hide the '
|
help='If unchecked, it will allow you to hide the '
|
||||||
'restriction plan without removing it.')
|
'restriction plan without removing it.')
|
||||||
hotel_ids = fields.One2many('hotel.property',
|
hotel_ids = fields.One2many('hotel.property',
|
||||||
'restriction_id', string='Restriction Plan',
|
'restriction_id', string='Hotel',
|
||||||
default=_get_default_hotel, required=True)
|
default=_get_default_hotel, required=True)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
|
|||||||
@@ -9,18 +9,18 @@ class ResCompany(models.Model):
|
|||||||
|
|
||||||
hotel_ids = fields.One2many('hotel.property', 'company_id', 'Hotels')
|
hotel_ids = fields.One2many('hotel.property', 'company_id', 'Hotels')
|
||||||
|
|
||||||
additional_hours = fields.Integer('Additional Hours',
|
# TODO: need extra explanation or remove otherwise
|
||||||
help="Provide the min hours value for \
|
# additional_hours = fields.Integer('Additional Hours',
|
||||||
check in, checkout days, whatever \
|
# help="Provide the min hours value for \
|
||||||
the hours will be provided here based \
|
# check in, checkout days, whatever \
|
||||||
on that extra days will be \
|
# the hours will be provided here based \
|
||||||
calculated.")
|
# on that extra days will be \
|
||||||
default_cancel_policy_days = fields.Integer('Cancelation Days')
|
# calculated.")
|
||||||
default_cancel_policy_percent = fields.Integer('Percent to pay')
|
# TODO: move the text to the default template for confirmed reservations
|
||||||
cardex_warning = fields.Text(
|
# cardex_warning = fields.Text(
|
||||||
'Warning in Cardex',
|
# 'Warning in Cardex',
|
||||||
default="Time to access rooms: 14: 00h. Departure time: \
|
# default="Time to access rooms: 14: 00h. Departure time: \
|
||||||
12: 00h. If the accommodation is not left at that time, \
|
# 12: 00h. If the accommodation is not left at that time, \
|
||||||
the establishment will charge a day's stay according to \
|
# the establishment will charge a day's stay according to \
|
||||||
current rate that day",
|
# current rate that day",
|
||||||
help="Notice under the signature on the traveler's ticket.")
|
# help="Notice under the signature on the traveler's ticket.")
|
||||||
|
|||||||
@@ -20,19 +20,23 @@
|
|||||||
</group>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
<page string="Settings" name="hotel_settings">
|
<page string="Settings" name="hotel_settings">
|
||||||
<group colspan="4" col="4">
|
<group colspan="4" col="4" string="Price and Restriction Plans">
|
||||||
<field name="pricelist_id" required="True" />
|
<field name="pricelist_id" required="True" />
|
||||||
<field name="restriction_id" required="True" />
|
<field name="restriction_id" required="True" />
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group string="Timezone">
|
||||||
<field name="tz" widget="timezone_mismatch"/>
|
<field name="tz" widget="timezone_mismatch"/>
|
||||||
</group>
|
</group>
|
||||||
<group colspan="4" col="4">
|
<group colspan="4" col="4" string="Check-in hours">
|
||||||
<field name="arrival_hour" />
|
<field name="arrival_hour" />
|
||||||
<field name="departure_hour" />
|
<field name="departure_hour" />
|
||||||
</group>
|
</group>
|
||||||
|
<group colspan="4" col="4" string="Cancellation policies">
|
||||||
|
<field name="default_cancel_policy_days" />
|
||||||
|
<field name="default_cancel_policy_percent" />
|
||||||
|
</group>
|
||||||
</page>
|
</page>
|
||||||
<page string="Rooms" name="hotel_settings">
|
<page string="Rooms" name="hotel_rooms">
|
||||||
<group>
|
<group>
|
||||||
<field name="room_type_ids"/>
|
<field name="room_type_ids"/>
|
||||||
<field name="room_ids"/>
|
<field name="room_ids"/>
|
||||||
|
|||||||
@@ -22,14 +22,13 @@
|
|||||||
'data': [
|
'data': [
|
||||||
'views/general.xml',
|
'views/general.xml',
|
||||||
'views/actions.xml',
|
'views/actions.xml',
|
||||||
|
'views/inherited_hotel_property_views.xml',
|
||||||
|
'views/inherited_res_company_views.xml',
|
||||||
'views/inherited_res_users_views.xml',
|
'views/inherited_res_users_views.xml',
|
||||||
# 'views/inherited_hotel_room_type_views.xml',
|
|
||||||
# 'views/inherited_hotel_room_views.xml',
|
|
||||||
'views/hotel_reservation_views.xml',
|
'views/hotel_reservation_views.xml',
|
||||||
'views/hotel_calendar_management_views.xml',
|
'views/hotel_calendar_management_views.xml',
|
||||||
'views/hotel_calendar_views.xml',
|
'views/hotel_calendar_views.xml',
|
||||||
'data/menus.xml',
|
'data/menus.xml',
|
||||||
'views/res_config.xml',
|
|
||||||
'data/ir_config_parameter.xml',
|
'data/ir_config_parameter.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
|
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
from . import inherited_hotel_property
|
||||||
from . import hotel_calendar
|
from . import hotel_calendar
|
||||||
from . import bus_hotel_calendar
|
from . import bus_hotel_calendar
|
||||||
from . import hotel_calendar_management
|
from . import hotel_calendar_management
|
||||||
from . import inherited_hotel_reservation
|
from . import inherited_hotel_reservation
|
||||||
|
from . import inherited_res_company
|
||||||
from . import inherited_res_users
|
from . import inherited_res_users
|
||||||
# from . import inherited_hotel_room
|
|
||||||
# from . import inherited_hotel_room_type
|
|
||||||
from . import inherited_hotel_room_type_restriction_item
|
from . import inherited_hotel_room_type_restriction_item
|
||||||
from . import inherited_product_pricelist
|
from . import inherited_product_pricelist
|
||||||
from . import inherited_product_pricelist_item
|
from . import inherited_product_pricelist_item
|
||||||
|
|||||||
@@ -216,18 +216,15 @@ class HotelCalendarManagement(models.TransientModel):
|
|||||||
if not dfrom or not dto:
|
if not dfrom or not dto:
|
||||||
raise ValidationError(_('Input Error: No dates defined!'))
|
raise ValidationError(_('Input Error: No dates defined!'))
|
||||||
vals = {}
|
vals = {}
|
||||||
# TODO: res.config by hotel
|
# TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
|
||||||
if not pricelist_id:
|
if not pricelist_id:
|
||||||
pricelist_id = self.env['ir.default'].sudo().get(
|
pricelist_id = self.env.user.hotel_id.pricelist_id.id
|
||||||
'res.config.settings', 'default_pricelist_id')
|
# TODO: refactoring res.config.settings', 'default_restriction_id by the current hotel.property.restriction_id
|
||||||
if not restriction_id:
|
if not restriction_id:
|
||||||
restriction_id = self.env['ir.default'].sudo().get(
|
restriction_id = self.env.user.hotel_id.restriction_id.id
|
||||||
'res.config.settings', 'default_restriction_id')
|
|
||||||
|
|
||||||
# TODO: ensure pricelist_id and restriction_id belong to the current hotel
|
# TODO: ensure pricelist_id and restriction_id belong to the current hotel
|
||||||
pricelist_id = int(pricelist_id)
|
|
||||||
vals.update({'pricelist_id': pricelist_id})
|
vals.update({'pricelist_id': pricelist_id})
|
||||||
restriction_id = int(restriction_id)
|
|
||||||
vals.update({'restriction_id': restriction_id})
|
vals.update({'restriction_id': restriction_id})
|
||||||
|
|
||||||
restriction_item_ids = self.env['hotel.room.type.restriction.item'].search([
|
restriction_item_ids = self.env['hotel.room.type.restriction.item'].search([
|
||||||
|
|||||||
50
hotel_calendar/models/inherited_hotel_property.py
Normal file
50
hotel_calendar/models/inherited_hotel_property.py
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# Copyright 2019 Pablo Quesada
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
from odoo import models, fields
|
||||||
|
|
||||||
|
|
||||||
|
class HotelProperty(models.Model):
|
||||||
|
_inherit = 'hotel.property'
|
||||||
|
|
||||||
|
pms_show_num_rooms = fields.Integer('Number of rooms to show',
|
||||||
|
default=0)
|
||||||
|
pms_divide_rooms_by_capacity = fields.Boolean('Divide rooms by capacity',
|
||||||
|
default=True)
|
||||||
|
pms_end_day_week = fields.Selection([
|
||||||
|
('1', 'Monday'),
|
||||||
|
('2', 'Tuesday'),
|
||||||
|
('3', 'Wednesday'),
|
||||||
|
('4', 'Thursday'),
|
||||||
|
('5', 'Friday'),
|
||||||
|
('6', 'Saturday'),
|
||||||
|
('7', 'Sunday')
|
||||||
|
], string='Highlight column of day', default='6')
|
||||||
|
pms_end_day_week_offset = fields.Selection([
|
||||||
|
('0', '0 Days'),
|
||||||
|
('1', '1 Days'),
|
||||||
|
('2', '2 Days'),
|
||||||
|
('3', '3 Days'),
|
||||||
|
('4', '4 Days'),
|
||||||
|
('5', '5 Days'),
|
||||||
|
('6', '6 Days')
|
||||||
|
], string='Also illuminate the previous', default='0')
|
||||||
|
pms_default_num_days = fields.Selection([
|
||||||
|
('month', '1 Month'),
|
||||||
|
('21', '3 Weeks'),
|
||||||
|
('14', '2 Weeks'),
|
||||||
|
('7', '1 Week')
|
||||||
|
], string='Default number of days', default='month')
|
||||||
|
# TODO: review the use of the following option in the calendar js functions
|
||||||
|
pms_type_move = fields.Selection([
|
||||||
|
('normal', 'Normal'),
|
||||||
|
('assisted', 'Assisted'),
|
||||||
|
('allow_invalid', 'Allow Invalid')
|
||||||
|
], string='Reservation move mode', default='normal')
|
||||||
|
|
||||||
|
pms_allowed_events_tags = fields.Many2many(
|
||||||
|
'calendar.event.type',
|
||||||
|
string="Allow Calendar Event Tags")
|
||||||
|
pms_denied_events_tags = fields.Many2many(
|
||||||
|
'calendar.event.type',
|
||||||
|
string="Deny Calendar Event Tags")
|
||||||
|
|
||||||
@@ -133,10 +133,8 @@ class HotelReservation(models.Model):
|
|||||||
@api.model
|
@api.model
|
||||||
def _hcalendar_room_data(self, rooms):
|
def _hcalendar_room_data(self, rooms):
|
||||||
_logger.warning('_found [%s] rooms for hotel [%s]', len(rooms), self.env.user.hotel_id.id)
|
_logger.warning('_found [%s] rooms for hotel [%s]', len(rooms), self.env.user.hotel_id.id)
|
||||||
pricelist_id = self.env['ir.default'].sudo().get(
|
# TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
|
||||||
'res.config.settings', 'default_pricelist_id')
|
pricelist_id = self.env.user.hotel_id.pricelist_id.id
|
||||||
if pricelist_id:
|
|
||||||
pricelist_id = int(pricelist_id)
|
|
||||||
json_rooms = [
|
json_rooms = [
|
||||||
{
|
{
|
||||||
'id': room.id,
|
'id': room.id,
|
||||||
@@ -242,13 +240,9 @@ class HotelReservation(models.Model):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def get_hcalendar_pricelist_data(self, dfrom_dt, dto_dt):
|
def get_hcalendar_pricelist_data(self, dfrom_dt, dto_dt):
|
||||||
pricelist_id = self.env['ir.default'].sudo().get(
|
# TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
|
||||||
'res.config.settings', 'default_pricelist_id')
|
pricelist_id = self.env.user.hotel_id.pricelist_id.id
|
||||||
if pricelist_id:
|
|
||||||
pricelist_id = int(pricelist_id)
|
|
||||||
|
|
||||||
hotel_id = self.env.user.hotel_id.id
|
hotel_id = self.env.user.hotel_id.id
|
||||||
|
|
||||||
room_types_ids = self.env['hotel.room.type'].search([
|
room_types_ids = self.env['hotel.room.type'].search([
|
||||||
('hotel_id', '=', hotel_id)
|
('hotel_id', '=', hotel_id)
|
||||||
])
|
])
|
||||||
@@ -301,13 +295,9 @@ class HotelReservation(models.Model):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def get_hcalendar_restrictions_data(self, dfrom_dt, dto_dt):
|
def get_hcalendar_restrictions_data(self, dfrom_dt, dto_dt):
|
||||||
restriction_id = self.env['ir.default'].sudo().get(
|
# TODO: refactoring res.config.settings', 'default_restriction_id by the current hotel.property.restriction_id
|
||||||
'res.config.settings', 'default_restriction_id')
|
restriction_id = self.env.user.hotel_id.restriction_id.id
|
||||||
if restriction_id:
|
|
||||||
restriction_id = int(restriction_id)
|
|
||||||
|
|
||||||
hotel_id = self.env.user.hotel_id.id
|
hotel_id = self.env.user.hotel_id.id
|
||||||
|
|
||||||
# Get Restrictions
|
# Get Restrictions
|
||||||
json_rooms_rests = {}
|
json_rooms_rests = {}
|
||||||
room_typed_ids = self.env['hotel.room.type'].search([], order='sequence ASC')
|
room_typed_ids = self.env['hotel.room.type'].search([], order='sequence ASC')
|
||||||
@@ -369,10 +359,8 @@ class HotelReservation(models.Model):
|
|||||||
'days': user_id.pms_default_num_days,
|
'days': user_id.pms_default_num_days,
|
||||||
'allow_invalid_actions': type_move == 'allow_invalid',
|
'allow_invalid_actions': type_move == 'allow_invalid',
|
||||||
'assisted_movement': type_move == 'assisted',
|
'assisted_movement': type_move == 'assisted',
|
||||||
'default_arrival_hour': self.env['ir.default'].sudo().get(
|
'default_arrival_hour': self.env.user.hotel_id.arrival_hour,
|
||||||
'res.config.settings', 'default_arrival_hour'),
|
'default_departure_hour': self.env.user.hotel_id.departure_hour,
|
||||||
'default_departure_hour': self.env['ir.default'].sudo().get(
|
|
||||||
'res.config.settings', 'default_departure_hour'),
|
|
||||||
'show_notifications': user_id.pms_show_notifications,
|
'show_notifications': user_id.pms_show_notifications,
|
||||||
'show_pricelist': user_id.pms_show_pricelist,
|
'show_pricelist': user_id.pms_show_pricelist,
|
||||||
'show_availability': user_id.pms_show_availability,
|
'show_availability': user_id.pms_show_availability,
|
||||||
|
|||||||
@@ -11,11 +11,8 @@ class HotelRoomTypeResrtrictionItem(models.Model):
|
|||||||
@api.model
|
@api.model
|
||||||
def create(self, vals):
|
def create(self, vals):
|
||||||
res = super(HotelRoomTypeResrtrictionItem, self).create(vals)
|
res = super(HotelRoomTypeResrtrictionItem, self).create(vals)
|
||||||
restrictions_default_id = self.env['ir.default'].sudo().get(
|
# TODO: refactoring res.config.settings', 'default_restriction_id by the current hotel.property.restriction_id
|
||||||
'res.config.settings', 'default_restriction_id')
|
if res.restriction_id.id == self.env.user.hotel_id.restriction_id.id:
|
||||||
if restrictions_default_id:
|
|
||||||
restrictions_default_id = int(restrictions_default_id)
|
|
||||||
if res.restriction_id.id == restrictions_default_id:
|
|
||||||
self.env['bus.hotel.calendar'].send_restriction_notification({
|
self.env['bus.hotel.calendar'].send_restriction_notification({
|
||||||
'restriction_id': res.restriction_id.id,
|
'restriction_id': res.restriction_id.id,
|
||||||
'date': res.date,
|
'date': res.date,
|
||||||
@@ -53,14 +50,12 @@ class HotelRoomTypeResrtrictionItem(models.Model):
|
|||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def unlink(self):
|
def unlink(self):
|
||||||
restrictions_default_id = self.env['ir.default'].sudo().get(
|
# TODO: refactoring res.config.settings', 'default_restriction_id by the current hotel.property.restriction_id
|
||||||
'res.config.settings', 'default_restriction_id')
|
default_restriction_id = self.env.user.hotel_id.restriction_id.id
|
||||||
if restrictions_default_id:
|
|
||||||
restrictions_default_id = int(restrictions_default_id)
|
|
||||||
# Construct dictionary with relevant info of removed records
|
# Construct dictionary with relevant info of removed records
|
||||||
unlink_vals = []
|
unlink_vals = []
|
||||||
for record in self:
|
for record in self:
|
||||||
if record.restriction_id.id != restrictions_default_id:
|
if record.restriction_id.id != default_restriction_id:
|
||||||
continue
|
continue
|
||||||
unlink_vals.append({
|
unlink_vals.append({
|
||||||
'restriction_id': record.restriction_id.id,
|
'restriction_id': record.restriction_id.id,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class ProductPricelistItem(models.Model):
|
|||||||
@api.model
|
@api.model
|
||||||
def create(self, vals):
|
def create(self, vals):
|
||||||
res = super(ProductPricelistItem, self).create(vals)
|
res = super(ProductPricelistItem, self).create(vals)
|
||||||
|
# TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
|
||||||
pricelist_default_id = self.env['ir.default'].sudo().get(
|
pricelist_default_id = self.env['ir.default'].sudo().get(
|
||||||
'res.config.settings', 'default_pricelist_id')
|
'res.config.settings', 'default_pricelist_id')
|
||||||
if pricelist_default_id:
|
if pricelist_default_id:
|
||||||
@@ -37,6 +38,7 @@ class ProductPricelistItem(models.Model):
|
|||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
|
# TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
|
||||||
pricelist_default_id = self.env['ir.default'].sudo().get(
|
pricelist_default_id = self.env['ir.default'].sudo().get(
|
||||||
'res.config.settings', 'default_pricelist_id')
|
'res.config.settings', 'default_pricelist_id')
|
||||||
if pricelist_default_id:
|
if pricelist_default_id:
|
||||||
@@ -76,6 +78,7 @@ class ProductPricelistItem(models.Model):
|
|||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def unlink(self):
|
def unlink(self):
|
||||||
|
# TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
|
||||||
pricelist_default_id = self.env['ir.default'].sudo().get(
|
pricelist_default_id = self.env['ir.default'].sudo().get(
|
||||||
'res.config.settings', 'default_pricelist_id')
|
'res.config.settings', 'default_pricelist_id')
|
||||||
if pricelist_default_id:
|
if pricelist_default_id:
|
||||||
|
|||||||
30
hotel_calendar/models/inherited_res_company.py
Normal file
30
hotel_calendar/models/inherited_res_company.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Copyright 2019 Pablo Quesada
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
from odoo import models, fields, api, _
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
|
class ResCompany(models.Model):
|
||||||
|
_inherit = 'res.company'
|
||||||
|
|
||||||
|
color_pre_reservation = fields.Char('Pre-reservation', default='#A24680')
|
||||||
|
color_reservation = fields.Char('Confirmed Reservation ', default='#7C7BAD')
|
||||||
|
color_reservation_pay = fields.Char('Paid Reservation', default='#584D76')
|
||||||
|
color_stay = fields.Char('Checkin', default='#FF4040')
|
||||||
|
color_stay_pay = fields.Char('Paid Checkin', default='#82BF07')
|
||||||
|
color_checkout = fields.Char('Checkout', default='#7E7E7E')
|
||||||
|
color_dontsell = fields.Char('Dont Sell', default='#000000')
|
||||||
|
color_staff = fields.Char('Staff', default='#C08686')
|
||||||
|
color_to_assign = fields.Char('Ota Reservation to Assign', default='#ED722E')
|
||||||
|
color_payment_pending = fields.Char('Payment Pending', default='#A24689')
|
||||||
|
|
||||||
|
color_letter_pre_reservation = fields.Char('Letter Pre-reservation', default='#FFFFFF')
|
||||||
|
color_letter_reservation = fields.Char('Letter Confirmed Reservation ', default='#FFFFFF')
|
||||||
|
color_letter_reservation_pay = fields.Char('Letter Paid Reservation', default='#FFFFFF')
|
||||||
|
color_letter_stay = fields.Char('Letter Checkin', default='#FFFFFF')
|
||||||
|
color_letter_stay_pay = fields.Char('Letter Stay Pay', default='#FFFFFF')
|
||||||
|
color_letter_checkout = fields.Char('Letter Checkout', default='#FFFFFF')
|
||||||
|
color_letter_dontsell = fields.Char('Letter Dont Sell', default='#FFFFFF')
|
||||||
|
color_letter_staff = fields.Char('Letter Staff', default='#FFFFFF')
|
||||||
|
color_letter_to_assign = fields.Char('Letter Ota to Assign', default='#FFFFFF')
|
||||||
|
color_letter_payment_pending = fields.Char('Letter Payment Pending', default='#FFFFFF')
|
||||||
@@ -6,50 +6,10 @@ from odoo import models, fields
|
|||||||
class ResUsers(models.Model):
|
class ResUsers(models.Model):
|
||||||
_inherit = 'res.users'
|
_inherit = 'res.users'
|
||||||
|
|
||||||
pms_divide_rooms_by_capacity = fields.Boolean('Divide rooms by capacity',
|
|
||||||
default=True)
|
|
||||||
pms_end_day_week = fields.Selection([
|
|
||||||
('1', 'Monday'),
|
|
||||||
('2', 'Tuesday'),
|
|
||||||
('3', 'Wednesday'),
|
|
||||||
('4', 'Thursday'),
|
|
||||||
('5', 'Friday'),
|
|
||||||
('6', 'Saturday'),
|
|
||||||
('7', 'Sunday')
|
|
||||||
], string='End day of week', default='6')
|
|
||||||
pms_end_day_week_offset = fields.Selection([
|
|
||||||
('0', '0 Days'),
|
|
||||||
('1', '1 Days'),
|
|
||||||
('2', '2 Days'),
|
|
||||||
('3', '3 Days'),
|
|
||||||
('4', '4 Days'),
|
|
||||||
('5', '5 Days'),
|
|
||||||
('6', '6 Days')
|
|
||||||
], string='Also illuminate the previous', default='0')
|
|
||||||
pms_type_move = fields.Selection([
|
|
||||||
('normal', 'Normal'),
|
|
||||||
('assisted', 'Assisted'),
|
|
||||||
('allow_invalid', 'Allow Invalid')
|
|
||||||
], string='Reservation move mode', default='normal')
|
|
||||||
pms_default_num_days = fields.Selection([
|
|
||||||
('month', '1 Month'),
|
|
||||||
('21', '3 Weeks'),
|
|
||||||
('14', '2 Weeks'),
|
|
||||||
('7', '1 Week')
|
|
||||||
], string='Default number of days', default='month')
|
|
||||||
|
|
||||||
pms_show_notifications = fields.Boolean('Show Notifications', default=True)
|
pms_show_notifications = fields.Boolean('Show Notifications', default=True)
|
||||||
pms_show_pricelist = fields.Boolean('Show Pricelist', default=True)
|
pms_show_pricelist = fields.Boolean('Show Pricelist', default=True)
|
||||||
pms_show_availability = fields.Boolean('Show Availability', default=True)
|
pms_show_availability = fields.Boolean('Show Availability', default=True)
|
||||||
pms_show_num_rooms = fields.Integer('Show Num. Rooms', default=0)
|
# TODO Allow calendar events? by user / by hotel / by company ?
|
||||||
|
|
||||||
pms_allowed_events_tags = fields.Many2many(
|
|
||||||
'calendar.event.type',
|
|
||||||
string="Allow Calander Event Tags")
|
|
||||||
pms_denied_events_tags = fields.Many2many(
|
|
||||||
'calendar.event.type',
|
|
||||||
string="Deny Calander Event Tags")
|
|
||||||
|
|
||||||
npms_end_day_week = fields.Selection([
|
npms_end_day_week = fields.Selection([
|
||||||
('1', 'Monday'),
|
('1', 'Monday'),
|
||||||
('2', 'Tuesday'),
|
('2', 'Tuesday'),
|
||||||
@@ -77,10 +37,10 @@ class ResUsers(models.Model):
|
|||||||
|
|
||||||
npms_allowed_events_tags = fields.Many2many(
|
npms_allowed_events_tags = fields.Many2many(
|
||||||
'calendar.event.type',
|
'calendar.event.type',
|
||||||
string="Allow Calander Event Tags")
|
string="Allow Calandar Event Tags")
|
||||||
npms_denied_events_tags = fields.Many2many(
|
npms_denied_events_tags = fields.Many2many(
|
||||||
'calendar.event.type',
|
'calendar.event.type',
|
||||||
string="Deny Calander Event Tags")
|
string="Deny Calandar Event Tags")
|
||||||
|
|
||||||
def __init__(self, pool, cr):
|
def __init__(self, pool, cr):
|
||||||
""" Override of __init__ to add access rights.
|
""" Override of __init__ to add access rights.
|
||||||
@@ -91,40 +51,14 @@ class ResUsers(models.Model):
|
|||||||
# duplicate list to avoid modifying the original reference
|
# duplicate list to avoid modifying the original reference
|
||||||
type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
|
type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
|
||||||
type(self).SELF_WRITEABLE_FIELDS.extend([
|
type(self).SELF_WRITEABLE_FIELDS.extend([
|
||||||
'pms_divide_rooms_by_capacity',
|
|
||||||
'pms_end_day_week',
|
|
||||||
'pms_end_day_week_offset',
|
|
||||||
'pms_type_move',
|
|
||||||
'pms_default_num_days',
|
|
||||||
'pms_show_notifications',
|
'pms_show_notifications',
|
||||||
'pms_show_pricelist',
|
'pms_show_pricelist',
|
||||||
'pms_show_availability',
|
'pms_show_availability',
|
||||||
'pms_show_num_rooms',
|
|
||||||
'pms_allowed_events_tags',
|
|
||||||
'pms_denied_events_tags',
|
|
||||||
'npms_end_day_week',
|
|
||||||
'npms_end_day_week_offset',
|
|
||||||
'npms_default_num_days',
|
|
||||||
'npms_allowed_events_tags',
|
|
||||||
'npms_denied_events_tags',
|
|
||||||
])
|
])
|
||||||
# duplicate list to avoid modifying the original reference
|
# duplicate list to avoid modifying the original reference
|
||||||
type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
|
type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
|
||||||
type(self).SELF_READABLE_FIELDS.extend([
|
type(self).SELF_READABLE_FIELDS.extend([
|
||||||
'pms_divide_rooms_by_capacity',
|
|
||||||
'pms_end_day_week',
|
|
||||||
'pms_end_day_week_offset',
|
|
||||||
'pms_type_move',
|
|
||||||
'pms_default_num_days',
|
|
||||||
'pms_show_notifications',
|
'pms_show_notifications',
|
||||||
'pms_show_pricelist',
|
'pms_show_pricelist',
|
||||||
'pms_show_availability',
|
'pms_show_availability',
|
||||||
'pms_show_num_rooms',
|
|
||||||
'pms_allowed_events_tags',
|
|
||||||
'pms_denied_events_tags',
|
|
||||||
'npms_end_day_week',
|
|
||||||
'npms_end_day_week_offset',
|
|
||||||
'npms_default_num_days',
|
|
||||||
'npms_allowed_events_tags',
|
|
||||||
'npms_denied_events_tags',
|
|
||||||
])
|
])
|
||||||
|
|||||||
31
hotel_calendar/views/inherited_hotel_property_views.xml
Normal file
31
hotel_calendar/views/inherited_hotel_property_views.xml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="hotel_property_views_form" model="ir.ui.view">
|
||||||
|
<field name="model">hotel.property</field>
|
||||||
|
<field name="inherit_id" ref="hotel.hotel_property_views_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//page[@name='hotel_settings']" position="after">
|
||||||
|
<page string='Calendar Settings' name="hotel_calendar">
|
||||||
|
<group colspan="4">
|
||||||
|
<group string="Rooms and Reservations">
|
||||||
|
<field name="pms_show_num_rooms" />
|
||||||
|
<field name="pms_divide_rooms_by_capacity" />
|
||||||
|
<field name="pms_type_move" required="True" />
|
||||||
|
</group>
|
||||||
|
<group string="Calendar (PMS)">
|
||||||
|
<field name="pms_end_day_week" required="True" />
|
||||||
|
<field name="pms_end_day_week_offset" required="True" />
|
||||||
|
<field name="pms_default_num_days" required="True" />
|
||||||
|
</group>
|
||||||
|
<group string="Events">
|
||||||
|
<field name="pms_allowed_events_tags" widget="many2many_tags" />
|
||||||
|
<field name="pms_denied_events_tags" widget="many2many_tags" />
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
</page>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
@@ -8,9 +8,32 @@
|
|||||||
<field name="inherit_id" ref="base.view_company_form"/>
|
<field name="inherit_id" ref="base.view_company_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//page" position="after">
|
<xpath expr="//page" position="after">
|
||||||
<page string="Hotels" name="hotel_page">
|
<page string="Hotel Preferences" name="hotel_preferences">
|
||||||
<group name="hotel">
|
<group>
|
||||||
<field name="hotel_ids"/>
|
<group string="Reservation Background Colors">
|
||||||
|
<field name="color_pre_reservation" widget="color" />
|
||||||
|
<field name="color_reservation" widget="color" />
|
||||||
|
<field name="color_reservation_pay" widget="color" />
|
||||||
|
<field name="color_stay" widget="color" />
|
||||||
|
<field name="color_stay_pay" widget="color" />
|
||||||
|
<field name="color_checkout" widget="color" />
|
||||||
|
<field name="color_dontsell" widget="color" />
|
||||||
|
<field name="color_staff" widget="color" />
|
||||||
|
<field name="color_to_assign" widget="color" />
|
||||||
|
<field name="color_payment_pending" widget="color" />
|
||||||
|
</group>
|
||||||
|
<group string="Reservation Letter Colors">
|
||||||
|
<field name="color_letter_pre_reservation" widget="color" />
|
||||||
|
<field name="color_letter_reservation" widget="color" />
|
||||||
|
<field name="color_letter_reservation_pay" widget="color" />
|
||||||
|
<field name="color_letter_stay" widget="color" />
|
||||||
|
<field name="color_letter_stay_pay" widget="color" />
|
||||||
|
<field name="color_letter_checkout" widget="color" />
|
||||||
|
<field name="color_letter_dontsell" widget="color" />
|
||||||
|
<field name="color_letter_staff" widget="color" />
|
||||||
|
<field name="color_letter_to_assign" widget="color" />
|
||||||
|
<field name="color_letter_payment_pending" widget="color" />
|
||||||
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|||||||
@@ -1,43 +1,20 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="res_users_view_form" model="ir.ui.view">
|
<record id="view_users_form_simple_modif" model="ir.ui.view">
|
||||||
<field name="model">res.users</field>
|
<field name="model">res.users</field>
|
||||||
<field name="inherit_id" ref="base.view_users_form" />
|
<field name="inherit_id" ref="base.view_users_form_simple_modif" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//page/group/group[@name='preferences']" position="before">
|
<xpath expr="//group[@name='preferences']" position="after">
|
||||||
<group string="Calendar (PMS)" name="calendar">
|
<group string="Calendar (PMS) Preferences" name="preferences_calendar">
|
||||||
<group colspan="4">
|
<group col="8" colspan="4">
|
||||||
<field name="pms_show_notifications" />
|
<field name="pms_show_notifications" />
|
||||||
<field name="pms_show_pricelist" />
|
<field name="pms_show_pricelist" />
|
||||||
<field name="pms_show_availability" />
|
<field name="pms_show_availability" />
|
||||||
<field name="pms_show_num_rooms" />
|
|
||||||
</group>
|
|
||||||
<group colspan="4">
|
|
||||||
<field name="pms_divide_rooms_by_capacity" />
|
|
||||||
<field name="pms_end_day_week" required="True" />
|
|
||||||
<field name="pms_end_day_week_offset" required="True" />
|
|
||||||
<field name="pms_type_move" required="True" />
|
|
||||||
<field name="pms_default_num_days" required="True" />
|
|
||||||
</group>
|
|
||||||
<group colspan="4">
|
|
||||||
<field name="pms_allowed_events_tags" widget="many2many_tags" />
|
|
||||||
<field name="pms_denied_events_tags" widget="many2many_tags" />
|
|
||||||
</group>
|
|
||||||
</group>
|
|
||||||
<group string="Calendar Management (Revenue PMS)" name="calendar">
|
|
||||||
<group colspan="4">
|
|
||||||
<field name="npms_end_day_week" required="True" />
|
|
||||||
<field name="npms_end_day_week_offset" required="True" />
|
|
||||||
<field name="npms_default_num_days" required="True" />
|
|
||||||
</group>
|
|
||||||
<group colspan="4">
|
|
||||||
<field name="npms_allowed_events_tags" widget="many2many_tags" />
|
|
||||||
<field name="npms_denied_events_tags" widget="many2many_tags" />
|
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
Reference in New Issue
Block a user