Update transaltion, fix SIAT url

This commit is contained in:
oscar alvarez 2023-10-22 20:55:59 -05:00
parent cc93584ab5
commit 8af7575f29
10 changed files with 376 additions and 84 deletions

3
.gitignore vendored
View File

@ -5,7 +5,6 @@
/dist
*egg-info
/node_modules
# testing
@ -27,3 +26,5 @@ package-lock*
/__pycache__
/app/__pycache__
/app/commons/__pycache__
test_siat.py

View File

@ -448,16 +448,15 @@ class Folio(ModelSQL, ModelView):
company = self.booking.company
try:
res = send_siat(company, self.main_guest, self, config.token_siat)
print("Respuesta SIAT ...", res)
if res:
now = datetime.now()
for guest in self.guests:
if not guest.siat_send_date:
guest.siat_send_date = now()
guest.siat_send_date = now
guest.siat_id = res['code']
guest.save()
except Exception as error:
print("Error en plataforma SIAT...!", error)
# raise UserError(gettext('Error en plataforma SIAT...!'))
@classmethod
@ModelView.button
@ -1306,6 +1305,7 @@ class FolioGuest(ModelSQL, ModelView):
tags = fields.Many2Many('hotel.tag.guest', 'guest', 'tag', 'Tags')
siat_send_date = fields.DateTime('Siat Send Date',
states={'readonly': True})
siat_id = fields.Char('SIAT Id.', states={'readonly': True})
@classmethod
def search_rec_name(cls, name, clause):

View File

@ -38,6 +38,18 @@ msgctxt "field:company.company,rnt_code:"
msgid "Registro Nacional de Turismo"
msgstr "Registro Nacional de Turismo"
msgctxt "field:dash.app.booking,company:"
msgid "Company"
msgstr "Empresa"
msgctxt "field:dash.app.booking,icon:"
msgid "Icon"
msgstr "Icono"
msgctxt "field:dash.app.booking,kind:"
msgid "Kind"
msgstr "Clase"
msgctxt "field:dash.app.hotel_planner,company:"
msgid "Company"
msgstr "Empresa"
@ -106,6 +118,10 @@ msgctxt "field:hotel.booking,adult_num:"
msgid "Adult Number"
msgstr "Número de Adultos"
msgctxt "field:hotel.booking,agent:"
msgid "Agent"
msgstr "Agente"
msgctxt "field:hotel.booking,booker:"
msgid "Booker"
msgstr "Reservador"
@ -140,7 +156,7 @@ msgstr "Factura del Canal"
msgctxt "field:hotel.booking,channel_payment_method:"
msgid "Channel Payment Method"
msgstr ""
msgstr "Metodo de Pago de Canal"
msgctxt "field:hotel.booking,children_num:"
msgid "Children Number"
@ -222,6 +238,10 @@ msgctxt "field:hotel.booking,invoices:"
msgid "Invoices"
msgstr "Facturas"
msgctxt "field:hotel.booking,lead_origin:"
msgid "Lead Origin"
msgstr "Origen Iniciativa"
msgctxt "field:hotel.booking,lines:"
msgid "Folios"
msgstr "Líneas"
@ -274,6 +294,10 @@ msgctxt "field:hotel.booking,price_list:"
msgid "Price List"
msgstr "Lista de precios"
msgctxt "field:hotel.booking,rate_plan:"
msgid "Rate Plan"
msgstr "Plan Tarifario"
msgctxt "field:hotel.booking,reason:"
msgid "Tourism Segment"
msgstr "Segmento"
@ -396,7 +420,7 @@ msgstr ""
msgctxt "field:hotel.booking.update_taxes.start,taxes_to_remove:"
msgid "Taxes to Remove"
msgstr ""
msgstr "Remover Impuestos"
msgctxt "field:hotel.channel,agent:"
msgid "Agent"
@ -522,6 +546,10 @@ msgctxt "field:hotel.configuration,booking_sequence:"
msgid "Hotel Booking Sequence"
msgstr "Secuencia de Reservas"
msgctxt "field:hotel.configuration,charge_sequence:"
msgid "Charges Sequence"
msgstr "Secuencia de Cargos"
msgctxt "field:hotel.configuration,check_in_email:"
msgid "Check-In Email"
msgstr ""
@ -618,6 +646,10 @@ msgctxt "field:hotel.configuration,taxes_exception_rule:"
msgid "Taxes Exception Rule"
msgstr "Regla de Excepción de Impuestos"
msgctxt "field:hotel.configuration,token_siat:"
msgid "Token Siat"
msgstr "Token SIAT"
msgctxt "field:hotel.configuration-product.product,configuration:"
msgid "Configuration"
msgstr "Configuración"
@ -682,6 +714,10 @@ msgctxt "field:hotel.folio,estimated_arrival_time:"
msgid "Estimated Arrival Time"
msgstr "Hora de Llegada Estimada"
msgctxt "field:hotel.folio,group:"
msgid "Group"
msgstr "Grupo"
msgctxt "field:hotel.folio,guests:"
msgid "Guests"
msgstr "Huespedes"
@ -802,6 +838,10 @@ msgctxt "field:hotel.folio,storage:"
msgid "Storage"
msgstr "Almacen"
msgctxt "field:hotel.folio,taxes_exception:"
msgid "Taxes Exception"
msgstr "Excepción de IVA"
msgctxt "field:hotel.folio,to_invoice:"
msgid "To Invoice"
msgstr "A facturar"
@ -894,6 +934,10 @@ msgctxt "field:hotel.folio.charge,move:"
msgid "Move"
msgstr "Movimiento de Inventario"
msgctxt "field:hotel.folio.charge,number:"
msgid "Number"
msgstr "Número"
msgctxt "field:hotel.folio.charge,order:"
msgid "Order"
msgstr "Orden"
@ -1014,6 +1058,14 @@ msgctxt "field:hotel.folio.guest,sex:"
msgid "Sex"
msgstr "Sexo"
msgctxt "field:hotel.folio.guest,siat_id:"
msgid "SIAT Id."
msgstr ""
msgctxt "field:hotel.folio.guest,siat_send_date:"
msgid "Siat Send Date"
msgstr "Fecha Envio SIAT"
msgctxt "field:hotel.folio.guest,subdivision:"
msgid "Subdivision"
msgstr "Subdivisión"
@ -1102,6 +1154,14 @@ msgctxt "field:hotel.folio_update_occupancy.start,unit_price:"
msgid "Unit Price"
msgstr "Precio Unitario"
msgctxt "field:hotel.housekeeping.schedule.start,employee:"
msgid "Employee"
msgstr "Empleado"
msgctxt "field:hotel.housekeeping.schedule.start,rooms:"
msgid "Rooms"
msgstr "Habitaciones"
msgctxt "field:hotel.invoice_income_daily.start,company:"
msgid "Company"
msgstr "Empresa"
@ -1346,6 +1406,23 @@ msgctxt "field:hotel.print_rooms_occupancy.start,date:"
msgid "Date"
msgstr "Fecha"
msgctxt "field:hotel.rate_plan,end_date:"
msgid "End Date"
msgstr "Fecha Final"
#, fuzzy
msgctxt "field:hotel.rate_plan,price_list:"
msgid "Price List"
msgstr "Tarifa"
msgctxt "field:hotel.rate_plan,start_date:"
msgid "Start Date"
msgstr "Inicio"
msgctxt "field:hotel.rate_plan,state:"
msgid "State"
msgstr "Estado"
msgctxt "field:hotel.revenue_segmentation.start,company:"
msgid "Company"
msgstr "Empresa"
@ -1374,10 +1451,22 @@ msgctxt "field:hotel.room,amenities:"
msgid "Amenities"
msgstr "Comodidades"
msgctxt "field:hotel.room,arrival_today:"
msgid "Arrival Today"
msgstr "Llegadas Hoy"
msgctxt "field:hotel.room,channel_id:"
msgid "Channel Manager ID"
msgstr "ID Canal"
msgctxt "field:hotel.room,check_in_today:"
msgid "Check In Today"
msgstr "Check In Hoy"
msgctxt "field:hotel.room,check_out_today:"
msgid "Check Out Today"
msgstr "Check Out Hoy"
msgctxt "field:hotel.room,classification:"
msgid "Classification"
msgstr "Clasificación"
@ -1394,6 +1483,10 @@ msgctxt "field:hotel.room,current_guests:"
msgid "Guests"
msgstr "Huespedes"
msgctxt "field:hotel.room,departure_today:"
msgid "Departure Today"
msgstr "Salidas Hoy"
msgctxt "field:hotel.room,guests:"
msgid "Guests"
msgstr "Huespedes"
@ -1442,6 +1535,10 @@ msgctxt "field:hotel.room,notes:"
msgid "Notes"
msgstr "Observaciones"
msgctxt "field:hotel.room,occupied_today:"
msgid "Occupied Today"
msgstr "Ocupadas Hoy"
msgctxt "field:hotel.room,space:"
msgid "Space"
msgstr "Espacio"
@ -1586,6 +1683,18 @@ msgctxt "field:hotel.service.line,time_service:"
msgid "Time Service"
msgstr "Hora"
msgctxt "field:hotel.siat_sync.start,company:"
msgid "Company"
msgstr "Empresa"
msgctxt "field:hotel.siat_sync.start,end_date:"
msgid "End Date"
msgstr "Fecha Final"
msgctxt "field:hotel.siat_sync.start,start_date:"
msgid "Start Date"
msgstr "Inicio"
msgctxt "field:hotel.statistics_by_month.start,company:"
msgid "Company"
msgstr "Empresa"
@ -1738,10 +1847,18 @@ msgctxt "field:hotel.update_holder.start,visa_number:"
msgid "Visa Number"
msgstr "Número de Visa"
msgctxt "field:party.party,address:"
msgid "Address"
msgstr "Dirección"
msgctxt "field:party.party,city:"
msgid "City"
msgstr "Ciudad"
msgctxt "field:party.party,country:"
msgid "Country"
msgstr "País"
msgctxt "field:party.party,currency:"
msgid "Currency"
msgstr "Moneda"
@ -1876,6 +1993,10 @@ msgctxt "model:analytic_account.space,name:"
msgid "Analytic Account Space"
msgstr "Espacio"
msgctxt "model:dash.app.booking,name:"
msgid "App Booking"
msgstr ""
msgctxt "model:dash.app.hotel_planner,name:"
msgid "App Hotel Planner"
msgstr "Planeador"
@ -1918,7 +2039,7 @@ msgstr "Seleccionar Habitaciones"
msgctxt "model:hotel.booking.update_taxes.start,name:"
msgid "Update Taxes Start"
msgstr ""
msgstr "Actualizar Impuestos"
msgctxt "model:hotel.channel,name:"
msgid "Sale Channel"
@ -1984,6 +2105,10 @@ msgctxt "model:hotel.folio_update_occupancy.start,name:"
msgid "Update Occupancy"
msgstr "Actualizar Ocupación"
msgctxt "model:hotel.housekeeping.schedule.start,name:"
msgid "Housekeeping Schedule Start"
msgstr "Programación de Amas de Llaves"
msgctxt "model:hotel.invoice_income_daily.start,name:"
msgid "Invoice Income Daily Start"
msgstr "Relacion Diaria de Caja"
@ -2052,9 +2177,17 @@ msgctxt "model:hotel.print_rooms_occupancy.start,name:"
msgid "Rooms Occupancy Start"
msgstr "Ocupación de Habitaciones"
msgctxt "model:hotel.rate_plan,name:"
msgid "Hotel Rate Plan"
msgstr "Plan Tarifario"
msgctxt "model:hotel.rate_plan.rule,name:"
msgid "Hotel Rate Plan"
msgstr "Plan Tarifario Hotelero"
msgctxt "model:hotel.revenue_segmentation.start,name:"
msgid "Revenue Segmentation Start"
msgstr ""
msgstr "Segementación Revenue"
msgctxt "model:hotel.room,name:"
msgid "Hotel Room"
@ -2088,6 +2221,10 @@ msgctxt "model:hotel.service.line,name:"
msgid "Service Line"
msgstr "Línea de Servicio"
msgctxt "model:hotel.siat_sync.start,name:"
msgid "Siat Sync Start"
msgstr "Sincronización SIAT"
msgctxt "model:hotel.statistics_by_month.start,name:"
msgid "Statistics By Month Start"
msgstr "Reservas por Día"
@ -2110,7 +2247,7 @@ msgstr "Titular de la Reserva"
msgctxt "model:ir.action,name:"
msgid "Room Category"
msgstr "Acomodación"
msgstr "Categoría de Habitación"
msgctxt "model:ir.action,name:act_amenities_form"
msgid "Amenities"
@ -2153,17 +2290,29 @@ msgid "Maintenance"
msgstr "Mantenimiento"
msgctxt "model:ir.action,name:act_hotel_night_audit_form"
msgid "night_audit"
msgid "Auditoria Nocturna"
msgstr "Auditoria Nocturna"
msgctxt "model:ir.action,name:act_hotel_night_audit_wizard"
msgid "Night Audit"
msgstr "Auditoria Nocturna"
msgctxt "model:ir.action,name:act_hotel_rate_plan_form"
msgid "Rate Plan"
msgstr "Plan Tarifario"
msgctxt "model:ir.action,name:act_hotel_siat_sync_wizard"
msgid "Siat Sync"
msgstr "Sincronización SIAT"
msgctxt "model:ir.action,name:act_hotel_tag_view"
msgid "Tag"
msgstr ""
msgctxt "model:ir.action,name:act_housekeeping_schedule_wizard"
msgid "Housekeeping Schedule"
msgstr "Programación de Amas de Llaves"
msgctxt "model:ir.action,name:act_location_tree"
msgid "Locations"
msgstr "Ubicaciones"
@ -2266,7 +2415,7 @@ msgstr ""
msgctxt "model:ir.action,name:report_revenue_segmentation"
msgid "Revenue Segmentation Report"
msgstr ""
msgstr "Reporte de Segementación de Revenue"
msgctxt "model:ir.action,name:report_rooms_occupancy"
msgid "Rooms Occupancy Report"
@ -2322,7 +2471,7 @@ msgstr "Ocupación de Habitaciones"
msgctxt "model:ir.action,name:wizard_revenue_segmentation"
msgid "Revenue Segmentation"
msgstr ""
msgstr "Segmentación Revenue"
msgctxt "model:ir.action,name:wizard_select_rooms"
msgid "Select Rooms"
@ -2507,7 +2656,7 @@ msgid "It missing guest in booking \"%(number)s\"!"
msgstr "Falta el huesped en la reserva \"%(number)s\"!"
msgctxt "model:ir.message,text:msg_missing_main_guest"
msgid "Missing main guest in lines!"
msgid "Falta el huesped principal en las líneas!"
msgstr "Falta el huesped principal en las líneas!"
msgctxt "model:ir.message,text:msg_missing_party_email"
@ -2578,6 +2727,10 @@ msgctxt "model:ir.message,text:msg_services_not_confirmed"
msgid "Services with the same kind but it isn't confirmed!"
msgstr ""
msgctxt "model:ir.message,text:msg_the_accommodation_not_charged"
msgid "The accommodation is not charged!"
msgstr "La acomodación no esta cargada en el folio!"
msgctxt "model:ir.model.button,confirm:booking_bill_button"
msgid "Are you sure you want to bill the booking?"
msgstr "Esta seguro que desea facturar la reserva?"
@ -2658,6 +2811,10 @@ msgctxt "model:ir.ui.menu,name:menu_hotel_frontdesk_folio"
msgid "Board Folios"
msgstr "Folios"
msgctxt "model:ir.ui.menu,name:menu_hotel_housekeeping_schedule"
msgid "Housekeeping Schedule"
msgstr "Programación de Amas de Llaves"
msgctxt "model:ir.ui.menu,name:menu_hotel_maintenance"
msgid "Maintenance"
msgstr "Mantenimiento"
@ -2678,6 +2835,10 @@ msgctxt "model:ir.ui.menu,name:menu_hotel_night_audit"
msgid "Night Audit"
msgstr "Auditoria Nocturna"
msgctxt "model:ir.ui.menu,name:menu_hotel_rate_plan"
msgid "Rate Plan"
msgstr "Plan Tarifario"
msgctxt "model:ir.ui.menu,name:menu_hotel_room"
msgid "Room"
msgstr "Habitación"
@ -2698,6 +2859,10 @@ msgctxt "model:ir.ui.menu,name:menu_hotel_service_kind"
msgid "Service Kind"
msgstr "Clase de Servicio"
msgctxt "model:ir.ui.menu,name:menu_hotel_siat_sync"
msgid "Siat Sync"
msgstr "Sincronizar SIAT"
msgctxt "model:ir.ui.menu,name:menu_hotel_tag"
msgid "Tag"
msgstr ""
@ -2744,7 +2909,7 @@ msgstr ""
msgctxt "model:ir.ui.menu,name:menu_revenue_segmentation"
msgid "Revenue Segmentation"
msgstr ""
msgstr "Segmentación de Revenue"
msgctxt "model:ir.ui.menu,name:menu_rooms_occupancy"
msgid "Rooms Occupancy"
@ -3260,6 +3425,10 @@ msgctxt "report:hotel.booking_statement:"
msgid "ATE"
msgstr ""
msgctxt "report:hotel.booking_statement:"
msgid "BASE"
msgstr ""
#, fuzzy
msgctxt "report:hotel.booking_statement:"
msgid "C"
@ -3291,6 +3460,10 @@ msgctxt "report:hotel.booking_statement:"
msgid "D"
msgstr "D"
msgctxt "report:hotel.booking_statement:"
msgid "D AMOUNT"
msgstr ""
#, fuzzy
msgctxt "report:hotel.booking_statement:"
msgid "DATE"
@ -3421,6 +3594,10 @@ msgctxt "report:hotel.booking_statement:"
msgid "T"
msgstr ""
msgctxt "report:hotel.booking_statement:"
msgid "TAXE"
msgstr ""
msgctxt "report:hotel.booking_statement:"
msgid "TAXES /"
msgstr ""
@ -3433,6 +3610,10 @@ msgctxt "report:hotel.booking_statement:"
msgid "TOTAL AMOUNT /"
msgstr ""
msgctxt "report:hotel.booking_statement:"
msgid "UN"
msgstr ""
msgctxt "report:hotel.booking_statement:"
msgid "UNIT PRICE"
msgstr ""
@ -7396,6 +7577,62 @@ msgctxt "report:hotel.service:"
msgid "€"
msgstr ""
msgctxt "selection:dash.app.booking,icon:"
msgid "cart"
msgstr ""
msgctxt "selection:dash.app.booking,icon:"
msgid "clipboard check"
msgstr ""
msgctxt "selection:dash.app.booking,icon:"
msgid "coffee"
msgstr "Café"
msgctxt "selection:dash.app.booking,icon:"
msgid "dolly"
msgstr ""
msgctxt "selection:dash.app.booking,icon:"
msgid "key"
msgstr ""
msgctxt "selection:dash.app.booking,icon:"
msgid "motorcycle"
msgstr ""
msgctxt "selection:dash.app.booking,icon:"
msgid "shield"
msgstr ""
msgctxt "selection:dash.app.booking,icon:"
msgid "shipping fast"
msgstr ""
msgctxt "selection:dash.app.booking,icon:"
msgid "shopping bag"
msgstr ""
msgctxt "selection:dash.app.booking,icon:"
msgid "tasks"
msgstr "tareas"
msgctxt "selection:dash.app.booking,icon:"
msgid "th"
msgstr ""
msgctxt "selection:dash.app.booking,icon:"
msgid "utensils"
msgstr ""
msgctxt "selection:dash.app.booking,kind:"
msgid "External"
msgstr "Externo"
msgctxt "selection:dash.app.booking,kind:"
msgid "Internal"
msgstr "Interno"
msgctxt "selection:dash.app.hotel_planner,icon:"
msgid "cart"
msgstr ""
@ -7490,7 +7727,7 @@ msgstr ""
msgctxt "selection:dash.app.housekeeping,icon:"
msgid "tasks"
msgstr ""
msgstr "tareas"
msgctxt "selection:dash.app.housekeeping,icon:"
msgid "th"
@ -7546,7 +7783,7 @@ msgstr ""
msgctxt "selection:dash.app.web_checkin,icon:"
msgid "tasks"
msgstr ""
msgstr "tareas"
msgctxt "selection:dash.app.web_checkin,icon:"
msgid "th"
@ -7625,12 +7862,12 @@ msgid "Chat"
msgstr "Chat"
msgctxt "selection:hotel.booking,media:"
msgid "Fax"
msgstr "Fax"
msgid "Email"
msgstr "Email"
msgctxt "selection:hotel.booking,media:"
msgid "Mail"
msgstr "Correo"
msgid "Fax"
msgstr "Fax"
msgctxt "selection:hotel.booking,media:"
msgid "OTA"
@ -8148,6 +8385,26 @@ msgctxt "selection:hotel.print_booking_status.start,state:"
msgid "Offer"
msgstr "Oferta"
msgctxt "selection:hotel.rate_plan,state:"
msgid "Canceled"
msgstr "Cancelado"
msgctxt "selection:hotel.rate_plan,state:"
msgid "Confirmed"
msgstr "Confirmado"
msgctxt "selection:hotel.rate_plan,state:"
msgid "Draft"
msgstr "Borrador"
msgctxt "selection:hotel.rate_plan,state:"
msgid "Finished"
msgstr "Terminado"
msgctxt "selection:hotel.rate_plan,state:"
msgid "In progress"
msgstr "En Progreso"
msgctxt "selection:hotel.revenue_segmentation.start,kind:"
msgid "By Day"
msgstr ""
@ -8468,6 +8725,10 @@ msgctxt "view:hotel.folio:"
msgid "Do Payment"
msgstr "Hacer Pago"
msgctxt "view:hotel.folio:"
msgid "Load Accom."
msgstr "Cargar Acom."
msgctxt "view:hotel.folio:"
msgid "Occupancy"
msgstr "Ocupación"
@ -8644,6 +8905,14 @@ msgctxt "wizard_button:hotel.folio_update_occupancy,start,update:"
msgid "Change"
msgstr "Cambio"
msgctxt "wizard_button:hotel.housekeeping.schedule.wizard,start,accept:"
msgid "Ok"
msgstr "Aceptar"
msgctxt "wizard_button:hotel.housekeeping.schedule.wizard,start,end:"
msgid "Cancel"
msgstr "Cancelar"
msgctxt "wizard_button:hotel.invoice_income_daily,start,end:"
msgid "Cancel"
msgstr "Cancelar"
@ -8740,6 +9009,14 @@ msgctxt "wizard_button:hotel.revenue_segmentation,start,print_:"
msgid "Print"
msgstr "Imprimir"
msgctxt "wizard_button:hotel.siat_sync.wizard,start,accept:"
msgid "Ok"
msgstr "Aceptar"
msgctxt "wizard_button:hotel.siat_sync.wizard,start,end:"
msgid "Cancel"
msgstr "Cancelar"
msgctxt "wizard_button:hotel.statistics_by_month,start,end:"
msgid "Cancel"
msgstr "Cancelar"

117
siat.py
View File

@ -1,4 +1,5 @@
import requests
import json
from trytond.pool import Pool
from trytond.model import ModelView, fields
@ -6,23 +7,23 @@ from trytond.wizard import Wizard, StateView, Button, StateTransition
from trytond.transaction import Transaction
# 'Content-type': 'application/json',
HEADERS = {
'Accept': 'application/json',
'Content-type': 'application/json',
'x-authorization': None
'Accept': '*/*',
'Authorization': None
}
URL_GUEST = 'https://traapi.mincit.gov.co/api/'
URL_GUEST = 'https://pms.mincit.gov.co/one/'
URL_OTHERS = 'https://traapi.mincit.gov.co/apitwo/'
URL_OTHERS = 'https://pms.mincit.gov.co/two/'
TYPE_DOC = {
'11': 'RC', # REGISTRO CIVIL
'12': 'TI', # TARGETA IDENTIDAD
'13': 'CC', # CEDULA
'22': 'CE', # CEDULA EXTRANJERIA
'41': 'PA', # PASAPORTE
'47': 'PE', # PERMISO ESPECIAL
'11': 'R.C.', # REGISTRO CIVIL
'12': 'T.I.', # TARGETA IDENTIDAD
'13': 'C.C.', # CEDULA
'22': 'C.E.', # CEDULA EXTRANJERIA
'41': 'Pasaporte', # PASAPORTE
'47': 'P.E.', # PERMISO ESPECIAL
}
SEX = {
@ -30,14 +31,35 @@ SEX = {
'female': 'F',
}
# "fecha_nacimiento": str(guest.birthday or ''),
# "genero": SEX[guest.sex],
# "nacionalidad": country,
# "ocupacion": "",
# "pais_residencia": country,
# "departamento_residencia": subdivision,
# "pais_procedencia": country,
# "departamento_procedencia": subdivision,
# "nit_establecimiento": company.party.id_number,
# "lugar_nacimiento": nationality,
# "fecha_nacimiento": str(guest.birthday or ''),
# "genero": SEX[guest.sex],
# "nacionalidad": nationality,
# "n_habitaciones": rooms,
# "ocupacion": "Ninguna",
# "pais_residencia": country,
# "departamento_residencia": subdivision,
# "pais_procedencia": country,
# "departamento_procedencia": subdivision,
# "medio_reserva": "Ninguno",
def send_siat(company, guest, folio, token):
HEADERS['x-authorization'] = token
subdivision = guest.subdivision.rec_name if guest.subdivision else ''
HEADERS['Authorization'] = 'token ' + token
city = guest.city.rec_name if guest.city else ''
nationality = guest.nationality.rec_name if guest.nationality else ''
country = guest.country.rec_name if guest.country else ""
rooms = str(len(folio.booking.lines))
# subdivision = guest.subdivision.rec_name if guest.subdivision else ''
# nationality = guest.nationality.rec_name if guest.nationality else ''
# country = guest.country.rec_name if guest.country else ""
first_name = guest.first_name or ''
second_name = guest.second_name or ''
first_family_name = guest.first_family_name or ''
@ -48,39 +70,27 @@ def send_siat(company, guest, folio, token):
if num_acom <= 0:
num_acom = 0
guest = {
"nombre_establecimiento": company.party.name,
"nit_establecimiento": company.party.id_number,
"rnt_establecimiento": company.rnt_code,
"numero_identificacion": guest.id_number,
"tipo_identificacion": TYPE_DOC[guest.type_document],
"nombres": first_name + second_name,
"apellidos": first_family_name + second_family_name,
"lugar_nacimiento": nationality,
"fecha_nacimiento": str(guest.birthday or ''),
"genero": SEX[guest.sex],
"nacionalidad": nationality,
"n_habitaciones": rooms,
"motivo": "Viaje",
"ocupacion": "Ninguna",
"pais_residencia": country,
"departamento_residencia": subdivision,
"numero_identificacion": guest.id_number,
"nombres": first_name + ' ' + second_name,
"apellidos": first_family_name + ' ' + second_family_name,
"cuidad_residencia": city,
"pais_procedencia": country,
"departamento_procedencia": subdivision,
"cuidad_procedencia": city,
"numero_habitacion": folio.room.code,
"motivo": "Turismo",
"numero_acompanantes": str(num_acom),
"check_in": str(folio.arrival_date),
"check_out": str(folio.departure_date),
"costo": str(int(folio.total_amount)),
"numero_acompanantes": str(num_acom),
"medio_pago": '',
"medio_reserva": "Ninguno",
"tipo_acomodacion": folio.product.name,
"numero_habitacion": folio.room.code,
"costo": str(int(folio.total_amount)),
"nombre_establecimiento": company.party.name,
"rnt_establecimiento": company.rnt_code,
}
print(guest)
res = requests.post(URL_GUEST, data=guest, headers=HEADERS)
guests = []
res = res.json()
for guest in folio.guests:
if folio.main_guest:
continue
@ -89,29 +99,21 @@ def send_siat(company, guest, folio, token):
second_name = guest.second_name or ''
first_family_name = guest.first_family_name or ''
second_family_name = guest.second_family_name or ''
country = guest.country.rec_name if guest.country else ""
guests.append({
"numguestsero_identificacion": guest.id_number,
# country = guest.country.rec_name if guest.country else ""
guests = {
"tipo_identificacion": TYPE_DOC[guest.type_document],
"nombres": first_name + second_name,
"apellidos": first_family_name + second_family_name,
"lugar_nacimiento": "",
"fecha_nacimiento": str(guest.birthday or ''),
"genero": SEX[guest.sex],
"nacionalidad": country,
"ocupacion": "",
"pais_residencia": country,
"departamento_residencia": subdivision,
"numero_identificacion": guest.id_number,
"nombres": first_name + ' ' + second_name,
"apellidos": first_family_name + ' ' + second_family_name,
"cuidad_residencia": city,
"pais_procedencia": country,
"departamento_procedencia": subdivision,
"cuidad_procedencia": city,
"numero_habitacion": folio.room.code,
"check_in": str(folio.arrival_date),
"check_out": str(folio.departure_date),
"numero_habitacion": folio.room.code,
"padre": str(res['id']),
})
requests.post(URL_OTHERS, data=guests, headers=HEADERS)
"padre": res['code'],
}
requests.post(URL_OTHERS, data=guests, headers=HEADERS)
return res
class SiatSyncStart(ModelView):
@ -141,7 +143,6 @@ class SiatSyncWizard(Wizard):
def transition_accept(self):
pool = Pool()
Folio = pool.get('hotel.folio')
print("self.start.company...", self.start.company)
folios = Folio.search([
('booking.company', '=', self.start.company),
('guests.siat_send_date', '=', None),

View File

@ -1,5 +1,5 @@
[tryton]
version=6.0.110
version=6.0.111
depends:
party
company

View File

@ -42,7 +42,13 @@ this repository contains the full copyright notices and license terms. -->
<field name="visa_category"/>
<label name="birthday"/>
<field name="birthday"/>
<newline/>
<group col="5" id="siat" colspan="2">
<label name="siat_id"/>
<field name="siat_id"/>
<label name="siat_send_date"/>
<field name="siat_send_date" widget="date"/>
<field name="siat_send_date" widget="time"/>
</group>
<field name="tags" colspan="2"/>
<field name="notes" colspan="2"/>
</form>

View File

@ -11,4 +11,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="email"/>
<field name="folio"/>
<field name="sex"/>
<field name="siat_id"/>
<field name="siat_send_date" widget="date"/>
<field name="siat_send_date" widget="time"/>
</tree>

View File

@ -24,8 +24,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="host_quantity"/>
<label name="room_amount"/>
<field name="room_amount"/>
<label name="reference"/>
<field name="reference"/>
<label name="booking"/>
<field name="booking"/>
<label name="estimated_arrival_time"/>
<field name="estimated_arrival_time"/>
<label name="pax"/>

View File

@ -51,7 +51,9 @@ this repository contains the full copyright notices and license terms. -->
<field name="visa_number"/>
<label name="visa_category"/>
<field name="visa_category"/>
<group col="3" id="siat" colspan="2">
<group col="5" id="siat" colspan="2">
<label name="siat_id"/>
<field name="siat_id"/>
<label name="siat_send_date"/>
<field name="siat_send_date" widget="date"/>
<field name="siat_send_date" widget="time"/>

View File

@ -11,5 +11,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="mobile"/>
<field name="email"/>
<field name="sex"/>
<!-- <field name="siat_send_date"/> -->
<field name="siat_id"/>
<field name="siat_send_date" widget="date"/>
<field name="siat_send_date" widget="time"/>
</tree>