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:
@@ -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>
|
||||
|
||||
@@ -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