mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[WIP] refactoring res.config.settings' for hotel calendar
This commit is contained in:
@@ -13,4 +13,3 @@ from . import inherited_product_pricelist_item
|
||||
from . import inherited_hotel_folio
|
||||
from . import ir_actions_act_window_view
|
||||
from . import ir_ui_view
|
||||
from . import res_config
|
||||
|
||||
@@ -267,11 +267,10 @@ class HotelCalendarManagement(models.TransientModel):
|
||||
|
||||
@api.multi
|
||||
def get_hcalendar_settings(self):
|
||||
user_id = self.env['res.users'].browse(self.env.uid)
|
||||
return {
|
||||
'eday_week': user_id.npms_end_day_week,
|
||||
'eday_week_offset': user_id.npms_end_day_week_offset,
|
||||
'days': user_id.npms_default_num_days,
|
||||
'eday_week': self.env.user.hotel_id.pms_end_day_week,
|
||||
'eday_week_offset': self.env.user.hotel_id.pms_end_day_week_offset,
|
||||
'days': self.env.user.hotel_id.pms_default_num_days,
|
||||
'show_notifications': self.env.user.pms_show_notifications,
|
||||
'show_num_rooms': self.env.user.hotel_id.pms_show_num_rooms,
|
||||
}
|
||||
|
||||
@@ -20,43 +20,41 @@ class HotelReservation(models.Model):
|
||||
@api.multi
|
||||
def _generate_color(self):
|
||||
self.ensure_one()
|
||||
reserv_color = '#FFFFFF'
|
||||
reserv_color_text = '#000000'
|
||||
ICPSudo = self.env['ir.config_parameter'].sudo()
|
||||
company_id = self.env.user.company_id
|
||||
if self.reservation_type == 'staff':
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_staff')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_staff')
|
||||
reserv_color = company_id.color_staff
|
||||
reserv_color_text = company_id.color_letter_staff
|
||||
elif self.reservation_type == 'out':
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_dontsell')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_dontsell')
|
||||
reserv_color = company_id.color_dontsell
|
||||
reserv_color_text = company_id.color_letter_dontsell
|
||||
elif self.to_assign:
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_to_assign')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_to_assign')
|
||||
reserv_color = company_id.color_to_assign
|
||||
reserv_color_text = company_id.color_letter_to_assign
|
||||
elif self.state == 'draft':
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_pre_reservation')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_pre_reservation')
|
||||
reserv_color = company_id.color_pre_reservation
|
||||
reserv_color_text = company_id.color_letter_pre_reservation
|
||||
elif self.state == 'confirm':
|
||||
if self.folio_id.pending_amount <= 0:
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_reservation_pay')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_reservation_pay')
|
||||
reserv_color = company_id.color_reservation_pay
|
||||
reserv_color_text = company_id.color_letter_reservation_pay
|
||||
else:
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_reservation')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_reservation')
|
||||
reserv_color = company_id.color_reservation
|
||||
reserv_color_text = company_id.color_letter_reservation
|
||||
elif self.state == 'booking':
|
||||
if self.folio_id.pending_amount <= 0:
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_stay_pay')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_stay_pay')
|
||||
reserv_color = company_id.color_stay_pay
|
||||
reserv_color_text = company_id.color_letter_stay_pay
|
||||
else:
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_stay')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_stay')
|
||||
reserv_color = company_id.color_stay
|
||||
reserv_color_text = company_id.color_letter_stay
|
||||
else:
|
||||
if self.folio_id.pending_amount <= 0:
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_checkout')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_checkout')
|
||||
reserv_color = company_id.color_checkout
|
||||
reserv_color_text = company_id.color_letter_checkout
|
||||
else:
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_payment_pending')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_payment_pending')
|
||||
return (reserv_color, reserv_color_text)
|
||||
reserv_color = company_id.color_payment_pending
|
||||
reserv_color_text = company_id.color_letter_payment_pending
|
||||
return reserv_color, reserv_color_text
|
||||
|
||||
@api.depends('state', 'reservation_type', 'folio_id.pending_amount', 'to_assign')
|
||||
def _compute_color(self):
|
||||
@@ -353,7 +351,6 @@ class HotelReservation(models.Model):
|
||||
|
||||
@api.model
|
||||
def get_hcalendar_settings(self):
|
||||
user_id = self.env['res.users'].browse(self.env.uid)
|
||||
type_move = self.env.user.hotel_id.pms_type_move
|
||||
return {
|
||||
'divide_rooms_by_capacity': self.env.user.hotel_id.pms_divide_rooms_by_capacity,
|
||||
|
||||
@@ -9,38 +9,6 @@ class ResUsers(models.Model):
|
||||
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)
|
||||
# TODO Allow calendar events? by user / by hotel / by company ?
|
||||
npms_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')
|
||||
npms_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')
|
||||
npms_default_num_days = fields.Selection([
|
||||
('month', '1 Month'),
|
||||
('21', '3 Weeks'),
|
||||
('14', '2 Weeks'),
|
||||
('7', '1 Week')
|
||||
], string='Default number of days', default='month')
|
||||
|
||||
npms_allowed_events_tags = fields.Many2many(
|
||||
'calendar.event.type',
|
||||
string="Allow Calandar Event Tags")
|
||||
npms_denied_events_tags = fields.Many2many(
|
||||
'calendar.event.type',
|
||||
string="Deny Calandar Event Tags")
|
||||
|
||||
def __init__(self, pool, cr):
|
||||
""" Override of __init__ to add access rights.
|
||||
|
||||
Reference in New Issue
Block a user