Merge branch '11.0' of https://github.com/hootel/hootel into 11.0

This commit is contained in:
Pablo
2019-05-15 17:40:41 +02:00
4 changed files with 77 additions and 11 deletions

View File

@@ -12,7 +12,7 @@
Create a user and give the 'Hotel Management/Export data BI' permission.
""",
'summary': "Export hotel data for business intelligence",
'version': '2.0',
'version': '2.1',
'license': 'AGPL-3',
'author': "Jose Luis Algara (Alda hotels) <osotranquilo@gmail.com>",
'website': 'www.aldahotels.com',

View File

@@ -176,6 +176,9 @@ class Data_Bi(models.Model):
_logger.info("DataBi: Calculating all countries")
dic_pais = []
# Diccionario con los nombre de los Paises usando los del INE
dic_pais.append({'ID_Hotel': compan,
'ID_Pais': 'NONE',
'Descripcion': 'No Asignado'})
paises = self.env['code.ine'].search_read([], ['code', 'name'])
for pais in paises:
dic_pais.append({'ID_Hotel': compan,
@@ -338,6 +341,9 @@ class Data_Bi(models.Model):
dic_clientes.append({'ID_Hotel': compan,
'ID_Cliente': 908,
'Descripcion': u'Touroperador'})
dic_clientes.append({'ID_Hotel': compan,
'ID_Cliente': 909,
'Descripcion': u'Virtual Door'})
return dic_clientes
@api.model
@@ -397,22 +403,18 @@ class Data_Bi(models.Model):
precio_iva = ota_prices[0]['precio_iva']
precio_comision = ota_prices[0]['precio_comision']
# if linea.reservation_id.id == 6742:
# # # Debug Stop -------------------
# import wdb; wdb.set_trace()
# # # Debug Stop -------------------
if linea.reservation_id.discount != 0:
precio_dto = linea.price * (
linea.reservation_id.discount/100)
dic_reservas.append({
'ID_Reserva': linea.reservation_id.folio_id.name,
'ID_Reserva': linea.reservation_id.folio_id.id,
'ID_Hotel': compan,
'ID_EstadoReserva': estado_array.index(
linea.reservation_id.state),
'FechaVenta': linea.reservation_id.create_date[0:10],
'ID_Segmento': id_segmen,
# 'ID_Cliente': channel_c,
'ID_Cliente': self.data_bi_channel_cli(linea, dic_clientes),
'ID_Canal': channels[linea.reservation_id.channel_type],
'FechaExtraccion': date.today().strftime('%Y-%m-%d'),
'Entrada': linea.date,
@@ -431,7 +433,7 @@ class Data_Bi(models.Model):
'PrecioIva': precio_iva,
'PrecioDto': precio_dto,
'ID_Tarifa': linea.reservation_id.pricelist_id.id,
# 'ID_Pais': id_codeine
'ID_Pais': self.data_bi_get_codeine(linea)
})
# ID_Reserva numérico Código único de la reserva
# ID_Hotel numérico Código del Hotel
@@ -454,6 +456,57 @@ class Data_Bi(models.Model):
# ID_Pais numérico Código del país
return dic_reservas
@api.model
def data_bi_channel_cli(self, reserva, dic_clientes):
response = 0
if reserva.reservation_id.channel_type == "door":
response = 903
elif reserva.reservation_id.channel_type == "mail":
response = 904
elif reserva.reservation_id.channel_type == "phone":
response = 905
elif reserva.reservation_id.channel_type == "call":
response = 906
elif reserva.reservation_id.channel_type == "virtualdoor":
response = 909
elif reserva.reservation_id.channel_type == "web":
if reserva.reservation_id.ota_id.id:
# OTA
response = reserva.reservation_id.ota_id.id
else:
# Web Propia
response = 999
elif reserva.reservation_id.channel_type == "agency":
tour = reserva.reservation_id.tour_operator_id
if tour.name:
mach = next((
l for l in dic_clientes if l['Descripcion'] == tour.name),
False)
response = mach['ID_Cliente']
else:
response = 907
elif reserva.reservation_id.channel_type == "operator":
tour = reserva.reservation_id.tour_operator_id
if tour.name:
mach = next((
l for l in dic_clientes if l['Descripcion'] == tour.name),
False)
response = mach['ID_Cliente']
# _logger.info("%s Por Agencia: %s :", mach['Descripcion'], str(response))
else:
response = 908
# _logger.info("%s Por Agencia: %s :",reserva.reservation_id.folio_id.name, str(response))
return response
@api.model
def data_bi_comisiones_ota(self, reserva):
response_dic = []
@@ -543,6 +596,17 @@ class Data_Bi(models.Model):
})
return response_dic
# # Debug Stop -------------------
@api.model
def data_bi_get_codeine(self, reserva):
response = 'NONE'
code = reserva.reservation_id.partner_id.code_ine_id
if code:
response = code.code
else:
for l in reserva.reservation_id.folio_id.checkin_partner_ids:
if l.code_ine_id:
response = l.code_ine_id.code
return response
# Debug Stop -------------------
# import wdb; wdb.set_trace()
# # Debug Stop -------------------
# Debug Stop -------------------

View File

@@ -6,9 +6,11 @@ access_room_type,hoteldatabi.hotel_room_type,hotel.model_hotel_room_type,hotel_d
access_hotel_reservation_line,hoteldatabi.hotel_reservation_line,hotel.model_hotel_reservation_line,hotel_data_bi.group_hotel_export_data,1,0,0,0
access_hotel_reservation,hoteldatabi.hotel_reservation,hotel.model_hotel_reservation,hotel_data_bi.group_hotel_export_data,1,0,0,0
access_hotel_board_service,hoteldatabi.hotel_board_service,hotel.model_hotel_board_service,hotel_data_bi.group_hotel_export_data,1,0,0,0
access_hotel_board_service_line,hoteldatabi.hotel_board_service_line,hotel.model_hotel_board_service_line,hotel_data_bi.group_hotel_export_data,1,0,0,0
access_code_ine,hoteldatabi.code_ine,hotel_l10n_es.model_code_ine,hotel_data_bi.group_hotel_export_data,1,0,0,0
access_budget ,hoteldatabi.budget,hotel_data_bi.model_budget,hotel_data_bi.group_hotel_export_data,1,0,0,0
access_channel_ota_info,hoteldatabi.channel_ota_info,hotel_channel_connector.model_channel_ota_info,hotel_data_bi.group_hotel_export_data,1,0,0,0
access_hotel_folio,hoteldatabi.hotel_folio,hotel.model_hotel_folio,hotel_data_bi.group_hotel_export_data,1,0,0,0
access_hotel_room,hoteldatabi.hotel_room,hotel.model_hotel_room,hotel_data_bi.group_hotel_export_data,1,0,0,0
access_channel_hotel_reservation,hoteldatabi.channel_hotel_reservation,hotel_channel_connector.model_channel_hotel_reservation,hotel_data_bi.group_hotel_export_data,1,0,0,0
access_hotel_checkin_partner,hoteldatabi.hotel_checkin_partner,hotel.model_hotel_checkin_partner,hotel_data_bi.group_hotel_export_data,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
6 access_hotel_reservation_line hoteldatabi.hotel_reservation_line hotel.model_hotel_reservation_line hotel_data_bi.group_hotel_export_data 1 0 0 0
7 access_hotel_reservation hoteldatabi.hotel_reservation hotel.model_hotel_reservation hotel_data_bi.group_hotel_export_data 1 0 0 0
8 access_hotel_board_service hoteldatabi.hotel_board_service hotel.model_hotel_board_service hotel_data_bi.group_hotel_export_data 1 0 0 0
9 access_hotel_board_service_line hoteldatabi.hotel_board_service_line hotel.model_hotel_board_service_line hotel_data_bi.group_hotel_export_data 1 0 0 0
10 access_code_ine hoteldatabi.code_ine hotel_l10n_es.model_code_ine hotel_data_bi.group_hotel_export_data 1 0 0 0
11 access_budget hoteldatabi.budget hotel_data_bi.model_budget hotel_data_bi.group_hotel_export_data 1 0 0 0
12 access_channel_ota_info hoteldatabi.channel_ota_info hotel_channel_connector.model_channel_ota_info hotel_data_bi.group_hotel_export_data 1 0 0 0
13 access_hotel_folio hoteldatabi.hotel_folio hotel.model_hotel_folio hotel_data_bi.group_hotel_export_data 1 0 0 0
14 access_hotel_room hoteldatabi.hotel_room hotel.model_hotel_room hotel_data_bi.group_hotel_export_data 1 0 0 0
15 access_channel_hotel_reservation hoteldatabi.channel_hotel_reservation hotel_channel_connector.model_channel_hotel_reservation hotel_data_bi.group_hotel_export_data 1 0 0 0
16 access_hotel_checkin_partner hoteldatabi.hotel_checkin_partner hotel.model_hotel_checkin_partner hotel_data_bi.group_hotel_export_data 1 0 0 0

View File

@@ -31,7 +31,7 @@ class KellysWizard(models.TransientModel):
def _get_default_habitaciones(self):
return self.calculalimpiar(datetime.now())
date_start = fields.Date("Fecha del listado", default=datetime.now())
date_start = fields.Date("Fecha del listado", default=date.today())
habitaciones = fields.Many2many('kellysrooms', string="Limpieza:",
default=_get_default_habitaciones)
order = fields.Selection([