diff --git a/hotel/__manifest__.py b/hotel/__manifest__.py
index 257b8fb0c..0ac8aa53b 100644
--- a/hotel/__manifest__.py
+++ b/hotel/__manifest__.py
@@ -35,7 +35,6 @@
'wizard/massive_price_reservation_days.xml',
'wizard/folio_make_invoice_advance_views.xml',
'data/hotel_sequence.xml',
- 'views/inherited_res_company_views.xml',
'views/inherited_res_users_views.xml',
'views/hotel_property_views.xml',
'views/hotel_floor_views.xml',
diff --git a/hotel/models/hotel_property.py b/hotel/models/hotel_property.py
index c08a3dc55..b29021ede 100644
--- a/hotel/models/hotel_property.py
+++ b/hotel/models/hotel_property.py
@@ -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)
+ default_cancel_policy_days = fields.Integer('Cancellation Days')
+ default_cancel_policy_percent = fields.Float('Percent to pay')
+
def _check_hours(self):
r = re.compile('[0-2][0-9]:[0-5][0-9]')
if not r.match(self.arrival_hour):
diff --git a/hotel/models/hotel_room_type_restriction.py b/hotel/models/hotel_room_type_restriction.py
index 9891c4a80..64a7030ab 100644
--- a/hotel/models/hotel_room_type_restriction.py
+++ b/hotel/models/hotel_room_type_restriction.py
@@ -18,7 +18,7 @@ class HotelRoomTypeRestriction(models.Model):
help='If unchecked, it will allow you to hide the '
'restriction plan without removing it.')
hotel_ids = fields.One2many('hotel.property',
- 'restriction_id', string='Restriction Plan',
+ 'restriction_id', string='Hotel',
default=_get_default_hotel, required=True)
@api.multi
diff --git a/hotel/models/inherited_res_company.py b/hotel/models/inherited_res_company.py
index 0eb942f7a..c110994d4 100644
--- a/hotel/models/inherited_res_company.py
+++ b/hotel/models/inherited_res_company.py
@@ -9,18 +9,18 @@ class ResCompany(models.Model):
hotel_ids = fields.One2many('hotel.property', 'company_id', 'Hotels')
- additional_hours = fields.Integer('Additional Hours',
- help="Provide the min hours value for \
- check in, checkout days, whatever \
- the hours will be provided here based \
- on that extra days will be \
- calculated.")
- default_cancel_policy_days = fields.Integer('Cancelation Days')
- default_cancel_policy_percent = fields.Integer('Percent to pay')
- cardex_warning = fields.Text(
- 'Warning in Cardex',
- default="Time to access rooms: 14: 00h. Departure time: \
- 12: 00h. If the accommodation is not left at that time, \
- the establishment will charge a day's stay according to \
- current rate that day",
- help="Notice under the signature on the traveler's ticket.")
+ # TODO: need extra explanation or remove otherwise
+ # additional_hours = fields.Integer('Additional Hours',
+ # help="Provide the min hours value for \
+ # check in, checkout days, whatever \
+ # the hours will be provided here based \
+ # on that extra days will be \
+ # calculated.")
+ # TODO: move the text to the default template for confirmed reservations
+ # cardex_warning = fields.Text(
+ # 'Warning in Cardex',
+ # default="Time to access rooms: 14: 00h. Departure time: \
+ # 12: 00h. If the accommodation is not left at that time, \
+ # the establishment will charge a day's stay according to \
+ # current rate that day",
+ # help="Notice under the signature on the traveler's ticket.")
diff --git a/hotel/views/hotel_property_views.xml b/hotel/views/hotel_property_views.xml
index d94061446..65c1190cd 100644
--- a/hotel/views/hotel_property_views.xml
+++ b/hotel/views/hotel_property_views.xml
@@ -20,19 +20,23 @@
-
+
-
+
-
+
+
+
+
+
-
+
diff --git a/hotel_calendar/__manifest__.py b/hotel_calendar/__manifest__.py
index 5546e1abc..aa839d639 100644
--- a/hotel_calendar/__manifest__.py
+++ b/hotel_calendar/__manifest__.py
@@ -22,14 +22,13 @@
'data': [
'views/general.xml',
'views/actions.xml',
+ 'views/inherited_hotel_property_views.xml',
+ 'views/inherited_res_company_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_calendar_management_views.xml',
'views/hotel_calendar_views.xml',
'data/menus.xml',
- 'views/res_config.xml',
'data/ir_config_parameter.xml',
'security/ir.model.access.csv',
],
diff --git a/hotel_calendar/models/__init__.py b/hotel_calendar/models/__init__.py
index b84ca2d85..98ead0513 100644
--- a/hotel_calendar/models/__init__.py
+++ b/hotel_calendar/models/__init__.py
@@ -1,12 +1,12 @@
# Copyright 2018 Alexandre Díaz
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+from . import inherited_hotel_property
from . import hotel_calendar
from . import bus_hotel_calendar
from . import hotel_calendar_management
from . import inherited_hotel_reservation
+from . import inherited_res_company
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_product_pricelist
from . import inherited_product_pricelist_item
diff --git a/hotel_calendar/models/hotel_calendar_management.py b/hotel_calendar/models/hotel_calendar_management.py
index 86e03b3ab..4efd7f1cd 100644
--- a/hotel_calendar/models/hotel_calendar_management.py
+++ b/hotel_calendar/models/hotel_calendar_management.py
@@ -216,18 +216,15 @@ class HotelCalendarManagement(models.TransientModel):
if not dfrom or not dto:
raise ValidationError(_('Input Error: No dates defined!'))
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:
- pricelist_id = self.env['ir.default'].sudo().get(
- 'res.config.settings', 'default_pricelist_id')
+ pricelist_id = self.env.user.hotel_id.pricelist_id.id
+ # TODO: refactoring res.config.settings', 'default_restriction_id by the current hotel.property.restriction_id
if not restriction_id:
- restriction_id = self.env['ir.default'].sudo().get(
- 'res.config.settings', 'default_restriction_id')
+ restriction_id = self.env.user.hotel_id.restriction_id.id
# TODO: ensure pricelist_id and restriction_id belong to the current hotel
- pricelist_id = int(pricelist_id)
vals.update({'pricelist_id': pricelist_id})
- restriction_id = int(restriction_id)
vals.update({'restriction_id': restriction_id})
restriction_item_ids = self.env['hotel.room.type.restriction.item'].search([
diff --git a/hotel_calendar/models/inherited_hotel_property.py b/hotel_calendar/models/inherited_hotel_property.py
new file mode 100644
index 000000000..1adf6c502
--- /dev/null
+++ b/hotel_calendar/models/inherited_hotel_property.py
@@ -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")
+
diff --git a/hotel_calendar/models/inherited_hotel_reservation.py b/hotel_calendar/models/inherited_hotel_reservation.py
index 7327183c0..dc59cab6c 100644
--- a/hotel_calendar/models/inherited_hotel_reservation.py
+++ b/hotel_calendar/models/inherited_hotel_reservation.py
@@ -133,10 +133,8 @@ class HotelReservation(models.Model):
@api.model
def _hcalendar_room_data(self, rooms):
_logger.warning('_found [%s] rooms for hotel [%s]', len(rooms), self.env.user.hotel_id.id)
- pricelist_id = self.env['ir.default'].sudo().get(
- 'res.config.settings', 'default_pricelist_id')
- if pricelist_id:
- pricelist_id = int(pricelist_id)
+ # TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
+ pricelist_id = self.env.user.hotel_id.pricelist_id.id
json_rooms = [
{
'id': room.id,
@@ -242,13 +240,9 @@ class HotelReservation(models.Model):
@api.model
def get_hcalendar_pricelist_data(self, dfrom_dt, dto_dt):
- pricelist_id = self.env['ir.default'].sudo().get(
- 'res.config.settings', 'default_pricelist_id')
- if pricelist_id:
- pricelist_id = int(pricelist_id)
-
+ # TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
+ pricelist_id = self.env.user.hotel_id.pricelist_id.id
hotel_id = self.env.user.hotel_id.id
-
room_types_ids = self.env['hotel.room.type'].search([
('hotel_id', '=', hotel_id)
])
@@ -301,13 +295,9 @@ class HotelReservation(models.Model):
@api.model
def get_hcalendar_restrictions_data(self, dfrom_dt, dto_dt):
- restriction_id = self.env['ir.default'].sudo().get(
- 'res.config.settings', 'default_restriction_id')
- if restriction_id:
- restriction_id = int(restriction_id)
-
+ # TODO: refactoring res.config.settings', 'default_restriction_id by the current hotel.property.restriction_id
+ restriction_id = self.env.user.hotel_id.restriction_id.id
hotel_id = self.env.user.hotel_id.id
-
# Get Restrictions
json_rooms_rests = {}
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,
'allow_invalid_actions': type_move == 'allow_invalid',
'assisted_movement': type_move == 'assisted',
- 'default_arrival_hour': self.env['ir.default'].sudo().get(
- 'res.config.settings', 'default_arrival_hour'),
- 'default_departure_hour': self.env['ir.default'].sudo().get(
- 'res.config.settings', 'default_departure_hour'),
+ 'default_arrival_hour': self.env.user.hotel_id.arrival_hour,
+ 'default_departure_hour': self.env.user.hotel_id.departure_hour,
'show_notifications': user_id.pms_show_notifications,
'show_pricelist': user_id.pms_show_pricelist,
'show_availability': user_id.pms_show_availability,
diff --git a/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py b/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py
index 486c58152..f3944310d 100644
--- a/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py
+++ b/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py
@@ -11,11 +11,8 @@ class HotelRoomTypeResrtrictionItem(models.Model):
@api.model
def create(self, vals):
res = super(HotelRoomTypeResrtrictionItem, self).create(vals)
- restrictions_default_id = self.env['ir.default'].sudo().get(
- 'res.config.settings', 'default_restriction_id')
- if restrictions_default_id:
- restrictions_default_id = int(restrictions_default_id)
- if res.restriction_id.id == restrictions_default_id:
+ # TODO: refactoring res.config.settings', 'default_restriction_id by the current hotel.property.restriction_id
+ if res.restriction_id.id == self.env.user.hotel_id.restriction_id.id:
self.env['bus.hotel.calendar'].send_restriction_notification({
'restriction_id': res.restriction_id.id,
'date': res.date,
@@ -53,14 +50,12 @@ class HotelRoomTypeResrtrictionItem(models.Model):
@api.multi
def unlink(self):
- restrictions_default_id = self.env['ir.default'].sudo().get(
- 'res.config.settings', 'default_restriction_id')
- if restrictions_default_id:
- restrictions_default_id = int(restrictions_default_id)
+ # TODO: refactoring res.config.settings', 'default_restriction_id by the current hotel.property.restriction_id
+ default_restriction_id = self.env.user.hotel_id.restriction_id.id
# Construct dictionary with relevant info of removed records
unlink_vals = []
for record in self:
- if record.restriction_id.id != restrictions_default_id:
+ if record.restriction_id.id != default_restriction_id:
continue
unlink_vals.append({
'restriction_id': record.restriction_id.id,
diff --git a/hotel_calendar/models/inherited_product_pricelist_item.py b/hotel_calendar/models/inherited_product_pricelist_item.py
index ad93492dc..896769ee8 100644
--- a/hotel_calendar/models/inherited_product_pricelist_item.py
+++ b/hotel_calendar/models/inherited_product_pricelist_item.py
@@ -9,6 +9,7 @@ class ProductPricelistItem(models.Model):
@api.model
def create(self, 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(
'res.config.settings', 'default_pricelist_id')
if pricelist_default_id:
@@ -37,6 +38,7 @@ class ProductPricelistItem(models.Model):
@api.multi
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(
'res.config.settings', 'default_pricelist_id')
if pricelist_default_id:
@@ -76,6 +78,7 @@ class ProductPricelistItem(models.Model):
@api.multi
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(
'res.config.settings', 'default_pricelist_id')
if pricelist_default_id:
diff --git a/hotel_calendar/models/inherited_res_company.py b/hotel_calendar/models/inherited_res_company.py
new file mode 100644
index 000000000..21a933569
--- /dev/null
+++ b/hotel_calendar/models/inherited_res_company.py
@@ -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')
diff --git a/hotel_calendar/models/inherited_res_users.py b/hotel_calendar/models/inherited_res_users.py
index 027189f53..eec94419a 100644
--- a/hotel_calendar/models/inherited_res_users.py
+++ b/hotel_calendar/models/inherited_res_users.py
@@ -6,50 +6,10 @@ from odoo import models, fields
class ResUsers(models.Model):
_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_pricelist = fields.Boolean('Show Pricelist', default=True)
pms_show_availability = fields.Boolean('Show Availability', default=True)
- pms_show_num_rooms = fields.Integer('Show Num. Rooms', default=0)
-
- 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")
-
+ # TODO Allow calendar events? by user / by hotel / by company ?
npms_end_day_week = fields.Selection([
('1', 'Monday'),
('2', 'Tuesday'),
@@ -77,10 +37,10 @@ class ResUsers(models.Model):
npms_allowed_events_tags = fields.Many2many(
'calendar.event.type',
- string="Allow Calander Event Tags")
+ string="Allow Calandar Event Tags")
npms_denied_events_tags = fields.Many2many(
'calendar.event.type',
- string="Deny Calander Event Tags")
+ string="Deny Calandar Event Tags")
def __init__(self, pool, cr):
""" Override of __init__ to add access rights.
@@ -91,40 +51,14 @@ class ResUsers(models.Model):
# duplicate list to avoid modifying the original reference
type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
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_pricelist',
'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
type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
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_pricelist',
'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',
])
diff --git a/hotel_calendar/views/inherited_hotel_property_views.xml b/hotel_calendar/views/inherited_hotel_property_views.xml
new file mode 100644
index 000000000..b774bcbd4
--- /dev/null
+++ b/hotel_calendar/views/inherited_hotel_property_views.xml
@@ -0,0 +1,31 @@
+
+
+
+
+ hotel.property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hotel_calendar/views/inherited_res_company_views.xml b/hotel_calendar/views/inherited_res_company_views.xml
index aea69d8b9..de31ddf29 100644
--- a/hotel_calendar/views/inherited_res_company_views.xml
+++ b/hotel_calendar/views/inherited_res_company_views.xml
@@ -8,9 +8,32 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hotel_calendar/views/inherited_res_users_views.xml b/hotel_calendar/views/inherited_res_users_views.xml
index 074265932..12c33f265 100644
--- a/hotel_calendar/views/inherited_res_users_views.xml
+++ b/hotel_calendar/views/inherited_res_users_views.xml
@@ -1,43 +1,20 @@
-
+
res.users
-
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file