mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[UPD] Task 978 - hotel rooms segmentation
This commit is contained in:
@@ -267,11 +267,11 @@ class ChannelBackend(models.Model):
|
||||
_logger.warning(msg)
|
||||
|
||||
email_values.update({'body_html': email_values['body_html'] + msg + '<br/>'})
|
||||
|
||||
if len(email_values['body_html']) > 0:
|
||||
template = self.env.ref('hotel_channel_connector.mail_template_hotel_availability_watchdog')
|
||||
email_values.update({'email_to': self._context['email_to']})
|
||||
template.send_mail(self.id, email_values=email_values)
|
||||
if 'email_to' in self._context:
|
||||
template = self.env.ref('hotel_channel_connector.mail_template_hotel_availability_watchdog')
|
||||
email_values.update({'email_to': self._context['email_to']})
|
||||
template.send_mail(self.id, email_values=email_values)
|
||||
# push availability on demand
|
||||
self.with_context({'show_notify': False}).push_availability()
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class HotelRoom(models.Model):
|
||||
|
||||
channel_availability = self.env['channel.hotel.room.type.availability'].search([
|
||||
('room_type_id', '=', item['old_room_type_id']),
|
||||
('channel_avail', '>=', old_room_type_total_rooms_count),
|
||||
('channel_avail', '>', old_room_type_total_rooms_count),
|
||||
('date', '>=', _today)
|
||||
], order='date asc') or False
|
||||
if channel_availability:
|
||||
@@ -119,6 +119,11 @@ class HotelRoom(models.Model):
|
||||
checkout=dto,
|
||||
backend_id=new_channel_room_type.backend_id.id,
|
||||
room_type_id=item['new_room_type_id'], )
|
||||
# TODO: channel_backend MUST be the same for both room types
|
||||
channel_backend = self.env['channel.hotel.room.type'].search([
|
||||
('odoo_id', '=', vals.get('room_type_id'))
|
||||
]).backend_id
|
||||
channel_backend.channel_availability_watchdog()
|
||||
else:
|
||||
res = super().write(vals)
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user