mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
Merge remote-tracking branch 'origin/11.0' into pr_ine
This commit is contained in:
@@ -109,17 +109,17 @@ class HotelRoomType(models.Model):
|
||||
})
|
||||
return super().create(vals)
|
||||
|
||||
@api.constrains('shared_room', 'room_ids')
|
||||
def _constrain_shared_room(self):
|
||||
for record in self:
|
||||
if record.shared_room:
|
||||
if any(not room.shared_room_id for room in record.room_ids):
|
||||
raise ValidationError(_('We cant save normal rooms \
|
||||
in a shared room type'))
|
||||
else:
|
||||
if any(room.shared_room_id for room in record.room_ids):
|
||||
raise ValidationError(_('We cant save shared rooms \
|
||||
in a normal room type'))
|
||||
# @api.constrains('shared_room', 'room_ids')
|
||||
# def _constrain_shared_room(self):
|
||||
# for record in self:
|
||||
# if record.shared_room:
|
||||
# if any(not room.shared_room_id for room in record.room_ids):
|
||||
# raise ValidationError(_('We cant save normal rooms \
|
||||
# in a shared room type'))
|
||||
# else:
|
||||
# if any(room.shared_room_id for room in record.room_ids):
|
||||
# raise ValidationError(_('We cant save shared rooms \
|
||||
# in a normal room type'))
|
||||
|
||||
@api.multi
|
||||
def unlink(self):
|
||||
|
||||
@@ -12,7 +12,6 @@ class HotelServiceLine(models.Model):
|
||||
service_id = fields.Many2one('hotel.service', string='Service Room',
|
||||
ondelete='cascade', required=True,
|
||||
copy=False)
|
||||
active = fields.Boolean('Active', compute="_compute_active")
|
||||
date = fields.Date('Date')
|
||||
day_qty = fields.Integer('Units')
|
||||
product_id = fields.Many2one(related='service_id.product_id', store=True)
|
||||
@@ -23,6 +22,10 @@ class HotelServiceLine(models.Model):
|
||||
related="service_id.price_unit",
|
||||
readonly=True,
|
||||
store=True)
|
||||
room_id = fields.Many2one(strin='Room',
|
||||
related="service_id.ser_room_line",
|
||||
readonly=True,
|
||||
store=True)
|
||||
discount = fields.Float('Discount',
|
||||
related="service_id.discount",
|
||||
readonly=True,
|
||||
|
||||
@@ -42,7 +42,8 @@
|
||||
<field name="day_qty"/>
|
||||
<field name="price_unit" />
|
||||
<field name="service_id" />
|
||||
<field name="tax_ids" widget="many2many_tags"/>
|
||||
<field name="room_id" />
|
||||
<field name="tax_ids" invisible="1"/>
|
||||
<field name="discount" />
|
||||
<field name="price_total" />
|
||||
</tree>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[hasclass('settings')]" position="inside">
|
||||
<div class="app_settings_block" data-string="Hotel" string="Hotel" data-key="hotel" groups="hotel.group_hotel_manager">
|
||||
<h2>Hotel Default</h2>
|
||||
<h2 id="default_hotel">Hotel Default</h2>
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<label for="default_pricelist_id"/>
|
||||
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2>Hotel Default Hours</h2>
|
||||
<h2 id="default_hours">Hotel Default Hours</h2>
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-xs-12 col-md-12 o_setting_box">
|
||||
<label for="tz_hotel"/>
|
||||
|
||||
@@ -221,7 +221,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
|
||||
# Create deposit product if necessary
|
||||
if not self.product_id:
|
||||
vals = self._prepare_deposit_product()
|
||||
self.product_id = self.env['product.product'].create(vals)
|
||||
self.product_id = self.env['product.product'].sudo().create(vals)
|
||||
self.env['ir.config_parameter'].sudo().set_param(
|
||||
'sale.default_deposit_product_id', self.product_id.id)
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
'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',
|
||||
],
|
||||
'qweb': [
|
||||
|
||||
86
hotel_calendar/data/ir_config_parameter.xml
Normal file
86
hotel_calendar/data/ir_config_parameter.xml
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="0">
|
||||
<record id="color_pre_reservation" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_pre_reservation</field>
|
||||
<field name="value">#A24680</field>
|
||||
</record>
|
||||
<record id="color_reservation" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_reservation</field>
|
||||
<field name="value">#7C7BAD</field>
|
||||
</record>
|
||||
<record id="color_reservation_pay" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_reservation_pay</field>
|
||||
<field name="value">#584D76</field>
|
||||
</record>
|
||||
<record id="color_stay" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_stay</field>
|
||||
<field name="value">#FF4040</field>
|
||||
</record>
|
||||
<record id="color_stay_pay" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_stay_pay</field>
|
||||
<field name="value">#82BF07</field>
|
||||
</record>
|
||||
<record id="color_checkout" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_checkout</field>
|
||||
<field name="value">#7E7E7E</field>
|
||||
</record>
|
||||
<record id="color_dontsell" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_dontsell</field>
|
||||
<field name="value">#000000</field>
|
||||
</record>
|
||||
<record id="color_staff" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_staff</field>
|
||||
<field name="value">#C08686</field>
|
||||
</record>
|
||||
<record id="color_to_assign" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_to_assign</field>
|
||||
<field name="value">#ED722E</field>
|
||||
</record>
|
||||
<record id="color_payment_pending" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_payment_pending</field>
|
||||
<field name="value">#A24689</field>
|
||||
</record>
|
||||
|
||||
<record id="color_letter_pre_reservation" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_letter_pre_reservation</field>
|
||||
<field name="value">#FFFFFF</field>
|
||||
</record>
|
||||
<record id="color_letter_reservation" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_letter_reservation</field>
|
||||
<field name="value">#FFFFFF</field>
|
||||
</record>
|
||||
<record id="color_letter_reservation_pay" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_letter_reservation_pay</field>
|
||||
<field name="value">#FFFFFF</field>
|
||||
</record>
|
||||
<record id="color_letter_stay" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_letter_stay</field>
|
||||
<field name="value">#FFFFFF</field>
|
||||
</record>
|
||||
<record id="color_letter_stay_pay" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_letter_stay_pay</field>
|
||||
<field name="value">#FFFFFF</field>
|
||||
</record>
|
||||
<record id="color_letter_checkout" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_letter_checkout</field>
|
||||
<field name="value">#FFFFFF</field>
|
||||
</record>
|
||||
<record id="color_letter_dontsell" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_letter_dontsell</field>
|
||||
<field name="value">#FFFFFF</field>
|
||||
</record>
|
||||
<record id="color_letter_staff" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_letter_staff</field>
|
||||
<field name="value">#FFFFFF</field>
|
||||
</record>
|
||||
<record id="color_letter_to_assign" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_letter_to_assign</field>
|
||||
<field name="value">#FFFFFF</field>
|
||||
</record>
|
||||
<record id="color_letter_payment_pending" model="ir.config_parameter">
|
||||
<field name="key">hotel_calendar.color_letter_payment_pending</field>
|
||||
<field name="value">#FFFFFF</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -13,3 +13,4 @@ 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
|
||||
|
||||
@@ -20,43 +20,42 @@ class HotelReservation(models.Model):
|
||||
@api.multi
|
||||
def _generate_color(self):
|
||||
self.ensure_one()
|
||||
|
||||
reserv_color = '#FFFFFF'
|
||||
reserv_color_text = '#000000'
|
||||
user = self.env.user
|
||||
ICPSudo = self.env['ir.config_parameter'].sudo()
|
||||
if self.reservation_type == 'staff':
|
||||
reserv_color = user.color_staff
|
||||
reserv_color_text = user.color_letter_staff
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_staff')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_staff')
|
||||
elif self.reservation_type == 'out':
|
||||
reserv_color = user.color_dontsell
|
||||
reserv_color_text = user.color_letter_dontsell
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_dontsell')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_dontsell')
|
||||
elif self.to_assign:
|
||||
reserv_color = user.color_to_assign
|
||||
reserv_color_text = user.color_letter_to_assign
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_to_assign')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_to_assign')
|
||||
elif self.state == 'draft':
|
||||
reserv_color = user.color_pre_reservation
|
||||
reserv_color_text = user.color_letter_pre_reservation
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_pre_reservation')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_pre_reservation')
|
||||
elif self.state == 'confirm':
|
||||
if self.folio_id.pending_amount <= 0:
|
||||
reserv_color = user.color_reservation_pay
|
||||
reserv_color_text = user.color_letter_reservation_pay
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_reservation_pay')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_reservation_pay')
|
||||
else:
|
||||
reserv_color = user.color_reservation
|
||||
reserv_color_text = user.color_letter_reservation
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_reservation')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_reservation')
|
||||
elif self.state == 'booking':
|
||||
if self.folio_id.pending_amount <= 0:
|
||||
reserv_color = user.color_stay_pay
|
||||
reserv_color_text = user.color_letter_stay_pay
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_stay_pay')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_stay_pay')
|
||||
else:
|
||||
reserv_color = user.color_stay
|
||||
reserv_color_text = user.color_letter_stay
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_stay')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_stay')
|
||||
else:
|
||||
if self.folio_id.pending_amount <= 0:
|
||||
reserv_color = user.color_checkout
|
||||
reserv_color_text = user.color_letter_checkout
|
||||
reserv_color = ICPSudo.get_param('hotel_calendar.color_checkout')
|
||||
reserv_color_text = ICPSudo.get_param('hotel_calendar.color_letter_checkout')
|
||||
else:
|
||||
reserv_color = user.color_payment_pending
|
||||
reserv_color_text = user.color_letter_payment_pending
|
||||
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)
|
||||
|
||||
@api.depends('state', 'reservation_type', 'folio_id.pending_amount', 'to_assign')
|
||||
|
||||
@@ -82,28 +82,6 @@ class ResUsers(models.Model):
|
||||
'calendar.event.type',
|
||||
string="Deny Calander Event Tags")
|
||||
|
||||
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='#7C7BAD')
|
||||
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')
|
||||
|
||||
def __init__(self, pool, cr):
|
||||
""" Override of __init__ to add access rights.
|
||||
Access rights are disabled by default, but allowed on some specific
|
||||
@@ -129,26 +107,6 @@ class ResUsers(models.Model):
|
||||
'npms_default_num_days',
|
||||
'npms_allowed_events_tags',
|
||||
'npms_denied_events_tags',
|
||||
'color_pre_reservation',
|
||||
'color_reservation',
|
||||
'color_reservation_pay',
|
||||
'color_stay',
|
||||
'color_stay_pay',
|
||||
'color_checkout',
|
||||
'color_dontsell',
|
||||
'color_staff',
|
||||
'color_to_assign',
|
||||
'color_payment_pending',
|
||||
'color_letter_pre_reservation',
|
||||
'color_letter_reservation',
|
||||
'color_letter_reservation_pay',
|
||||
'color_letter_stay',
|
||||
'color_letter_stay_pay',
|
||||
'color_letter_checkout',
|
||||
'color_letter_dontsell',
|
||||
'color_letter_staff',
|
||||
'color_letter_to_assign',
|
||||
'color_letter_payment_pending',
|
||||
])
|
||||
# duplicate list to avoid modifying the original reference
|
||||
type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
|
||||
@@ -169,24 +127,4 @@ class ResUsers(models.Model):
|
||||
'npms_default_num_days',
|
||||
'npms_allowed_events_tags',
|
||||
'npms_denied_events_tags',
|
||||
'color_pre_reservation',
|
||||
'color_reservation',
|
||||
'color_reservation_pay',
|
||||
'color_stay',
|
||||
'color_stay_pay',
|
||||
'color_checkout',
|
||||
'color_dontsell',
|
||||
'color_staff',
|
||||
'color_to_assign',
|
||||
'color_payment_pending',
|
||||
'color_letter_pre_reservation',
|
||||
'color_letter_reservation',
|
||||
'color_letter_reservation_pay',
|
||||
'color_letter_stay',
|
||||
'color_letter_stay_pay',
|
||||
'color_letter_checkout',
|
||||
'color_letter_dontsell',
|
||||
'color_letter_staff',
|
||||
'color_letter_to_assign',
|
||||
'color_letter_payment_pending',
|
||||
])
|
||||
|
||||
84
hotel_calendar/models/res_config.py
Normal file
84
hotel_calendar/models/res_config.py
Normal file
@@ -0,0 +1,84 @@
|
||||
# Copyright 2017-2018 Alexandre Díaz
|
||||
# Copyright 2017 Dario Lodeiros
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from openerp import models, fields, api, _
|
||||
from openerp.exceptions import ValidationError
|
||||
|
||||
class HotelConfiguration(models.TransientModel):
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
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')
|
||||
|
||||
@api.multi
|
||||
def set_values(self):
|
||||
super(HotelConfiguration, self).set_values()
|
||||
ICPSudo = self.env['ir.config_parameter'].sudo()
|
||||
ICPSudo.set_param("hotel_calendar.color_pre_reservation", self.color_pre_reservation)
|
||||
ICPSudo.set_param("hotel_calendar.color_reservation", self.color_reservation)
|
||||
ICPSudo.set_param("hotel_calendar.color_reservation_pay", self.color_reservation_pay)
|
||||
ICPSudo.set_param("hotel_calendar.color_stay", self.color_stay)
|
||||
ICPSudo.set_param("hotel_calendar.color_stay_pay", self.color_stay_pay)
|
||||
ICPSudo.set_param("hotel_calendar.color_checkout", self.color_checkout)
|
||||
ICPSudo.set_param("hotel_calendar.color_dontsell", self.color_dontsell)
|
||||
ICPSudo.set_param("hotel_calendar.color_staff", self.color_staff)
|
||||
ICPSudo.set_param("hotel_calendar.color_to_assign", self.color_to_assign)
|
||||
ICPSudo.set_param("hotel_calendar.color_payment_pending", self.color_payment_pending)
|
||||
|
||||
ICPSudo.set_param("hotel_calendar.color_letter_pre_reservation", self.color_letter_pre_reservation)
|
||||
ICPSudo.set_param("hotel_calendar.color_letter_reservation", self.color_letter_reservation)
|
||||
ICPSudo.set_param("hotel_calendar.color_letter_reservation_pay", self.color_letter_reservation_pay)
|
||||
ICPSudo.set_param("hotel_calendar.color_letter_stay", self.color_letter_stay)
|
||||
ICPSudo.set_param("hotel_calendar.color_letter_stay_pay", self.color_letter_stay_pay)
|
||||
ICPSudo.set_param("hotel_calendar.color_letter_checkout", self.color_letter_checkout)
|
||||
ICPSudo.set_param("hotel_calendar.color_letter_dontsell", self.color_letter_dontsell)
|
||||
ICPSudo.set_param("hotel_calendar.color_letter_staff", self.color_letter_staff)
|
||||
ICPSudo.set_param("hotel_calendar.color_letter_to_assign", self.color_letter_to_assign)
|
||||
ICPSudo.set_param("hotel_calendar.color_letter_payment_pending", self.color_letter_payment_pending)
|
||||
|
||||
@api.model
|
||||
def get_values(self):
|
||||
res = super(HotelConfiguration, self).get_values()
|
||||
ICPSudo = self.env['ir.config_parameter'].sudo()
|
||||
res.update(
|
||||
color_pre_reservation=ICPSudo.get_param('hotel_calendar.color_pre_reservation', default='#A24680'),
|
||||
color_reservation=ICPSudo.get_param('hotel_calendar.color_reservation', default='#7C7BAD'),
|
||||
color_reservation_pay=ICPSudo.get_param('hotel_calendar.color_reservation_pay', default='#584D76'),
|
||||
color_stay=ICPSudo.get_param('hotel_calendar.color_stay', default='#FF4040'),
|
||||
color_stay_pay=ICPSudo.get_param('hotel_calendar.color_stay_pay', default='#82BF07'),
|
||||
color_checkout=ICPSudo.get_param('hotel_calendar.color_checkout', default='#7E7E7E'),
|
||||
color_dontsell=ICPSudo.get_param('hotel_calendar.color_dontsell', default='#000000'),
|
||||
color_staff=ICPSudo.get_param('hotel_calendar.color_staff', default='#C08686'),
|
||||
color_to_assign=ICPSudo.get_param('hotel_calendar.color_to_assign', default='#ED722E'),
|
||||
color_payment_pending=ICPSudo.get_param('hotel_calendar.color_payment_pending', default='#A24689'),
|
||||
color_letter_pre_reservation=ICPSudo.get_param('hotel_calendar.color_letter_pre_reservation', default='#FFFFFF'),
|
||||
color_letter_reservation=ICPSudo.get_param('hotel_calendar.color_letter_reservation', default='#FFFFFF'),
|
||||
color_letter_reservation_pay=ICPSudo.get_param('hotel.color_letter_reservation_pay', default='#FFFFFF'),
|
||||
color_letter_stay=ICPSudo.get_param('hotel_calendar.color_letter_stay', default='#FFFFFF'),
|
||||
color_letter_stay_pay=ICPSudo.get_param('hotel_calendar.color_letter_stay_pay', default='#FFFFFF'),
|
||||
color_letter_checkout=ICPSudo.get_param('hotel_calendar.color_letter_checkout', default='#FFFFFF'),
|
||||
color_letter_dontsell=ICPSudo.get_param('hotel_calendar.color_letter_dontsell', default='#FFFFFF'),
|
||||
color_letter_staff=ICPSudo.get_param('hotel_calendar.color_letter_staff', default='#FFFFFF'),
|
||||
color_letter_to_assign=ICPSudo.get_param('hotel_calendar.color_letter_to_assign', default='#FFFFFF'),
|
||||
color_letter_payment_pending=ICPSudo.get_param('hotel_calendar.color_letter_payment_pending', default='#FFFFFF'),
|
||||
)
|
||||
return res
|
||||
@@ -36,40 +36,6 @@
|
||||
<field name="npms_denied_events_tags" widget="many2many_tags" />
|
||||
</group>
|
||||
</group>
|
||||
<group string="Reservation States Colours" name="reservation_colors" colspan="8">
|
||||
<group>
|
||||
<group colspan="4">
|
||||
<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" />
|
||||
</group>
|
||||
<group colspan="4">
|
||||
<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>
|
||||
<group>
|
||||
<group colspan="4">
|
||||
<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" />
|
||||
</group>
|
||||
<group colspan="4">
|
||||
<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>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
63
hotel_calendar/views/res_config.xml
Normal file
63
hotel_calendar/views/res_config.xml
Normal file
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- Hotel Settings -->
|
||||
<record id="view_hotel_calendar_config_settings" model="ir.ui.view">
|
||||
<field name="name">res.config.calendar.settings.view.form.inherit.hotel</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="priority" eval="80"/>
|
||||
<field name="inherit_id" ref="hotel.view_hotel_config_settings"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//h2[@id='default_hours']" position="before">
|
||||
<h2>Calendar Colors</h2>
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="text-muted">
|
||||
Set Background Colors
|
||||
</div>
|
||||
<div class="content-group">
|
||||
<div class="mt16">
|
||||
<group>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="text-muted">
|
||||
Set Letter Colors
|
||||
</div>
|
||||
<div class="content-group">
|
||||
<div class="mt16">
|
||||
<group>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -9,6 +9,7 @@ from odoo.addons.queue_job.exception import RetryableJobError
|
||||
from odoo.addons.payment.models.payment_acquirer import _partner_split_name
|
||||
from odoo.addons.hotel_channel_connector.components.core import ChannelConnectorError
|
||||
from odoo import fields, _
|
||||
from odoo.tools.misc import DEFAULT_SERVER_DATE_FORMAT
|
||||
|
||||
# GLOBAL VARS
|
||||
DEFAULT_WUBOOK_DATE_FORMAT = "%d/%m/%Y"
|
||||
@@ -199,6 +200,18 @@ class WuBookAdapter(AbstractComponent):
|
||||
return results
|
||||
|
||||
def fetch_rooms_values(self, date_from, date_to, rooms=False):
|
||||
# WuBook Knowledge Base:
|
||||
# 1.- The returned restrictions are the Standard Restrictions (default restriction plan).
|
||||
# The prices are related to the WuBook Parity, that is, pid = 0 (unless you modify it, linking the
|
||||
# WuBook Parity to a specific pricing plan).
|
||||
# 2.- You simply can't download room information for days in the past or more than 2 years in the future.
|
||||
date_today = fields.Date.today()
|
||||
date_2_years = (fields.Date.from_string(date_today) + timedelta(days=365) * 2).strftime(
|
||||
DEFAULT_SERVER_DATE_FORMAT)
|
||||
if date_from < date_today or date_from > date_2_years:
|
||||
date_from = date_today
|
||||
if date_to < date_today or date_to > date_2_years:
|
||||
date_to = date_today
|
||||
rcode, results = self._server.fetch_rooms_values(
|
||||
self._session_info[0],
|
||||
self._session_info[1],
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
</record>
|
||||
|
||||
<record model="hotel.room.type.class">
|
||||
<field name="name">Beds Number</field>
|
||||
<field name="name">Bed</field>
|
||||
<field name="code_class">3</field>
|
||||
</record>
|
||||
|
||||
<record model="hotel.room.type.class">
|
||||
<field name="name">Beds</field>
|
||||
<field name="name">Unit</field>
|
||||
<field name="code_class">4</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -145,6 +145,13 @@ class HotelReservationImporter(Component):
|
||||
tprice += room_day_price
|
||||
rate_id = brday['rate_id']
|
||||
# TODO: Review different pricelist in the different booked rooms (folio in Odoo)
|
||||
if rate_id < 0:
|
||||
rate_id = 0
|
||||
self.create_issue(
|
||||
section='reservation',
|
||||
internal_emssage="Reservation imported with unknown \
|
||||
pricelist (established by default)",
|
||||
channel_object_id=book['reservation_code'])
|
||||
if rate_id == 0:
|
||||
default_rate_id = self.env['channel.backend'].search([
|
||||
('id', '=', self.backend_record.id)
|
||||
|
||||
@@ -541,50 +541,47 @@ class Data_Bi(models.Model):
|
||||
precio_neto -= precio_comision
|
||||
precio_iva = (precio_neto*10/100)
|
||||
precio_neto -= precio_iva
|
||||
data = json.loads(
|
||||
if reserva.reservation_id.channel_bind_ids.channel_raw_data:
|
||||
data = json.loads(
|
||||
reserva.reservation_id.channel_bind_ids.channel_raw_data)
|
||||
|
||||
jsonBooked = data['booked_rooms'][0]
|
||||
if jsonBooked.get('ancillary').get(
|
||||
'channel_rate_name') is not None:
|
||||
jsonRate = jsonBooked.get('ancillary').get(
|
||||
'channel_rate_name')
|
||||
# _logger.warning("EXPEDIA ancillary : %s - %s",
|
||||
# jsonRate, reserva.id)
|
||||
|
||||
elif jsonBooked.get('roomdays')[0].get(
|
||||
'ancillary').get(
|
||||
jsonBooked = data['booked_rooms'][0]
|
||||
if jsonBooked.get('ancillary').get(
|
||||
'channel_rate_name') is not None:
|
||||
jsonRate = jsonBooked.get(
|
||||
'roomdays')[0].get(
|
||||
'ancillary').get('channel_rate_name')
|
||||
# _logger.warning("EXPEDIA roomdays : %s - %s",
|
||||
# jsonRate, reserva.id)
|
||||
jsonRate = jsonBooked.get('ancillary').get(
|
||||
'channel_rate_name')
|
||||
# _logger.warning("EXPEDIA ancillary : %s - %s",
|
||||
# jsonRate, reserva.id)
|
||||
|
||||
else:
|
||||
_logger.critical(
|
||||
"EXPEDIA Tarifa No Contemplada : "
|
||||
+ jsonBooked)
|
||||
elif jsonBooked.get('roomdays')[0].get(
|
||||
'ancillary').get(
|
||||
'channel_rate_name') is not None:
|
||||
jsonRate = jsonBooked.get(
|
||||
'roomdays')[0].get(
|
||||
'ancillary').get('channel_rate_name')
|
||||
# _logger.warning("EXPEDIA roomdays : %s - %s",
|
||||
# jsonRate, reserva.id)
|
||||
|
||||
jsonRefundable = jsonRate.upper().find('REFUNDABLE')
|
||||
# _logger.warning("EXPEDIA Tarifa : %s", jsonRate)
|
||||
# _logger.warning("EXPEDIA Tarifa : %s y %s",
|
||||
# jsonRate, str(jsonRefundable))
|
||||
else:
|
||||
_logger.critical(
|
||||
"EXPEDIA Tarifa No Contemplada : "
|
||||
+ jsonBooked)
|
||||
|
||||
# 10 % Iva
|
||||
precio_iva = round((precio_neto-(precio_neto/1.1)), 2)
|
||||
# 18 % comision ?
|
||||
precio_comision = inv_percent(
|
||||
jsonRefundable = jsonRate.upper().find('REFUNDABLE')
|
||||
# _logger.warning("EXPEDIA Tarifa : %s", jsonRate)
|
||||
# _logger.warning("EXPEDIA Tarifa : %s y %s",
|
||||
# jsonRate, str(jsonRefundable))
|
||||
|
||||
# 10 % Iva
|
||||
precio_iva = round((precio_neto-(precio_neto/1.1)), 2)
|
||||
# 18 % comision ?
|
||||
precio_comision = inv_percent(
|
||||
precio_neto, self.env.user.company_id.expedia_rate)
|
||||
precio_neto += precio_comision
|
||||
# 3% Refundable ?
|
||||
if jsonRefundable >= 0:
|
||||
precio_dto = inv_percent(precio_neto, 3)
|
||||
precio_neto += precio_dto
|
||||
# _logger.warning("ODOO: %s , precio_neto: %s , precio_comision: \
|
||||
# %s , precio_iva: %s , precio_dto: %s", reserva.price,
|
||||
# precio_neto, precio_comision, precio_iva,
|
||||
# precio_dto)
|
||||
precio_neto += precio_comision
|
||||
# 3% Refundable ?
|
||||
if jsonRefundable >= 0:
|
||||
precio_dto = inv_percent(precio_neto, 3)
|
||||
precio_neto += precio_dto
|
||||
|
||||
response_dic.append({'ota': reserva.reservation_id.ota_id.id,
|
||||
'ota_id': reserva.reservation_id.ota_id.ota_id,
|
||||
|
||||
@@ -43,10 +43,10 @@ class PoliceWizard(models.TransientModel):
|
||||
def generate_file(self):
|
||||
company = self.env.user.company_id
|
||||
if company.police_number is not False and company.property_name is not False:
|
||||
lines = self.env['hotel.checkin.partner'].search(
|
||||
[('enter_date',
|
||||
'=',
|
||||
self.download_date)])
|
||||
lines = self.env['hotel.checkin.partner'].search([
|
||||
('enter_date', '=', self.download_date),
|
||||
('state', 'in', ('booking', 'done')),
|
||||
])
|
||||
content = "1|"+company.police_number+"|"+company.property_name.upper()[0:40]
|
||||
content += "|"
|
||||
content += datetime.datetime.now().strftime("%Y%m%d|%H%M")
|
||||
|
||||
Reference in New Issue
Block a user