mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
Merge branch '11.0' of https://github.com/hootel/hootel into 11.0
This commit is contained in:
@@ -25,7 +25,9 @@ class HotelFolio(models.Model):
|
|||||||
'adults': stay['Adults'],
|
'adults': stay['Adults'],
|
||||||
'arrival_hour': stay['Arrival_hour'],
|
'arrival_hour': stay['Arrival_hour'],
|
||||||
'room_type_id': stay['RoomType']['Id'],
|
'room_type_id': stay['RoomType']['Id'],
|
||||||
'partner_id': stay["Customers"][0]["Id"]
|
'partner_id': stay["Customers"][0]["Id"],
|
||||||
|
'segmentation_ids': stay['Segmentation'],
|
||||||
|
'channel_type': 'virtualdoor',
|
||||||
}
|
}
|
||||||
reservation_rm = reservation_obj.create(vals)
|
reservation_rm = reservation_obj.create(vals)
|
||||||
else:
|
else:
|
||||||
@@ -37,6 +39,13 @@ class HotelFolio(models.Model):
|
|||||||
total_chekins,
|
total_chekins,
|
||||||
reservation_rm.id)
|
reservation_rm.id)
|
||||||
for room_partner in stay["Customers"]:
|
for room_partner in stay["Customers"]:
|
||||||
|
if room_partner['Address']['Nationality'] == 'ESP':
|
||||||
|
code_ine = room_partner['Address']['Province']
|
||||||
|
else:
|
||||||
|
code_ine = room_partner['Address']['Nationality']
|
||||||
|
province = self.env['code.ine'].search(
|
||||||
|
[('name', '=', code_ine)], limit=1)
|
||||||
|
code_ine = province.id
|
||||||
|
|
||||||
checkin_partner_val = {
|
checkin_partner_val = {
|
||||||
'folio_id': reservation_rm.folio_id.id,
|
'folio_id': reservation_rm.folio_id.id,
|
||||||
@@ -44,6 +53,7 @@ class HotelFolio(models.Model):
|
|||||||
'partner_id': room_partner["Id"],
|
'partner_id': room_partner["Id"],
|
||||||
'enter_date': stay["Arrival"],
|
'enter_date': stay["Arrival"],
|
||||||
'exit_date': stay["Departure"],
|
'exit_date': stay["Departure"],
|
||||||
|
'code_ine_id': code_ine,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
record = self.env['hotel.checkin.partner'].create(
|
record = self.env['hotel.checkin.partner'].create(
|
||||||
@@ -57,8 +67,10 @@ class HotelFolio(models.Model):
|
|||||||
stay['Id'] = record.id
|
stay['Id'] = record.id
|
||||||
stay['Room'] = reservation_rm.room_id.id
|
stay['Room'] = reservation_rm.room_id.id
|
||||||
json_response = stay
|
json_response = stay
|
||||||
except:
|
except Exception as e:
|
||||||
json_response = {'Estate': 'Error not create Checkin'}
|
error_name = 'Error not create Checkin '
|
||||||
|
error_name += e.name
|
||||||
|
json_response = {'Estate': error_name}
|
||||||
_logger.error('ROOMMATIK writing %s in reservation: %s).',
|
_logger.error('ROOMMATIK writing %s in reservation: %s).',
|
||||||
checkin_partner_val['partner_id'],
|
checkin_partner_val['partner_id'],
|
||||||
checkin_partner_val['reservation_id'])
|
checkin_partner_val['reservation_id'])
|
||||||
|
|||||||
@@ -81,6 +81,23 @@ class RoomMatik(models.Model):
|
|||||||
apidata = self.env['hotel.room.type']
|
apidata = self.env['hotel.room.type']
|
||||||
return apidata.sudo().rm_get_prices(start_date, number_intervals, room_type, guest_number)
|
return apidata.sudo().rm_get_prices(start_date, number_intervals, room_type, guest_number)
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def rm_get_segmentation(self):
|
||||||
|
# Gets segmentation list
|
||||||
|
# return ArrayOfSegmentation
|
||||||
|
segmentations = self.env['res.partner.category'].sudo().search([])
|
||||||
|
_logger.info('ROOMMATIK Get segmentation')
|
||||||
|
response = []
|
||||||
|
for segmentation in segmentations:
|
||||||
|
response.append({
|
||||||
|
"Segmentation": {
|
||||||
|
"Id": segmentation.id,
|
||||||
|
"Name": segmentation.display_name,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
json_response = json.dumps(response)
|
||||||
|
return json_response
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _rm_add_payment(self, code, payment):
|
def _rm_add_payment(self, code, payment):
|
||||||
apidata = self.env['account.payment']
|
apidata = self.env['account.payment']
|
||||||
|
|||||||
Reference in New Issue
Block a user