diff --git a/hotel/wizard/folio_make_invoice_advance.py b/hotel/wizard/folio_make_invoice_advance.py
index 132150c36..5ffd8979c 100644
--- a/hotel/wizard/folio_make_invoice_advance.py
+++ b/hotel/wizard/folio_make_invoice_advance.py
@@ -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)
diff --git a/hotel_calendar/__manifest__.py b/hotel_calendar/__manifest__.py
index cac0ce4b5..5546e1abc 100644
--- a/hotel_calendar/__manifest__.py
+++ b/hotel_calendar/__manifest__.py
@@ -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': [
diff --git a/hotel_calendar/data/ir_config_parameter.xml b/hotel_calendar/data/ir_config_parameter.xml
new file mode 100644
index 000000000..60c13e2c4
--- /dev/null
+++ b/hotel_calendar/data/ir_config_parameter.xml
@@ -0,0 +1,86 @@
+
+
+
+
+ hotel_calendar.color_pre_reservation
+ #A24680
+
+
+ hotel_calendar.color_reservation
+ #7C7BAD
+
+
+ hotel_calendar.color_reservation_pay
+ #584D76
+
+
+ hotel_calendar.color_stay
+ #FF4040
+
+
+ hotel_calendar.color_stay_pay
+ #82BF07
+
+
+ hotel_calendar.color_checkout
+ #7E7E7E
+
+
+ hotel_calendar.color_dontsell
+ #000000
+
+
+ hotel_calendar.color_staff
+ #C08686
+
+
+ hotel_calendar.color_to_assign
+ #ED722E
+
+
+ hotel_calendar.color_payment_pending
+ #A24689
+
+
+
+ hotel_calendar.color_letter_pre_reservation
+ #FFFFFF
+
+
+ hotel_calendar.color_letter_reservation
+ #FFFFFF
+
+
+ hotel_calendar.color_letter_reservation_pay
+ #FFFFFF
+
+
+ hotel_calendar.color_letter_stay
+ #FFFFFF
+
+
+ hotel_calendar.color_letter_stay_pay
+ #FFFFFF
+
+
+ hotel_calendar.color_letter_checkout
+ #FFFFFF
+
+
+ hotel_calendar.color_letter_dontsell
+ #FFFFFF
+
+
+ hotel_calendar.color_letter_staff
+ #FFFFFF
+
+
+ hotel_calendar.color_letter_to_assign
+ #FFFFFF
+
+
+ hotel_calendar.color_letter_payment_pending
+ #FFFFFF
+
+
+
diff --git a/hotel_calendar/models/__init__.py b/hotel_calendar/models/__init__.py
index cb156d75a..b84ca2d85 100644
--- a/hotel_calendar/models/__init__.py
+++ b/hotel_calendar/models/__init__.py
@@ -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
diff --git a/hotel_calendar/models/inherited_hotel_reservation.py b/hotel_calendar/models/inherited_hotel_reservation.py
index 6156e479a..262a6f6c2 100644
--- a/hotel_calendar/models/inherited_hotel_reservation.py
+++ b/hotel_calendar/models/inherited_hotel_reservation.py
@@ -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')
diff --git a/hotel_calendar/models/inherited_res_users.py b/hotel_calendar/models/inherited_res_users.py
index a6413861b..027189f53 100644
--- a/hotel_calendar/models/inherited_res_users.py
+++ b/hotel_calendar/models/inherited_res_users.py
@@ -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',
])
diff --git a/hotel_calendar/models/res_config.py b/hotel_calendar/models/res_config.py
new file mode 100644
index 000000000..f99e99655
--- /dev/null
+++ b/hotel_calendar/models/res_config.py
@@ -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
diff --git a/hotel_calendar/views/inherited_res_users_views.xml b/hotel_calendar/views/inherited_res_users_views.xml
index c62e4042c..074265932 100644
--- a/hotel_calendar/views/inherited_res_users_views.xml
+++ b/hotel_calendar/views/inherited_res_users_views.xml
@@ -36,40 +36,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/hotel_calendar/views/res_config.xml b/hotel_calendar/views/res_config.xml
new file mode 100644
index 000000000..ef6b5862d
--- /dev/null
+++ b/hotel_calendar/views/res_config.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+ res.config.calendar.settings.view.form.inherit.hotel
+ res.config.settings
+
+
+
+
+ Calendar Colors
+
+
+
+
+ Set Background Colors
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Set Letter Colors
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hotel_channel_connector_wubook/components/backend_adapter.py b/hotel_channel_connector_wubook/components/backend_adapter.py
index 5b5760fe3..c992def9c 100644
--- a/hotel_channel_connector_wubook/components/backend_adapter.py
+++ b/hotel_channel_connector_wubook/components/backend_adapter.py
@@ -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],
diff --git a/hotel_channel_connector_wubook/data/records.xml b/hotel_channel_connector_wubook/data/records.xml
index 4e67dba44..8266acc14 100644
--- a/hotel_channel_connector_wubook/data/records.xml
+++ b/hotel_channel_connector_wubook/data/records.xml
@@ -12,12 +12,12 @@
- Beds Number
+ Bed
3
- Beds
+ Unit
4
diff --git a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py
index 178b41d2d..6bc1975a2 100644
--- a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py
+++ b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py
@@ -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)
diff --git a/hotel_data_bi/models/data_bi.py b/hotel_data_bi/models/data_bi.py
index a6782dd88..308d34f24 100644
--- a/hotel_data_bi/models/data_bi.py
+++ b/hotel_data_bi/models/data_bi.py
@@ -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,
diff --git a/hotel_l10n_es/wizard/police_wizard.py b/hotel_l10n_es/wizard/police_wizard.py
index d8e85b638..3927215ab 100755
--- a/hotel_l10n_es/wizard/police_wizard.py
+++ b/hotel_l10n_es/wizard/police_wizard.py
@@ -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")