From 52562f73416277394bcb7ac8b5732acbbc58dfde Mon Sep 17 00:00:00 2001 From: QS5ELkMu Date: Thu, 6 Sep 2018 00:06:37 +0200 Subject: [PATCH] [WIP][MIG][11.0] Hotel Improvements + Hotel Calendar --- hotel/__manifest__.py | 4 +- hotel/data/email_template_cancel.xml | 2 +- hotel/data/email_template_reserv.xml | 12 +- hotel/models/__init__.py | 2 +- hotel/models/currency_exchange.py | 1 - hotel/models/hotel_folio.py | 10 +- hotel/models/hotel_reservation.py | 20 +- hotel/models/hotel_room_amenities.py | 1 + hotel/models/hotel_room_amenities_type.py | 1 + hotel/models/hotel_room_type.py | 4 +- hotel/models/hotel_room_type_availability.py | 6 +- .../hotel_room_type_restriction_item.py | 6 +- hotel/models/hotel_service.py | 7 +- hotel/models/hotel_service_line.py | 2 +- hotel/models/inherit_account_payment.py | 1 - hotel/security/ir.model.access.csv | 18 +- hotel/tests/common.py | 14 +- hotel/tests/test_reservation.py | 2 +- hotel/views/hotel_folio.xml | 4 +- hotel/views/hotel_reservation.xml | 6 +- hotel/views/hotel_room.xml | 6 +- .../reservation_restriction_item_views.xml | 4 +- hotel/views/reservation_restriction_views.xml | 2 +- ...ability.xml => room_type_availability.xml} | 14 +- ...ual_room_views.xml => room_type_views.xml} | 20 +- hotel/wizard/checkinwizard.py | 2 +- hotel/wizard/duplicate_reservation.py | 6 +- hotel/wizard/massive_changes.py | 8 +- hotel/wizard/massive_changes.xml | 2 +- hotel/wizard/split_reservation.py | 2 +- hotel_calendar/models/__init__.py | 4 +- .../models/hotel_calendar_management.py | 91 +++-- .../models/inherited_hotel_reservation.py | 15 +- ...inherited_hotel_room_type_availability.py} | 10 +- ...rited_hotel_room_type_restriction_item.py} | 14 +- hotel_calendar/models/inherited_ir_default.py | 10 +- .../inherited_product_pricelist_item.py | 8 +- .../js/views/calendar/hotel_calendar_model.js | 2 +- .../hotel_calendar_management_controller.js | 38 +-- .../hotel_calendar_management_renderer.js | 4 +- .../hotel_calendar_management_v.js | 42 +-- .../static/src/lib/hcalendar/js/hcalendar.js | 24 +- .../lib/hcalendar/js/hcalendar_management.js | 64 ++-- .../tests/test_management_calendar.py | 8 +- .../views/inherited_hotel_room_type_views.xml | 2 +- hotel_calendar/wizard/wizard_reservation.py | 313 ++++++++---------- hotel_calendar/wizard/wizard_reservation.xml | 6 +- .../models/inherited_hotel_reservation.py | 8 +- .../views/hotel_reservation.xml | 2 +- hotel_channel_connector/__manifest__.py | 6 +- .../components/exporter.py | 8 +- .../components/importer.py | 48 +-- hotel_channel_connector/data/sequences.xml | 4 +- hotel_channel_connector/models/__init__.py | 4 +- .../models/hotel_room_type/common.py | 2 +- .../__init__.py | 0 .../common.py | 52 +-- .../__init__.py | 0 .../common.py | 8 +- .../models/inherited_hotel_folio.py | 12 +- hotel_channel_connector/models/res_config.py | 4 +- hotel_channel_connector/tests/__init__.py | 4 +- .../test_virtual_room_availability_model.py | 2 +- hotel_channel_connector/tests/test_wubook.py | 2 +- .../views/channel_hotel_room_type_views.xml | 12 +- ..._hotel_virtual_room_availability_views.xml | 4 +- ...l_hotel_virtual_room_restriction_views.xml | 4 +- .../views/channel_product_pricelist_views.xml | 2 +- .../views/inherited_hotel_room_type_views.xml | 2 +- ..._hotel_virtual_room_availability_views.xml | 8 +- 70 files changed, 509 insertions(+), 533 deletions(-) rename hotel/views/{virtual_room_availability.xml => room_type_availability.xml} (76%) rename hotel/views/{virtual_room_views.xml => room_type_views.xml} (78%) rename hotel_calendar/models/{inherited_hotel_virtual_room_availability.py => inherited_hotel_room_type_availability.py} (84%) rename hotel_calendar/models/{inherited_hotel_virtual_room_restriction_item.py => inherited_hotel_room_type_restriction_item.py} (89%) rename hotel_channel_connector/models/{hotel_virtual_room_availability => hotel_room_type_availability}/__init__.py (100%) rename hotel_channel_connector/models/{hotel_virtual_room_availability => hotel_room_type_availability}/common.py (76%) rename hotel_channel_connector/models/{hotel_virtual_room_restriction => hotel_room_type_restriction}/__init__.py (100%) rename hotel_channel_connector/models/{hotel_virtual_room_restriction => hotel_room_type_restriction}/common.py (95%) diff --git a/hotel/__manifest__.py b/hotel/__manifest__.py index cd666ce1d..3d2afafb6 100644 --- a/hotel/__manifest__.py +++ b/hotel/__manifest__.py @@ -50,9 +50,9 @@ 'views/reservation_restriction_views.xml', 'views/reservation_restriction_item_views.xml', 'views/hotel_reservation.xml', - # 'views/virtual_room_views.xml', + # 'views/room_type_views.xml', 'views/cardex.xml', - 'views/virtual_room_availability.xml', + 'views/room_type_availability.xml', # 'views/hotel_dashboard.xml', 'data/cron_jobs.xml', 'data/records.xml', diff --git a/hotel/data/email_template_cancel.xml b/hotel/data/email_template_cancel.xml index 4abc1c9fe..e34114d23 100644 --- a/hotel/data/email_template_cancel.xml +++ b/hotel/data/email_template_cancel.xml @@ -164,7 +164,7 @@ % endif
% for rline in object.get_grouped_reservations_json('cancelled'): - ${rline['num']} x ${rline['virtual_room']['name']} + ${rline['num']} x ${rline['room_type']['name']} % if rline['childrens'] > 0: (${rline['adults']} Adults + ${rline['childrens']} Childrens) % else: diff --git a/hotel/data/email_template_reserv.xml b/hotel/data/email_template_reserv.xml index 6e6829dd6..520624b04 100644 --- a/hotel/data/email_template_reserv.xml +++ b/hotel/data/email_template_reserv.xml @@ -257,7 +257,7 @@
% for rline in object.get_grouped_reservations_json('confirm'): - ${rline['num']} x ${rline['virtual_room']['name']} + ${rline['num']} x ${rline['room_type']['name']} % if rline['childrens'] > 0: (${rline['adults']} Adultos + ${rline['childrens']} Niños) % else: @@ -406,13 +406,13 @@ Información de la habitación - % set vroom_ids = object.room_lines.filtered('to_send').mapped('virtual_room_id.id') - % set vrooms = user.env['hotel.virtual.room'].browse(vroom_ids) - % for vroom in vrooms: + % set room_type_ids = object.room_lines.filtered('to_send').mapped('room_type_id.id') + % set room_types = user.env['hotel.room.type'].browse(room_type_ids) + % for room_type in room_types: - % if vroom.name: + % if room_type.name: - ${vroom.name} + ${room_type.name} % else: diff --git a/hotel/models/__init__.py b/hotel/models/__init__.py index ba680c7ff..6b4eea4f4 100644 --- a/hotel/models/__init__.py +++ b/hotel/models/__init__.py @@ -19,7 +19,7 @@ from . import inherit_account_invoice # from . import inherit_product_category from . import inherit_product_product from . import inherit_res_company -# from . import virtual_room +# from . import room_type from . import inherit_account_payment from . import hotel_room_type_restriction from . import hotel_room_type_restriction_item diff --git a/hotel/models/currency_exchange.py b/hotel/models/currency_exchange.py index c0c4a7fda..a56341d8e 100644 --- a/hotel/models/currency_exchange.py +++ b/hotel/models/currency_exchange.py @@ -10,7 +10,6 @@ from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT class CurrencyExchangeRate(models.Model): - _name = "currency.exchange" _description = "currency" diff --git a/hotel/models/hotel_folio.py b/hotel/models/hotel_folio.py index 0282172f7..72e6dae36 100644 --- a/hotel/models/hotel_folio.py +++ b/hotel/models/hotel_folio.py @@ -21,6 +21,10 @@ from odoo.addons import decimal_precision as dp class HotelFolio(models.Model): + _name = 'hotel.folio' + _description = 'Hotel Folio' + _inherit = ['mail.thread', 'mail.activity.mixin', 'portal.mixin'] + _order = 'id' # @api.depends('invoice_lines.invoice_id.state', 'invoice_lines.quantity') def _get_invoice_qty(self): @@ -41,12 +45,6 @@ class HotelFolio(models.Model): def _amount_all(self): pass - _name = 'hotel.folio' - _description = 'Hotel Folio' - - _order = 'id' - _inherit = ['mail.thread', 'mail.activity.mixin', 'portal.mixin'] - name = fields.Char('Folio Number', readonly=True, index=True, default=lambda self: _('New')) partner_id = fields.Many2one('res.partner', diff --git a/hotel/models/hotel_reservation.py b/hotel/models/hotel_reservation.py index f333f6c8e..eabdc9add 100644 --- a/hotel/models/hotel_reservation.py +++ b/hotel/models/hotel_reservation.py @@ -16,6 +16,10 @@ _logger = logging.getLogger(__name__) class HotelReservation(models.Model): + _name = 'hotel.reservation' + _description = 'Hotel Reservation' + _inherit = ['mail.thread', 'mail.activity.mixin', 'portal.mixin'] + _order = "last_updated_res desc, name" def _get_default_checkin(self): folio = False @@ -110,11 +114,6 @@ class HotelReservation(models.Model): fields.Date.from_string(res.checkout) - fields.Date.from_string(res.checkin) ).days - _name = 'hotel.reservation' - _description = 'Hotel Reservation' - _inherit = ['mail.thread', 'mail.activity.mixin', 'portal.mixin'] - _order = "last_updated_res desc, name" - name = fields.Text('Reservation Description', required=True) room_id = fields.Many2one('hotel.room', string='Room') @@ -312,9 +311,12 @@ class HotelReservation(models.Model): }) for record in self: if record.compute_price_out_vals(vals): + checkin = vals['checkin'] if 'checkin' in vals else record.checkin + checkout = vals['checkout'] if 'checkout' in vals else record.checkout + days_diff = ( - fields.Date.from_string(record.checkout) - \ - fields.Date.from_string(record.checkin) + fields.Date.from_string(checkout) - \ + fields.Date.from_string(checkin) ).days record.update(record.prepare_reservation_lines( vals['checkin'], @@ -390,7 +392,7 @@ class HotelReservation(models.Model): 'overbooking': self.overbooking, 'price_unit': self.price_unit, 'splitted': self.splitted, - # 'virtual_room_id': self.virtual_room_id.id, + # 'room_type_id': self.room_type_id.id, 'room_type_id': self.room_type_id.id, } @@ -419,7 +421,7 @@ class HotelReservation(models.Model): #Si el registro no existe, modificar room_type aunque ya esté establecido if not self.room_type_id: write_vals.update({'room_type_id': self.room_id.room_type_id.id}) - self.write(write_vals) + self.update(write_vals) @api.onchange('partner_id') def onchange_partner_id(self): diff --git a/hotel/models/hotel_room_amenities.py b/hotel/models/hotel_room_amenities.py index 137af8363..dc0ce906a 100644 --- a/hotel/models/hotel_room_amenities.py +++ b/hotel/models/hotel_room_amenities.py @@ -7,6 +7,7 @@ from odoo import models, fields, api, _ class HotelRoomAmenities(models.Model): _name = 'hotel.room.amenities' _description = 'Room amenities' + # The record's name name = fields.Char('Amenity Name', required=True) # Used for activate records diff --git a/hotel/models/hotel_room_amenities_type.py b/hotel/models/hotel_room_amenities_type.py index a7da08d3c..4cc3d32ff 100644 --- a/hotel/models/hotel_room_amenities_type.py +++ b/hotel/models/hotel_room_amenities_type.py @@ -7,6 +7,7 @@ from odoo import models, fields, api, _ class HotelRoomAmenitiesType(models.Model): _name = 'hotel.room.amenities.type' _description = 'Amenities Type' + # The record's name name = fields.Char('Amenity Name', required=True) # Used for activate records diff --git a/hotel/models/hotel_room_type.py b/hotel/models/hotel_room_type.py index 16576fb68..8ce8d5f3d 100644 --- a/hotel/models/hotel_room_type.py +++ b/hotel/models/hotel_room_type.py @@ -10,8 +10,8 @@ class HotelRoomType(models.Model): """ _name = "hotel.room.type" _description = "Room Type" - _inherits = {'product.product': 'product_id'} + # Relationship between models product_id = fields.Many2one('product.product', 'Product Room Type', required=True, delegate=True, @@ -59,7 +59,7 @@ class HotelRoomType(models.Model): @api.model # TODO Rename to check_availability_room_type - def check_availability_virtual_room(self, dfrom, dto, + def check_availability_room(self, dfrom, dto, room_type_id=False, notthis=[]): """ Check the avalability for an specific type of room diff --git a/hotel/models/hotel_room_type_availability.py b/hotel/models/hotel_room_type_availability.py index 7f75d2b7c..b17fa56f6 100644 --- a/hotel/models/hotel_room_type_availability.py +++ b/hotel/models/hotel_room_type_availability.py @@ -10,7 +10,7 @@ class HotelRoomTypeAvailability(models.Model): _inherit = 'mail.thread' _name = 'hotel.room.type.availability' - # virtual_room_id = fields.Many2one('hotel.virtual.room', 'Virtual Room', + # room_type_id = fields.Many2one('hotel.virtual.room', 'Virtual Room', # required=True, track_visibility='always', # ondelete='cascade') room_type_id = fields.Many2one('hotel.room.type', 'Room Type', @@ -34,7 +34,7 @@ class HotelRoomTypeAvailability(models.Model): self.avail = 0 room_type_obj = self.env['hotel.room.type'] - cavail = len(room_type_obj.check_availability_virtual_room( + cavail = len(room_type_obj.check_availability_room( self.date, self.date, room_type_id=self.room_type_id.id)) @@ -44,7 +44,7 @@ class HotelRoomTypeAvailability(models.Model): self.avail = max_avail @api.constrains('date', 'room_type_id') - def _check_date_virtual_room_id(self): + def _check_date_room_type_id(self): count = self.search_count([ ('date', '=', self.date), ('room_type_id', '=', self.room_type_id.id) diff --git a/hotel/models/hotel_room_type_restriction_item.py b/hotel/models/hotel_room_type_restriction_item.py index dadb9ff7e..d704e1eaf 100644 --- a/hotel/models/hotel_room_type_restriction_item.py +++ b/hotel/models/hotel_room_type_restriction_item.py @@ -13,7 +13,7 @@ class HotelRoomTypeRestrictionItem(models.Model): restriction_id = fields.Many2one('hotel.room.type.restriction', 'Restriction Plan', ondelete='cascade', index=True) - # virtual_room_id = fields.Many2one('hotel.virtual.room', 'Virtual Room', + # room_type_id = fields.Many2one('hotel.virtual.room', 'Virtual Room', # required=True, ondelete='cascade') room_type_id = fields.Many2one('hotel.room.type', 'Room Type', required=True, ondelete='cascade') @@ -21,8 +21,8 @@ class HotelRoomTypeRestrictionItem(models.Model): date_end = fields.Date("To") applied_on = fields.Selection([ ('1_global', 'Global'), - # ('0_virtual_room', 'Virtual Room')], string="Apply On", required=True, - # default='0_virtual_room', + # ('0_room_type', 'Virtual Room')], string="Apply On", required=True, + # default='0_room_type', ('0_room_type', 'Room Type')], string="Apply On", required=True, default='0_room_type', help='Pricelist Item applicable on selected option') diff --git a/hotel/models/hotel_service.py b/hotel/models/hotel_service.py index e3895c7b8..7352702db 100644 --- a/hotel/models/hotel_service.py +++ b/hotel/models/hotel_service.py @@ -8,7 +8,9 @@ from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT _logger = logging.getLogger(__name__) class HotelService(models.Model): - + _name = 'hotel.service' + _description = 'Hotel Services and its charges' + @api.model def _service_checkin(self): if 'checkin' in self._context: @@ -30,9 +32,6 @@ class HotelService(models.Model): ], limit=1) return False - _name = 'hotel.service' - _description = 'Hotel Services and its charges' - name = fields.Char('Service description') # services in the hotel are products product_id = fields.Many2one('product.product', 'Service', required=True) diff --git a/hotel/models/hotel_service_line.py b/hotel/models/hotel_service_line.py index c772b5531..74161fe08 100644 --- a/hotel/models/hotel_service_line.py +++ b/hotel/models/hotel_service_line.py @@ -146,7 +146,7 @@ class HotelServiceLine(models.Model): 'product_uom': self.product_id.uom_id, 'price_unit': self.product_id.price, }) - self.write(write_vals) + self.update(write_vals) #~ self.price_unit = tax_obj._fix_tax_included_price(prod.price, #~ prod.taxes_id, diff --git a/hotel/models/inherit_account_payment.py b/hotel/models/inherit_account_payment.py index 0a953741c..9ac50cb80 100644 --- a/hotel/models/inherit_account_payment.py +++ b/hotel/models/inherit_account_payment.py @@ -7,7 +7,6 @@ _logger = logging.getLogger(__name__) class AccountPayment(models.Model): - _inherit = 'account.payment' folio_id = fields.Many2one('hotel.folio', string='Folio') diff --git a/hotel/security/ir.model.access.csv b/hotel/security/ir.model.access.csv index e1b816195..fad9d9dee 100644 --- a/hotel/security/ir.model.access.csv +++ b/hotel/security/ir.model.access.csv @@ -20,12 +20,12 @@ access_hotel_order_call,hotel.order.call,sale.model_sale_order,hotel.group_hotel access_hotel_order_line_call,hotel.order.line.call,sale.model_sale_order_line,hotel.group_hotel_call,1,1,1,1 access_hotel_order_line_user,hotel.order.line.user,sale.model_sale_order_line,hotel.group_hotel_user,1,1,1,1 access_hotel_order_user,hotel.order.user,sale.model_sale_order,hotel.group_hotel_user,1,1,1,1 -access_hotel_restrictions_call,hotel.restriction. All,hotel.model_hotel_virtual_room_restriction,hotel.group_hotel_call,1,0,0,0 -access_hotel_restrictions_item_call,hotel.restriction.item.call,hotel.model_hotel_virtual_room_restriction_item,hotel.group_hotel_call,1,0,0,0 -access_hotel_restrictions_item_manager,hotel.restriction.item.manager,hotel.model_hotel_virtual_room_restriction_item,hotel.group_hotel_manager,1,1,1,1 -access_hotel_restrictions_item_user,hotel.restriction.item.user,hotel.model_hotel_virtual_room_restriction_item,hotel.group_hotel_user,1,0,0,0 -access_hotel_restrictions_manager,hotel.restriction.manager,hotel.model_hotel_virtual_room_restriction,hotel.group_hotel_manager,1,1,1,1 -access_hotel_restrictions_user,hotel.restriction.user,hotel.model_hotel_virtual_room_restriction,hotel.group_hotel_user,1,0,0,0 +access_hotel_restrictions_call,hotel.restriction. All,hotel.model_hotel_room_type_restriction,hotel.group_hotel_call,1,0,0,0 +access_hotel_restrictions_item_call,hotel.restriction.item.call,hotel.model_hotel_room_type_restriction_item,hotel.group_hotel_call,1,0,0,0 +access_hotel_restrictions_item_manager,hotel.restriction.item.manager,hotel.model_hotel_room_type_restriction_item,hotel.group_hotel_manager,1,1,1,1 +access_hotel_restrictions_item_user,hotel.restriction.item.user,hotel.model_hotel_room_type_restriction_item,hotel.group_hotel_user,1,0,0,0 +access_hotel_restrictions_manager,hotel.restriction.manager,hotel.model_hotel_room_type_restriction,hotel.group_hotel_manager,1,1,1,1 +access_hotel_restrictions_user,hotel.restriction.user,hotel.model_hotel_room_type_restriction,hotel.group_hotel_user,1,0,0,0 access_hotel_room,hotel.room.user,model_hotel_room,hotel.group_hotel_user,1,0,0,0 access_hotel_room_amenities,hotel.room_aminities.user,model_hotel_room_amenities,hotel.group_hotel_user,1,0,0,0 access_hotel_room_amenities_call,hotel.room_aminities.call,model_hotel_room_amenities,hotel.group_hotel_call,1,0,0,0 @@ -43,9 +43,9 @@ access_hotel_service_call,hotel_service.call,model_hotel_service,hotel.group_hot access_hotel_user reconcilie,hotel.user reconcilie,account.model_account_partial_reconcile,hotel.group_hotel_user,1,1,1,1 access_hotel_user_account_full_reconcilie,hotel.user_account_full_reconcilie,account.model_account_full_reconcile,hotel.group_hotel_user,1,1,1,1 access_hotel_user_user,hotel.user_res_user,auth_crypt.model_res_users,hotel.group_hotel_user,1,1,0,0 -access_hotel_virtual_room_availability_call,hotel.availability.call,hotel.model_hotel_virtual_room_availability,hotel.group_hotel_call,1,1,1,1 -access_hotel_virtual_room_availability_manager,hotel.availability.manager,hotel.model_hotel_virtual_room_availability,hotel.group_hotel_manager,1,1,1,1 -access_hotel_virtual_room_availability_user,hotel.availability.user,hotel.model_hotel_virtual_room_availability,hotel.group_hotel_user,1,1,1,1 +access_hotel_room_type_availability_call,hotel.availability.call,hotel.model_hotel_room_type_availability,hotel.group_hotel_call,1,1,1,1 +access_hotel_room_type_availability_manager,hotel.availability.manager,hotel.model_hotel_room_type_availability,hotel.group_hotel_manager,1,1,1,1 +access_hotel_room_type_availability_user,hotel.availability.user,hotel.model_hotel_room_type_availability,hotel.group_hotel_user,1,1,1,1 access_product_category,product.category.user,product.model_product_category,hotel.group_hotel_user,1,0,0,0 access_product_category_call,product.category.call,product.model_product_category,hotel.group_hotel_call,1,0,0,0 access_product_category_manager,product.category.manager,product.model_product_category,hotel.group_hotel_manager,1,1,1,1 diff --git a/hotel/tests/common.py b/hotel/tests/common.py index 3f6ffee51..b0b27aa1d 100644 --- a/hotel/tests/common.py +++ b/hotel/tests/common.py @@ -59,7 +59,7 @@ class TestHotel(TestMail): 'checkin': checkin.strftime(DEFAULT_SERVER_DATETIME_FORMAT), 'checkout': checkout.strftime(DEFAULT_SERVER_DATETIME_FORMAT), 'folio_id': folio.id, - 'virtual_room_id': room.price_virtual_room.id, + 'room_type_id': room.price_room_type.id, 'product_id': room.product_id.id, }) self.assertTrue( @@ -171,14 +171,14 @@ class TestHotel(TestMail): cls.hotel_room_simple_100 = Rooms.create({ 'name': '100', 'sale_price_type': 'vroom', - 'price_virtual_room': cls.hotel_vroom_budget.id, + 'price_room_type': cls.hotel_vroom_budget.id, 'categ_id': cls.hotel_room_type_simple.cat_id.id, 'capacity': 1, }) cls.hotel_room_simple_101 = Rooms.create({ 'name': '101', 'sale_price_type': 'vroom', - 'price_virtual_room': cls.hotel_vroom_budget.id, + 'price_room_type': cls.hotel_vroom_budget.id, 'categ_id': cls.hotel_room_type_simple.cat_id.id, 'capacity': 1, 'sequence': 1, @@ -186,7 +186,7 @@ class TestHotel(TestMail): cls.hotel_room_double_200 = Rooms.create({ 'name': '200', 'sale_price_type': 'vroom', - 'price_virtual_room': cls.hotel_vroom_special.id, + 'price_room_type': cls.hotel_vroom_special.id, 'categ_id': cls.hotel_room_type_double.cat_id.id, 'capacity': 2, }) @@ -228,16 +228,16 @@ class TestHotel(TestMail): for i in range(0, len(v_vr)): ndate = now_utc_dt + timedelta(days=i) vroom_avail_obj.create({ - 'virtual_room_id': k_vr, + 'room_type_id': k_vr, 'avail': v_vr[i], 'date': ndate.strftime(DEFAULT_SERVER_DATE_FORMAT) }) vroom_rest_item_obj.create({ - 'virtual_room_id': k_vr, + 'room_type_id': k_vr, 'restriction_id': cls.parity_restrictions_id, 'date_start': ndate.strftime(DEFAULT_SERVER_DATE_FORMAT), 'date_end': ndate.strftime(DEFAULT_SERVER_DATE_FORMAT), - 'applied_on': '0_virtual_room', + 'applied_on': '0_room_type', 'min_stay': cls.restrictions_min_stay_tmp[k_vr][i], }) pricelist_item_obj.create({ diff --git a/hotel/tests/test_reservation.py b/hotel/tests/test_reservation.py index 687f7e25e..a4ec21534 100644 --- a/hotel/tests/test_reservation.py +++ b/hotel/tests/test_reservation.py @@ -232,7 +232,7 @@ class TestHotelReservations(TestHotel): # 5.0, 15.0, 15.0, 35.0, 35.0, 10.0, 10.0 - vroom_prices = self.prices_tmp[self.hotel_room_double_200.price_virtual_room.id] + vroom_prices = self.prices_tmp[self.hotel_room_double_200.price_room_type.id] org_reserv_start_utc_dt = now_utc_dt + timedelta(days=1) org_reserv_end_utc_dt = org_reserv_start_utc_dt + timedelta(days=2) folio = self.create_folio(self.user_hotel_manager, self.partner_2) diff --git a/hotel/views/hotel_folio.xml b/hotel/views/hotel_folio.xml index 9d7ba79cf..be1003cce 100644 --- a/hotel/views/hotel_folio.xml +++ b/hotel/views/hotel_folio.xml @@ -194,7 +194,7 @@ - + @@ -307,7 +307,7 @@ - diff --git a/hotel/views/hotel_reservation.xml b/hotel/views/hotel_reservation.xml index 67c4f4118..1e57866d8 100644 --- a/hotel/views/hotel_reservation.xml +++ b/hotel/views/hotel_reservation.xml @@ -186,7 +186,7 @@ - @@ -335,7 +335,7 @@ /> - + @@ -432,7 +432,7 @@ /> + context="{'group_by':'room_type_id'}"/> --> - - - + + + diff --git a/hotel/views/reservation_restriction_item_views.xml b/hotel/views/reservation_restriction_item_views.xml index 852afec62..459da61cb 100644 --- a/hotel/views/reservation_restriction_item_views.xml +++ b/hotel/views/reservation_restriction_item_views.xml @@ -9,7 +9,7 @@
- + @@ -43,7 +43,7 @@ - + diff --git a/hotel/views/reservation_restriction_views.xml b/hotel/views/reservation_restriction_views.xml index 03b6fb544..03ee0bf7e 100644 --- a/hotel/views/reservation_restriction_views.xml +++ b/hotel/views/reservation_restriction_views.xml @@ -19,7 +19,7 @@ - + diff --git a/hotel/views/virtual_room_availability.xml b/hotel/views/room_type_availability.xml similarity index 76% rename from hotel/views/virtual_room_availability.xml rename to hotel/views/room_type_availability.xml index 910b32dd0..36d3b07c7 100644 --- a/hotel/views/virtual_room_availability.xml +++ b/hotel/views/room_type_availability.xml @@ -2,14 +2,14 @@ - + hotel.room.type.availability.form hotel.room.type.availability - +

@@ -28,12 +28,12 @@
- + hotel.room.type.availability.tree hotel.room.type.availability - + @@ -44,7 +44,7 @@ - + Virtual Room Availability hotel.room.type.availability form @@ -52,8 +52,8 @@ -
diff --git a/hotel/views/virtual_room_views.xml b/hotel/views/room_type_views.xml similarity index 78% rename from hotel/views/virtual_room_views.xml rename to hotel/views/room_type_views.xml index d57ed73c8..7177a4f6e 100644 --- a/hotel/views/virtual_room_views.xml +++ b/hotel/views/room_type_views.xml @@ -2,9 +2,9 @@ - - virtual.room.view.form - hotel.virtual.room + + room.type.view.form + hotel.room.type @@ -41,9 +41,9 @@ - - virtual.room.view.tree - hotel.virtual.room + + room.type.view.tree + hotel.room.type @@ -57,16 +57,16 @@ - + Virtual Rooms - hotel.virtual.room + hotel.room.type form tree,form - diff --git a/hotel/wizard/checkinwizard.py b/hotel/wizard/checkinwizard.py index 1d9e4811d..a9a26528e 100644 --- a/hotel/wizard/checkinwizard.py +++ b/hotel/wizard/checkinwizard.py @@ -212,7 +212,7 @@ class Wizard(models.TransientModel): # show the checkin fields if a partner is selected if self.op_select_partner == 'S' and self.partner_id.id != False: write_vals.update({'checkin_mode': 1}) - self.write(write_vals) + self.update(write_vals) @api.onchange('op_select_partner') def onchange_op_select_partner(self): diff --git a/hotel/wizard/duplicate_reservation.py b/hotel/wizard/duplicate_reservation.py index 201685a6b..96016d069 100644 --- a/hotel/wizard/duplicate_reservation.py +++ b/hotel/wizard/duplicate_reservation.py @@ -32,7 +32,7 @@ class DuplicateReservationWizard(models.TransientModel): })) # Check Input - avails = hotel_room_type_obj.check_availability_virtual_room( + avails = hotel_room_type_obj.check_availability_room( reservation_id.checkin, reservation_id.checkout, room_type_id=reservation_id.room_type_id.id) @@ -43,10 +43,10 @@ class DuplicateReservationWizard(models.TransientModel): There are no '%d' free rooms") % self.num) for i in range(0, self.num): - free_rooms = hotel_room_type_obj.check_availability_virtual_room( + free_rooms = hotel_room_type_obj.check_availability_room( reservation_id.checkin, reservation_id.checkout, - virtual_room_id=reservation_id.room_type_id.id) + room_type_id=reservation_id.room_type_id.id) if any(free_rooms): new_reservation_id = hotel_reservation_obj.create({ 'room_id': free_rooms[0].id, diff --git a/hotel/wizard/massive_changes.py b/hotel/wizard/massive_changes.py index 2620e6960..601105058 100644 --- a/hotel/wizard/massive_changes.py +++ b/hotel/wizard/massive_changes.py @@ -30,7 +30,7 @@ class MassiveChangesWizard(models.TransientModel): ('0', 'Global'), ('1', 'Virtual Room'), ], string='Applied On', default='0') - # virtual_room_ids = fields.Many2many('hotel.virtual.room', + # room_type_ids = fields.Many2many('hotel.virtual.room', # string="Virtual Rooms") room_type_ids = fields.Many2many('hotel.room.type', string="Room Types") @@ -171,7 +171,7 @@ class MassiveChangesWizard(models.TransientModel): ('date_start', '>=', ndate.strftime(DEFAULT_SERVER_DATE_FORMAT)), ('date_end', '<=', ndate.strftime(DEFAULT_SERVER_DATE_FORMAT)), ('restriction_id', '=', record.restriction_id.id), - ('applied_on', '=', '0_virtual_room'), + ('applied_on', '=', '0_room_type'), ] for room_type in room_types: @@ -189,7 +189,7 @@ class MassiveChangesWizard(models.TransientModel): 'date_end': ndate.strftime(DEFAULT_SERVER_DATE_FORMAT), 'restriction_id': record.restriction_id.id, 'room_type_id': room_type.id, - 'applied_on': '0_virtual_room', + 'applied_on': '0_room_type', }) hotel_room_type_re_it_obj.create(vals) @@ -200,7 +200,7 @@ class MassiveChangesWizard(models.TransientModel): if record.change_no_ota: vals.update({'no_ota': record.no_ota}) if record.change_avail: - cavail = len(hotel_room_type_obj.check_availability_virtual_room( + cavail = len(hotel_room_type_obj.check_availability_room( ndate.strftime(DEFAULT_SERVER_DATETIME_FORMAT), ndate.strftime(DEFAULT_SERVER_DATETIME_FORMAT), room_type_id=room_type.id)) diff --git a/hotel/wizard/massive_changes.xml b/hotel/wizard/massive_changes.xml index 54ad251db..d8d598876 100644 --- a/hotel/wizard/massive_changes.xml +++ b/hotel/wizard/massive_changes.xml @@ -10,7 +10,7 @@ - + diff --git a/hotel/wizard/split_reservation.py b/hotel/wizard/split_reservation.py index e944d2a43..a92e80f4a 100644 --- a/hotel/wizard/split_reservation.py +++ b/hotel/wizard/split_reservation.py @@ -64,7 +64,7 @@ class SplitReservationWizard(models.TransientModel): 'splitted': True, 'price_unit': tprice[1], 'parent_reservation': parent_res.id, - 'virtual_room_id': parent_res.virtual_room_id.id, + 'room_type_id': parent_res.room_type_id.id, 'discount': parent_res.discount, }) reservation_copy = self.env['hotel.reservation'].create(vals) diff --git a/hotel_calendar/models/__init__.py b/hotel_calendar/models/__init__.py index 49d1e3b7a..e5d773b59 100644 --- a/hotel_calendar/models/__init__.py +++ b/hotel_calendar/models/__init__.py @@ -9,8 +9,8 @@ from . import hotel_calendar_management from . import res_config from . import inherited_hotel_room from . import inherited_hotel_room_type -from . import inherited_hotel_virtual_room_restriction_item -from . import inherited_hotel_virtual_room_availability +from . import inherited_hotel_room_type_restriction_item +from . import inherited_hotel_room_type_availability from . import inherited_product_pricelist from . import inherited_hotel_folio from . import inherited_ir_default diff --git a/hotel_calendar/models/hotel_calendar_management.py b/hotel_calendar/models/hotel_calendar_management.py index 7d6908ed9..c15504142 100644 --- a/hotel_calendar/models/hotel_calendar_management.py +++ b/hotel_calendar/models/hotel_calendar_management.py @@ -35,11 +35,11 @@ class HotelCalendarManagement(models.TransientModel): return vals @api.model - def _get_availability_values(self, avail, vroom): - vroom_obj = self.env['hotel.room.type'] - cavail = len(vroom_obj.check_availability_virtual_room( - avail['date'], avail['date'], virtual_room_id=vroom.id)) - ravail = min(cavail, vroom.total_rooms_count, int(avail['avail'])) + def _get_availability_values(self, avail, room_type): + room_type_obj = self.env['hotel.room.type'] + cavail = len(room_type_obj.check_availability_room( + avail['date'], avail['date'], room_type_id=room_type.id)) + ravail = min(cavail, room_type.total_rooms_count, int(avail['avail'])) vals = { 'no_ota': avail['no_ota'], 'avail': ravail, @@ -49,15 +49,15 @@ class HotelCalendarManagement(models.TransientModel): @api.multi def save_changes(self, pricelist_id, restriction_id, pricelist, restrictions, availability): - vroom_obj = self.env['hotel.room.type'] + room_type_obj = self.env['hotel.room.type'] product_pricelist_item_obj = self.env['product.pricelist.item'] - vroom_rest_item_obj = self.env['hotel.room.type.restriction.item'] - vroom_avail_obj = self.env['hotel.room.type.availability'] + room_type_rest_item_obj = self.env['hotel.room.type.restriction.item'] + room_type_avail_obj = self.env['hotel.room.type.availability'] # Save Pricelist for k_price in pricelist.keys(): - vroom_id = vroom_obj.browse([int(k_price)]) - vroom_prod_tmpl_id = vroom_id.product_id.product_tmpl_id + room_type_id = room_type_obj.browse([int(k_price)]) + room_type_prod_tmpl_id = room_type_id.product_id.product_tmpl_id for price in pricelist[k_price]: price_id = product_pricelist_item_obj.search([ ('date_start', '>=', price['date']), @@ -65,7 +65,7 @@ class HotelCalendarManagement(models.TransientModel): ('pricelist_id', '=', int(pricelist_id)), ('applied_on', '=', '1_product'), ('compute_price', '=', 'fixed'), - ('product_tmpl_id', '=', vroom_prod_tmpl_id.id), + ('product_tmpl_id', '=', room_type_prod_tmpl_id.id), ], limit=1) vals = self._get_prices_values(price) if not price_id: @@ -75,7 +75,7 @@ class HotelCalendarManagement(models.TransientModel): 'pricelist_id': int(pricelist_id), 'applied_on': '1_product', 'compute_price': 'fixed', - 'product_tmpl_id': vroom_prod_tmpl_id.id, + 'product_tmpl_id': room_type_prod_tmpl_id.id, }) price_id = product_pricelist_item_obj.create(vals) else: @@ -84,12 +84,12 @@ class HotelCalendarManagement(models.TransientModel): # Save Restrictions for k_res in restrictions.keys(): for restriction in restrictions[k_res]: - res_id = vroom_rest_item_obj.search([ + res_id = room_type_rest_item_obj.search([ ('date_start', '>=', restriction['date']), ('date_end', '<=', restriction['date']), ('restriction_id', '=', int(restriction_id)), - ('applied_on', '=', '0_virtual_room'), - ('virtual_room_id', '=', int(k_res)), + ('applied_on', '=', '0_room_type'), + ('room_type_id', '=', int(k_res)), ], limit=1) vals = self._get_restrictions_values(restriction) if not res_id: @@ -97,28 +97,28 @@ class HotelCalendarManagement(models.TransientModel): 'date_start': restriction['date'], 'date_end': restriction['date'], 'restriction_id': int(restriction_id), - 'applied_on': '0_virtual_room', - 'virtual_room_id': int(k_res), + 'applied_on': '0_room_type', + 'room_type_id': int(k_res), }) - res_id = vroom_rest_item_obj.create(vals) + res_id = room_type_rest_item_obj.create(vals) else: res_id.write(vals) # Save Availability for k_avail in availability.keys(): - vroom_id = vroom_obj.browse(int(k_avail)) + room_type_id = room_type_obj.browse(int(k_avail)) for avail in availability[k_avail]: - vals = self._get_availability_values(avail, vroom_id) - avail_id = vroom_avail_obj.search([ + vals = self._get_availability_values(avail, room_type_id) + avail_id = room_type_avail_obj.search([ ('date', '=', avail['date']), - ('virtual_room_id', '=', vroom_id.id), + ('room_type_id', '=', room_type_id.id), ], limit=1) if not avail_id: vals.update({ 'date': avail['date'], - 'virtual_room_id': vroom_id.id, + 'room_type_id': room_type_id.id, }) - avail_id = vroom_avail_obj.with_context({ + avail_id = room_type_avail_obj.with_context({ 'mail_create_nosubscribe': True, }).create(vals) else: @@ -140,16 +140,16 @@ class HotelCalendarManagement(models.TransientModel): @api.model def _hcalendar_pricelist_json_data(self, prices): json_data = {} - vroom_obj = self.env['hotel.room.type'] + room_type_obj = self.env['hotel.room.type'] for rec in prices: - virtual_room_id = vroom_obj.search([ + room_type_id = room_type_obj.search([ ('product_id.product_tmpl_id', '=', rec.product_tmpl_id.id) ], limit=1) - if not virtual_room_id: + if not room_type_id: continue # TODO: date_end - date_start loop - json_data.setdefault(virtual_room_id.id, []).append({ + json_data.setdefault(room_type_id.id, []).append({ 'id': rec.id, 'price': rec.fixed_price, 'date': rec.date_start, @@ -161,7 +161,7 @@ class HotelCalendarManagement(models.TransientModel): json_data = {} for rec in restrictions: # TODO: date_end - date_start loop - json_data.setdefault(rec.virtual_room_id.id, []).append({ + json_data.setdefault(rec.room_type_id.id, []).append({ 'id': rec.id, 'date': rec.date_start, 'min_stay': rec.min_stay, @@ -178,30 +178,30 @@ class HotelCalendarManagement(models.TransientModel): def _hcalendar_availability_json_data(self, dfrom, dto): date_start = date_utils.get_datetime(dfrom, hours=False) date_diff = date_utils.date_diff(dfrom, dto, hours=False) + 1 - vrooms = self.env['hotel.room.type'].search([]) + room_types = self.env['hotel.room.type'].search([]) json_data = {} - for vroom in vrooms: - json_data[vroom.id] = [] + for room_type in room_types: + json_data[room_type.id] = [] for i in range(0, date_diff): cur_date = date_start + timedelta(days=i) cur_date_str = cur_date.strftime(DEFAULT_SERVER_DATE_FORMAT) avail = self.env['hotel.room.type.availability'].search([ ('date', '=', cur_date_str), - ('virtual_room_id', '=', vroom.id) + ('room_type_id', '=', room_type.id) ]) if avail: - json_data[vroom.id].append({ + json_data[room_type.id].append({ 'id': avail.id, 'date': avail.date, 'avail': avail.avail, 'no_ota': avail.no_ota, }) else: - json_data[vroom.id].append({ + json_data[room_type.id].append({ 'id': False, 'date': cur_date_str, - 'avail': vroom.max_real_rooms, + 'avail': room_type.max_real_rooms, 'no_ota': False, }) return json_data @@ -239,25 +239,24 @@ class HotelCalendarManagement(models.TransientModel): @api.model def _hcalendar_get_count_reservations_json_data(self, dfrom, dto): - vrooms = self.env['hotel.room.type'].search([]) date_start = date_utils.get_datetime(dfrom, hours=False) date_diff = date_utils.date_diff(dfrom, dto, hours=False) + 1 - hotel_vroom_obj = self.env['hotel.room.type'] - vrooms = hotel_vroom_obj.search([]) + room_type_obj = self.env['hotel.room.type'] + room_types = room_type_obj.search([]) json_data = {} - for vroom in vrooms: + for room_type in room_types: for i in range(0, date_diff): cur_date = date_start + timedelta(days=i) cur_date_str = cur_date.strftime(DEFAULT_SERVER_DATE_FORMAT) - json_data.setdefault(vroom.id, []).append({ + json_data.setdefault(room_type.id, []).append({ 'date': cur_date_str, 'num': len( - hotel_vroom_obj.check_availability_virtual_room( + room_type_obj.check_availability_room( cur_date_str, cur_date_str, - virtual_room_id=vroom.id)), + room_type_id=room_type.id)), }) return json_data @@ -280,11 +279,11 @@ class HotelCalendarManagement(models.TransientModel): restriction_id = int(restriction_id) vals.update({'restriction_id': restriction_id}) - vroom_rest_it_obj = self.env['hotel.room.type.restriction.item'] - restriction_item_ids = vroom_rest_it_obj.search([ + room_type_rest_it_obj = self.env['hotel.room.type.restriction.item'] + restriction_item_ids = room_type_rest_it_obj.search([ ('date_start', '>=', dfrom), ('date_end', '<=', dto), ('restriction_id', '=', restriction_id), - ('applied_on', '=', '0_virtual_room'), + ('applied_on', '=', '0_room_type'), ]) pricelist_item_ids = self.env['product.pricelist.item'].search([ diff --git a/hotel_calendar/models/inherited_hotel_reservation.py b/hotel_calendar/models/inherited_hotel_reservation.py index 934bdb7d0..545e5f28b 100644 --- a/hotel_calendar/models/inherited_hotel_reservation.py +++ b/hotel_calendar/models/inherited_hotel_reservation.py @@ -64,7 +64,6 @@ class HotelReservation(models.Model): if pricelist_id: pricelist_id = int(pricelist_id) json_rooms = [] - room_type_obj = self.env['hotel.room.type'] for room in rooms: json_rooms.append(( room.id, @@ -168,20 +167,20 @@ class HotelReservation(models.Model): date_diff = date_utils.date_diff(dfrom, dto, hours=False) + 1 # Get Prices json_rooms_rests = {} - room_type_ids = self.env['hotel.room.type'].search( + room_types = self.env['hotel.room.type'].search( [], order='hcal_sequence ASC') - vroom_rest_obj = self.env['hotel.room.type.restriction.item'] - for room_type_id in room_type_ids: + room_type_rest_obj = self.env['hotel.room.type.restriction.item'] + for room_type in room_types: days = {} for i in range(0, date_diff): ndate = date_start + timedelta(days=i) ndate_str = ndate.strftime(DEFAULT_SERVER_DATE_FORMAT) - rest_id = vroom_rest_obj.search([ - ('room_type_id', '=', room_type_id.id), + rest_id = room_type_rest_obj.search([ + ('room_type_id', '=', room_type.id), ('date_start', '>=', ndate_str), ('date_end', '<=', ndate_str), - ('applied_on', '=', '0_virtual_room'), + ('applied_on', '=', '0_room_type'), ('restriction_id', '=', restriction_id) ], limit=1) if rest_id and (rest_id.min_stay or rest_id.min_stay_arrival or @@ -198,7 +197,7 @@ class HotelReservation(models.Model): rest_id.closed_arrival, rest_id.closed_departure) }) - json_rooms_rests.update({room_type_id.id: days}) + json_rooms_rests.update({room_type.id: days}) return json_rooms_rests @api.model diff --git a/hotel_calendar/models/inherited_hotel_virtual_room_availability.py b/hotel_calendar/models/inherited_hotel_room_type_availability.py similarity index 84% rename from hotel_calendar/models/inherited_hotel_virtual_room_availability.py rename to hotel_calendar/models/inherited_hotel_room_type_availability.py index 46072c64b..bccdf91c2 100644 --- a/hotel_calendar/models/inherited_hotel_virtual_room_availability.py +++ b/hotel_calendar/models/inherited_hotel_room_type_availability.py @@ -3,7 +3,7 @@ from odoo import models, fields, api -class HotelVirtualRoomAvailability(models.Model): +class HotelRoomTypeAvailability(models.Model): _inherit = 'hotel.room.type.availability' @api.model @@ -13,7 +13,7 @@ class HotelVirtualRoomAvailability(models.Model): 'date': res.date, 'avail': res.avail, 'no_ota': res.no_ota, - 'virtual_room_id': res.virtual_room_id.id, + 'room_type_id': res.room_type_id.id, 'id': res.id, }) return res @@ -27,7 +27,7 @@ class HotelVirtualRoomAvailability(models.Model): 'date': record.date, 'avail': record.avail, 'no_ota': record.no_ota, - 'virtual_room_id': record.virtual_room_id.id, + 'room_type_id': record.room_type_id.id, 'id': record.id, }) return ret_vals @@ -39,8 +39,8 @@ class HotelVirtualRoomAvailability(models.Model): for record in self: unlink_vals.append({ 'date': record.date, - 'avail': record.virtual_room_id.max_real_rooms, - 'virtual_room_id': record.virtual_room_id.id, + 'avail': record.room_type_id.max_real_rooms, + 'room_type_id': record.room_type_id.id, 'no_ota': False, 'id': record.id, }) diff --git a/hotel_calendar/models/inherited_hotel_virtual_room_restriction_item.py b/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py similarity index 89% rename from hotel_calendar/models/inherited_hotel_virtual_room_restriction_item.py rename to hotel_calendar/models/inherited_hotel_room_type_restriction_item.py index 3c7468dcb..cfab8f697 100644 --- a/hotel_calendar/models/inherited_hotel_virtual_room_restriction_item.py +++ b/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py @@ -5,7 +5,7 @@ from odoo import models, fields, api _logger = logging.getLogger(__name__) -class HotelVirtualRoomResrtrictionItem(models.Model): +class HotelRoomTypeResrtrictionItem(models.Model): _inherit = 'hotel.room.type.restriction.item' @api.model @@ -17,7 +17,7 @@ class HotelVirtualRoomResrtrictionItem(models.Model): restrictions_parity_id = int(restrictions_parity_id) restriction_id = res.restriction_id.id if restriction_id == restrictions_parity_id and \ - self.applied_on == '0_virtual_room': + self.applied_on == '0_room_type': self.env['bus.hotel.calendar'].send_restriction_notification({ 'restriction_id': self.restriction_id.id, 'date': self.date_start, @@ -28,7 +28,7 @@ class HotelVirtualRoomResrtrictionItem(models.Model): 'closed': self.closed, 'closed_departure': self.closed_departure, 'closed_arrival': self.closed_arrival, - 'virtual_room_id': self.virtual_room_id.id, + 'room_type_id': self.room_type_id.id, 'id': self.id, }) return res @@ -44,7 +44,7 @@ class HotelVirtualRoomResrtrictionItem(models.Model): bus_hotel_calendar_obj = self.env['bus.hotel.calendar'] for record in self: if record.restriction_id.id != restrictions_parity_id or \ - record.applied_on != '0_virtual_room': + record.applied_on != '0_room_type': continue bus_hotel_calendar_obj.send_restriction_notification({ 'restriction_id': record.restriction_id.id, @@ -56,7 +56,7 @@ class HotelVirtualRoomResrtrictionItem(models.Model): 'closed': record.closed, 'closed_departure': record.closed_departure, 'closed_arrival': record.closed_arrival, - 'virtual_room_id': record.virtual_room_id.id, + 'room_type_id': record.room_type_id.id, 'id': record.id, }) return ret_vals @@ -71,7 +71,7 @@ class HotelVirtualRoomResrtrictionItem(models.Model): unlink_vals = [] for record in self: if record.restriction_id.id != restrictions_parity_id or \ - record.applied_on != '0_virtual_room': + record.applied_on != '0_room_type': continue unlink_vals.append({ 'restriction_id': record.restriction_id.id, @@ -83,7 +83,7 @@ class HotelVirtualRoomResrtrictionItem(models.Model): 'closed': False, 'closed_departure': False, 'closed_arrival': False, - 'virtual_room_id': record.virtual_room_id.id, + 'room_type_id': record.room_type_id.id, 'id': record.id, }) res = super(HotelVirtualRoomResrtrictionItem, self).unlink() diff --git a/hotel_calendar/models/inherited_ir_default.py b/hotel_calendar/models/inherited_ir_default.py index fcb710712..1860de97f 100644 --- a/hotel_calendar/models/inherited_ir_default.py +++ b/hotel_calendar/models/inherited_ir_default.py @@ -18,19 +18,19 @@ class IrDefault(models.Model): pricelist_items = self.env['product.pricelist.item'].search([ ('pricelist_id', '=', pricelist_id) ]) - vroom_obj = self.env['hotel.room.type'] - vroom_pr_cached_obj = self.env['room.pricelist.cached'] + room_type_obj = self.env['hotel.room.type'] + room_pr_cached_obj = self.env['room.pricelist.cached'] for pitem in pricelist_items: date_start = pitem.date_start product_tmpl_id = pitem.product_tmpl_id.id fixed_price = pitem.fixed_price - vroom = vroom_obj.search([ + room_type = room_type_obj.search([ ('product_id.product_tmpl_id', '=', product_tmpl_id), ('date_start', '>=', date_utils.now().strftime( DEFAULT_SERVER_DATETIME_FORMAT)) ], limit=1) - vroom_pr_cached_obj.create({ - 'virtual_room_id': vroom.id, + room_pr_cached_obj.create({ + 'room_type_id': room_type.id, 'date': date_start, 'price': fixed_price, }) diff --git a/hotel_calendar/models/inherited_product_pricelist_item.py b/hotel_calendar/models/inherited_product_pricelist_item.py index af76d6538..5489bc22c 100644 --- a/hotel_calendar/models/inherited_product_pricelist_item.py +++ b/hotel_calendar/models/inherited_product_pricelist_item.py @@ -19,7 +19,7 @@ class ProductPricelistItem(models.Model): room_type = self.env['hotel.room.type'].search([ ('product_id.product_tmpl_id', '=', product_tmpl_id) ], limit=1) - if pricelist_id == pricelist_parity_id and vroom: + if pricelist_id == pricelist_parity_id and room_type: prod = room_type.product_id.with_context( quantity=1, date=date_start, @@ -88,12 +88,12 @@ class ProductPricelistItem(models.Model): 'id': record.id, }) - vroom_pr_cached_id = room_pr_cached_obj.search([ + room_pr_cached_id = room_pr_cached_obj.search([ ('room_id', '=', room_type.id), ('date', '=', date_start), ], limit=1) - if vroom_pr_cached_id: - vroom_pr_cached_id.write({'price': prod_price}) + if room_pr_cached_id: + room_pr_cached_id.write({'price': prod_price}) else: room_pr_cached_obj.create({ 'room_id': room_type.id, diff --git a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_model.js b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_model.js index 5e3415781..acf83ac48 100644 --- a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_model.js +++ b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_model.js @@ -60,7 +60,7 @@ return AbstractModel.extend({ return this._rpc({ model: 'hotel.room.type', method: 'search_read', - args: [false, ['cat_id','name']], + args: [false, ['id','name']], context: Session.user_context, }); }, diff --git a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_controller.js b/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_controller.js index 6ed969790..9788baa00 100644 --- a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_controller.js +++ b/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_controller.js @@ -71,7 +71,7 @@ var MPMSCalendarController = AbstractController.extend({ self.renderer._days_tooltips = results['events']; var rooms = []; for (var r of results['rooms']) { - var nroom = new HVRoom( + var nroom = new HRoomType( r[0], // Id r[1], // Name r[2], // Capacity @@ -112,15 +112,15 @@ var MPMSCalendarController = AbstractController.extend({ switch (notif[1]['type']) { case 'availability': var avail = notif[1]['availability']; - var vroom = Object.keys(avail)[0]; - var day = Object.keys(avail[vroom])[0]; + var room_type = Object.keys(avail)[0]; + var day = Object.keys(avail[room_type])[0]; var dt = HotelCalendarManagement.toMoment(day); var availability = {}; - availability[vroom] = [{ + availability[room_type] = [{ 'date': dt.format(ODOO_DATE_MOMENT_FORMAT), - 'avail': avail[vroom][day][0], - 'no_ota': avail[vroom][day][1], - 'id': avail[vroom][day][2] + 'avail': avail[room_type][day][0], + 'no_ota': avail[room_type][day][1], + 'id': avail[room_type][day][2] }]; this.renderer._hcalendar.addAvailability(availability); break; @@ -143,22 +143,22 @@ var MPMSCalendarController = AbstractController.extend({ this.renderer._hcalendar.addPricelist(pr); break; case 'restriction': - // FIXME: Expected one day and one vroom + // FIXME: Expected one day and one room_type var restriction = notif[1]['restriction']; - var vroom = Object.keys(restriction)[0]; - var day = Object.keys(restriction[vroom])[0]; + var room_type = Object.keys(restriction)[0]; + var day = Object.keys(restriction[room_type])[0]; var dt = HotelCalendarManagement.toMoment(day); var rest = {}; - rest[vroom] = [{ + rest[room_type] = [{ 'date': dt.format(ODOO_DATE_MOMENT_FORMAT), - 'min_stay': restriction[vroom][day][0], - 'min_stay_arrival': restriction[vroom][day][1], - 'max_stay': restriction[vroom][day][2], - 'max_stay_arrival': restriction[vroom][day][3], - 'closed': restriction[vroom][day][4], - 'closed_arrival': restriction[vroom][day][5], - 'closed_departure': restriction[vroom][day][6], - 'id': restriction[vroom][day][7] + 'min_stay': restriction[room_type][day][0], + 'min_stay_arrival': restriction[room_type][day][1], + 'max_stay': restriction[room_type][day][2], + 'max_stay_arrival': restriction[room_type][day][3], + 'closed': restriction[room_type][day][4], + 'closed_arrival': restriction[room_type][day][5], + 'closed_departure': restriction[room_type][day][6], + 'id': restriction[room_type][day][7] }]; this.renderer._hcalendar.addRestrictions(rest); break; diff --git a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js b/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js index d3782fa15..686f362f7 100644 --- a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js +++ b/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js @@ -132,7 +132,7 @@ var HotelCalendarManagementView = AbstractRenderer.extend({ this._hcalendar = new HotelCalendarManagement('#hcal_management_widget', options, this.$el[0]); this._assignHCalendarEvents(); - this.$CalendarHeaderDays = this.$el.find("div.table-vroom-data-header"); + this.$CalendarHeaderDays = this.$el.find("div.table-room_type-data-header"); // Sticky Header Days this.$ehcal.scroll(this._on_scroll.bind(this)); @@ -409,7 +409,7 @@ var HotelCalendarManagementView = AbstractRenderer.extend({ self._assign_extra_info(); }); this._last_dates = params['dates']; - this.$CalendarHeaderDays = this.$el.find("div.table-vroom-data-header"); + this.$CalendarHeaderDays = this.$el.find("div.table-room_type-data-header"); this._on_scroll(); // FIXME: Workaround for update sticky header }, diff --git a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js b/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js index 4611a1d36..0b65bfbb7 100644 --- a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js +++ b/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js @@ -173,7 +173,7 @@ var HotelCalendarManagementView = View.extend({ } }); - this.$CalendarHeaderDays = this.$el.find("div.table-vroom-data-header"); + this.$CalendarHeaderDays = this.$el.find("div.table-room_type-data-header"); // Sticky Header Days this.$ehcal.scroll(this._on_scroll.bind(this)); @@ -204,7 +204,7 @@ var HotelCalendarManagementView = View.extend({ self._days_tooltips = results['events']; var rooms = []; for (var r of results['rooms']) { - var nroom = new HVRoom( + var nroom = new HRoomType( r[0], // Id r[1], // Name r[2], // Capacity @@ -478,15 +478,15 @@ var HotelCalendarManagementView = View.extend({ switch (notif[1]['type']) { case 'availability': var avail = notif[1]['availability']; - var vroom = Object.keys(avail)[0]; - var day = Object.keys(avail[vroom])[0]; + var room_type = Object.keys(avail)[0]; + var day = Object.keys(avail[room_type])[0]; var dt = HotelCalendarManagement.toMoment(day); var availability = {}; - availability[vroom] = [{ + availability[room_type] = [{ 'date': dt.format(ODOO_DATE_MOMENT_FORMAT), - 'avail': avail[vroom][day][0], - 'no_ota': avail[vroom][day][1], - 'id': avail[vroom][day][2] + 'avail': avail[room_type][day][0], + 'no_ota': avail[room_type][day][1], + 'id': avail[room_type][day][2] }]; this._hcalendar.addAvailability(availability); break; @@ -509,22 +509,22 @@ var HotelCalendarManagementView = View.extend({ this._hcalendar.addPricelist(pr); break; case 'restriction': - // FIXME: Expected one day and one vroom + // FIXME: Expected one day and one room_type var restriction = notif[1]['restriction']; - var vroom = Object.keys(restriction)[0]; - var day = Object.keys(restriction[vroom])[0]; + var room_type = Object.keys(restriction)[0]; + var day = Object.keys(restriction[room_type])[0]; var dt = HotelCalendarManagement.toMoment(day); var rest = {}; - rest[vroom] = [{ + rest[room_type] = [{ 'date': dt.format(ODOO_DATE_MOMENT_FORMAT), - 'min_stay': restriction[vroom][day][0], - 'min_stay_arrival': restriction[vroom][day][1], - 'max_stay': restriction[vroom][day][2], - 'max_stay_arrival': restriction[vroom][day][3], - 'closed': restriction[vroom][day][4], - 'closed_arrival': restriction[vroom][day][5], - 'closed_departure': restriction[vroom][day][6], - 'id': restriction[vroom][day][7] + 'min_stay': restriction[room_type][day][0], + 'min_stay_arrival': restriction[room_type][day][1], + 'max_stay': restriction[room_type][day][2], + 'max_stay_arrival': restriction[room_type][day][3], + 'closed': restriction[room_type][day][4], + 'closed_arrival': restriction[room_type][day][5], + 'closed_departure': restriction[room_type][day][6], + 'id': restriction[room_type][day][7] }]; this._hcalendar.addRestrictions(rest); break; @@ -543,7 +543,7 @@ var HotelCalendarManagementView = View.extend({ self._assign_extra_info(); }); this._last_dates = params['dates']; - this.$CalendarHeaderDays = this.$el.find("div.table-vroom-data-header"); + this.$CalendarHeaderDays = this.$el.find("div.table-room_type-data-header"); this._on_scroll(); // FIXME: Workaround for update sticky header }, diff --git a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js index 4432ec0ab..c7c260b72 100644 --- a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js +++ b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js @@ -690,8 +690,8 @@ HotelCalendar.prototype = { }, addRestrictions: function(/*Object*/restrictions) { - var vroom_ids = Object.keys(restrictions); - for (var vid of vroom_ids) { + var room_type_ids = Object.keys(restrictions); + for (var vid of room_type_ids) { if (vid in this._restrictions) { this._restrictions[vid] = _.extend(this._restrictions[vid], restrictions[vid]); } @@ -1276,7 +1276,7 @@ HotelCalendar.prototype = { row = tbody.insertRow(); row.setAttribute('id', this._sanitizeId(`ROW_DETAIL_PRICE_ROOM_${key}_${listitem.room}`)); row.dataset.hcalPricelist = key; - row.dataset.hcalVRoomId = listitem.room + row.dataset.hcalRoomTypeId = listitem.room row.classList.add('hcal-row-detail-room-price-group-item'); cell = row.insertCell(); var span = document.createElement('span'); @@ -1306,7 +1306,7 @@ HotelCalendar.prototype = { input.setAttribute('id', this._sanitizeId(`INPUT_PRICE_${key}_${listitem.room}_${dd_local.format(HotelCalendar.DATE_FORMAT_SHORT_)}`)); input.setAttribute('type', 'edit'); input.setAttribute('title', 'Price'); - input.setAttribute('name', 'vroom_price_day'); + input.setAttribute('name', 'room_type_price_day'); input.dataset.hcalParentCell = cell.getAttribute('id'); var dd_fmrt = dd_local.format(HotelCalendar.DATE_FORMAT_SHORT_); input.dataset.orgValue = input.value = _.has(listitem['days'], dd_fmrt)?Number(listitem['days'][dd_fmrt]).toLocaleString():'...'; @@ -1335,8 +1335,8 @@ HotelCalendar.prototype = { var orgValue = input.dataset.orgValue; var parentCell = this.edtable.querySelector(`#${input.dataset.hcalParentCell}`); var parentRow = this.edtable.querySelector(`#${parentCell.dataset.hcalParentRow}`); - if (!(parentRow.dataset.hcalVRoomId in data)) { data[parentRow.dataset.hcalVRoomId] = []; } - data[parentRow.dataset.hcalVRoomId].push({ + if (!(parentRow.dataset.hcalRoomTypeId in data)) { data[parentRow.dataset.hcalRoomTypeId] = []; } + data[parentRow.dataset.hcalRoomTypeId].push({ 'date': HotelCalendar.toMoment(parentCell.dataset.hcalDate).format('YYYY-MM-DD'), 'price': value }); @@ -2107,13 +2107,13 @@ HotelCalendar.prototype = { this._updatePriceList(); }, - updateVRoomPrice: function(pricelist_id, vroom_id, date, price) { + updateRoomTypePrice: function(pricelist_id, room_type_id, date, price) { var strDate = date.format(HotelCalendar.DATE_FORMAT_SHORT_); - var cellId = this._sanitizeId(`CELL_PRICE_${pricelist_id}_${vroom_id}_${strDate}`); + var cellId = this._sanitizeId(`CELL_PRICE_${pricelist_id}_${room_type_id}_${strDate}`); var input = this.edtable.querySelector(`#${cellId} input`); if (input) { input.dataset.orgValue = input.value = price; - var pr_fk = _.findKey(this._pricelist[pricelist_id], {'room': vroom_id}); + var pr_fk = _.findKey(this._pricelist[pricelist_id], {'room': room_type_id}); this._pricelist[pricelist_id][pr_fk].days[strDate] = price; } }, @@ -2289,7 +2289,7 @@ HotelCalendar.prototype = { var orgValue = elm.dataset.orgValue; var name = elm.getAttribute('name'); - if (name === 'vroom_price_day') { + if (name === 'room_type_price_day') { if (!this._isNumeric(value)) { elm.style.backgroundColor = 'red'; } else if (orgValue !== value) { @@ -2306,13 +2306,13 @@ HotelCalendar.prototype = { var parentCell = this.edtable.querySelector(`#${elm.dataset.hcalParentCell}`); var parentRow = this.edtable.querySelector(`#${parentCell.dataset.hcalParentRow}`); var vals = { - 'vroom_id': +parentRow.dataset.hcalVRoomId, + 'room_type_id': +parentRow.dataset.hcalRoomTypeId, 'date': HotelCalendar.toMoment(parentCell.dataset.hcalDate), 'price': value, 'old_price': orgValue, 'pricelist_id': +parentRow.dataset.hcalPricelist }; - //this.updateVRoomPrice(vals['pricelist_id'], vals['vroom_id'], vals['date'], vals['price']); + //this.updateRoomTypePrice(vals['pricelist_id'], vals['room_type_id'], vals['date'], vals['price']); this._dispatchEvent('hcalOnPricelistChanged', vals); if (this.edivc.querySelector('.hcal-input-changed') !== null) diff --git a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js index cd6dcd1e4..c7406cc19 100644 --- a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js +++ b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js @@ -74,7 +74,7 @@ function HotelCalendarManagement(/*String*/querySelector, /*Dictionary*/options, }; // Check correct values - if (this.options.rooms.length > 0 && !(this.options.rooms[0] instanceof HVRoom)) { + if (this.options.rooms.length > 0 && !(this.options.rooms[0] instanceof HRoomType)) { this.options.rooms = []; console.warn("[Hotel Calendar Management][init] Invalid Room definiton!"); } @@ -397,9 +397,9 @@ HotelCalendarManagement.prototype = { this.e.removeChild(this.e.lastChild); } - // VRoom Names + // RoomType Names this.edivrhl = document.createElement("div"); - this.edivrhl.classList.add('table-vrooms'); + this.edivrhl.classList.add('table-room_types'); this.e.appendChild(this.edivrhl); this.etableRooms = document.createElement("table"); this.etableRooms.classList.add('hcal-management-table'); @@ -412,7 +412,7 @@ HotelCalendarManagement.prototype = { this.e.appendChild(this.edivm); // Days this.edivrh = document.createElement("div"); - this.edivrh.classList.add('table-vroom-data-header'); + this.edivrh.classList.add('table-room_type-data-header'); this.edivm.appendChild(this.edivrh); this.etableHeader = document.createElement("table"); this.etableHeader.classList.add('hcal-management-table'); @@ -420,7 +420,7 @@ HotelCalendarManagement.prototype = { this.edivrh.appendChild(this.etableHeader); // Data this.edivr = document.createElement("div"); - this.edivr.classList.add('table-vroom-data'); + this.edivr.classList.add('table-room_type-data'); this.edivm.appendChild(this.edivr); this.etable = document.createElement("table"); this.etable.classList.add('hcal-management-table'); @@ -503,8 +503,8 @@ HotelCalendarManagement.prototype = { //==== PRICELIST addPricelist: function(/*Object*/pricelist) { - var vroom_ids = Object.keys(pricelist); - for (var vid of vroom_ids) { + var room_type_ids = Object.keys(pricelist); + for (var vid of room_type_ids) { if (vid in this._pricelist) { for (var price of pricelist[vid]) { var index = _.findIndex(this._pricelist[vid], {date: price['date']}); @@ -524,10 +524,10 @@ HotelCalendarManagement.prototype = { _updatePriceList: function() { var keys = Object.keys(this._pricelist); - for (var vroomId of keys) { - for (var price of this._pricelist[vroomId]) { + for (var room_typeId of keys) { + for (var price of this._pricelist[room_typeId]) { var dd = HotelCalendarManagement.toMoment(price.date, this.options.dateFormatShort); - var inputId = this._sanitizeId(`PRICE_${vroomId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`); + var inputId = this._sanitizeId(`PRICE_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`); var input = this.etable.querySelector(`#${inputId}`); if (input && !input.classList.contains('hcal-management-input-changed')) { input.dataset.orgValue = price.price; @@ -559,8 +559,8 @@ HotelCalendarManagement.prototype = { //==== RESTRICTIONS addRestrictions: function(/*Object*/restrictions) { - var vroom_ids = Object.keys(restrictions); - for (var vid of vroom_ids) { + var room_type_ids = Object.keys(restrictions); + for (var vid of room_type_ids) { if (vid in this._restrictions) { for (var rest of restrictions[vid]) { var index = _.findIndex(this._restrictions[vid], {date: rest['date']}); @@ -580,15 +580,15 @@ HotelCalendarManagement.prototype = { _updateRestrictions: function() { var keys = Object.keys(this._restrictions); - for (var vroomId of keys) { - var room = this.getRoom(vroomId); - for (var restriction of this._restrictions[vroomId]) { + for (var room_typeId of keys) { + var room = this.getRoom(room_typeId); + for (var restriction of this._restrictions[room_typeId]) { var dd = HotelCalendarManagement.toMoment(restriction.date, this.options.dateFormatShort); var inputIds = [ - this._sanitizeId(`MIN_STAY_${vroomId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`), restriction.min_stay, - this._sanitizeId(`MIN_STAY_ARRIVAL_${vroomId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`), restriction.min_stay_arrival, - this._sanitizeId(`MAX_STAY_${vroomId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`), restriction.max_stay, - this._sanitizeId(`MAX_STAY_ARRIVAL_${vroomId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`), restriction.max_stay_arrival, + this._sanitizeId(`MIN_STAY_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`), restriction.min_stay, + this._sanitizeId(`MIN_STAY_ARRIVAL_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`), restriction.min_stay_arrival, + this._sanitizeId(`MAX_STAY_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`), restriction.max_stay, + this._sanitizeId(`MAX_STAY_ARRIVAL_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`), restriction.max_stay_arrival, ]; for (var i=0; i - + hotel.room.type diff --git a/hotel_calendar/wizard/wizard_reservation.py b/hotel_calendar/wizard/wizard_reservation.py index f4764b18e..d7a21cbaf 100644 --- a/hotel_calendar/wizard/wizard_reservation.py +++ b/hotel_calendar/wizard/wizard_reservation.py @@ -1,33 +1,11 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2017 Solucións Aloxa S.L. -# Alexandre Díaz -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -############################################################################## -import pytz +# Copyright 2018 Dario Lodeiros +# Copyright 2018 Alexandre Díaz +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import time import logging -from decimal import Decimal -from dateutil.relativedelta import relativedelta -from datetime import datetime, timedelta, date -from openerp.exceptions import except_orm, UserError, ValidationError +from datetime import timedelta +from openerp.exceptions import ValidationError from openerp.tools import ( - misc, DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT) from openerp import models, fields, api, _ @@ -48,7 +26,7 @@ class FolioWizard(models.TransientModel): def _get_default_checkin(self): folio = False default_arrival_hour = self.env['ir.default'].sudo().get( - 'res.config.settings', 'default_arrival_hour') + 'res.config.settings', 'default_arrival_hour') if 'folio_id' in self._context: folio = self.env['hotel.folio'].search([ ('id', '=', self._context['folio_id']) @@ -76,7 +54,7 @@ class FolioWizard(models.TransientModel): ('id', '=', self._context['folio_id']) ]) if folio and folio.room_lines: - return folio.room_lines[0].checkout + return folio.room_lines[0].checkout else: tz_hotel = self.env['ir.default'].sudo().get( 'res.config.settings', 'tz_hotel') @@ -103,8 +81,8 @@ class FolioWizard(models.TransientModel): 'folio_wizard_id', string="Resevations") service_wizard_ids = fields.One2many('hotel.service.wizard', - 'folio_wizard_id', - string='Services') + 'folio_wizard_id', + string='Services') total = fields.Float('Total', compute='_computed_total') confirm = fields.Boolean('Confirm Reservations', default="1") autoassign = fields.Boolean('Autoassign', default="1") @@ -112,25 +90,25 @@ class FolioWizard(models.TransientModel): ('door', 'Door'), ('mail', 'Mail'), ('phone', 'Phone') - ], string='Sales Channel', default=_get_default_channel_type) - virtual_room_wizard_ids = fields.Many2many('hotel.virtual.room.wizard', - string="Virtual Rooms") + ], string='Sales Channel', default=_get_default_channel_type) + room_type_wizard_ids = fields.Many2many('hotel.room.type.wizard', + string="Virtual Rooms") call_center = fields.Boolean(default=_get_default_center_user) def assign_rooms(self): - self.assign=True + self.assign = True @api.onchange('autoassign') def create_reservations(self): self.ensure_one() total = 0 cmds = [] - for line in self.virtual_room_wizard_ids: + for line in self.room_type_wizard_ids: if line.rooms_num == 0: continue if line.rooms_num > line.max_rooms: - raise ValidationError(_("Too many rooms!")) - elif line.virtual_room_id: + raise ValidationError(_("Too many rooms!")) + elif line.room_type_id: checkout_dt = date_utils.get_datetime(line.checkout) occupied = self.env['hotel.reservation'].occupied( line.checkin, @@ -138,15 +116,15 @@ class FolioWizard(models.TransientModel): rooms_occupied = occupied.mapped('product_id.id') free_rooms = self.env['hotel.room'].search([ ('product_id.id', 'not in', rooms_occupied), - ('price_virtual_room.id', '=', line.virtual_room_id.id)], - order='sequence', limit=line.rooms_num) + ('price_room_type.id', '=', line.room_type_id.id) + ], order='sequence', limit=line.rooms_num) room_ids = free_rooms.mapped('product_id.id') product_list = self.env['product.product'].search([ ('id', 'in', room_ids) ]) - nights = days_diff = date_utils.date_diff(line.checkin, - line.checkout, - hours=False) + nights = date_utils.date_diff(line.checkin, + line.checkout, + hours=False) hotel_tz = self.env['ir.default'].sudo().get( 'res.config.settings', 'hotel_tz') @@ -159,11 +137,10 @@ class FolioWizard(models.TransientModel): if pricelist_id: pricelist_id = int(pricelist_id) res_price = 0 - res_partner = self.partner_id or self.env['res.partner'].browse('1') for i in range(0, nights): ndate = start_date_dt + timedelta(days=i) ndate_str = ndate.strftime(DEFAULT_SERVER_DATE_FORMAT) - prod = line.virtual_room_id.product_id.with_context( + prod = line.room_type_id.product_id.with_context( lang=self.partner_id.lang, partner=self.partner_id.id, quantity=1, @@ -177,17 +154,17 @@ class FolioWizard(models.TransientModel): res_price = res_price - (res_price * line.discount)/100 total += res_price cmds.append((0, False, { - 'checkin': line.checkin, - 'checkout': line.checkout, - 'discount': line.discount, - 'product_id': room.id, - 'nights': nights, - 'adults': adults, - 'children': 0, - 'virtual_room_id': line.virtual_room_id, - 'price': res_price, - 'amount_reservation': res_price - })) + 'checkin': line.checkin, + 'checkout': line.checkout, + 'discount': line.discount, + 'product_id': room.id, + 'nights': nights, + 'adults': adults, + 'children': 0, + 'room_type_id': line.room_type_id, + 'price': res_price, + 'amount_reservation': res_price + })) self.reservation_wizard_ids = cmds self.total = total @@ -201,7 +178,6 @@ class FolioWizard(models.TransientModel): @param self: object pointer ''' self.ensure_one() - now_utc_dt = date_utils.now() if not self.checkin: self.checkin = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) if not self.checkout: @@ -217,36 +193,35 @@ class FolioWizard(models.TransientModel): dpt_hour = self.env['ir.default'].sudo().get( 'res.config.settings', 'default_departure_hour') checkout_str = (chkin_utc_dt + timedelta(days=1)).strftime( - DEFAULT_SERVER_DATE_FORMAT) + DEFAULT_SERVER_DATE_FORMAT) checkout_str = "%s %s:00" % (checkout_str, dpt_hour) checkout_dt = date_utils.get_datetime(checkout_str, stz=tz) checkout_utc_dt = date_utils.dt_as_timezone(checkout_dt, 'UTC') - self.checkout = checkout_utc_dt.strftime( - DEFAULT_SERVER_DATETIME_FORMAT) + self.checkout = checkout_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT) checkout_dt = date_utils.get_datetime(self.checkout, stz=tz) # Reservation end day count as free day. Not check it checkout_dt -= timedelta(days=1) - virtual_room_ids = self.env['hotel.room.type'].search([]) - virtual_rooms = [] + room_type_ids = self.env['hotel.room.type'].search([]) + room_types = [] - for virtual in virtual_room_ids: - virtual_rooms.append((0, False, { - 'virtual_room_id': virtual.id, - 'checkin': self.checkin, - 'checkout': self.checkout, - 'folio_wizard_id': self.id, - })) - self.virtual_room_wizard_ids = virtual_rooms - for virtual in self.virtual_room_wizard_ids: - virtual.update_price() + for room_type in room_type_ids: + room_types.append((0, False, { + 'room_type_id': room_type.id, + 'checkin': self.checkin, + 'checkout': self.checkout, + 'folio_wizard_id': self.id, + })) + self.room_type_wizard_ids = room_types + for room_type in self.room_type_wizard_ids: + room_type.update_price() - @api.depends('virtual_room_wizard_ids','reservation_wizard_ids','service_wizard_ids') + @api.depends('room_type_wizard_ids','reservation_wizard_ids','service_wizard_ids') def _computed_total(self): total = 0 for line in self.service_wizard_ids: total += line.price_total if not self.reservation_wizard_ids: - for line in self.virtual_room_wizard_ids: + for line in self.room_type_wizard_ids: total += line.total_price self.total = total else: @@ -258,36 +233,36 @@ class FolioWizard(models.TransientModel): def create_folio(self): self.ensure_one() if not self.partner_id: - raise ValidationError(_("We need know the customer!")) + raise ValidationError(_("We need know the customer!")) reservations = [(5, False, False)] services = [(5, False, False)] if self.autoassign == True: self.create_reservations() for line in self.reservation_wizard_ids: reservations.append((0, False, { - 'product_id': line.product_id.id, - 'adults': line.adults, - 'children': line.children, - 'checkin': line.checkin, - 'checkout': line.checkout, - 'discount': line.discount, - 'virtual_room_id': line.virtual_room_id.id, - 'to_read': line.to_read, #REFACT: wubook module - 'to_assign': line.to_assign, - })) + 'product_id': line.product_id.id, + 'adults': line.adults, + 'children': line.children, + 'checkin': line.checkin, + 'checkout': line.checkout, + 'discount': line.discount, + 'room_type_id': line.room_type_id.id, + 'to_read': line.to_read, #REFACT: wubook module + 'to_assign': line.to_assign, + })) for line in self.service_wizard_ids: services.append((0, False, { - 'product_id': line.product_id.id, - 'discount': line.discount, - 'price_unit': line.price_unit, - 'product_uom_qty': line.product_uom_qty, - })) + 'product_id': line.product_id.id, + 'discount': line.discount, + 'price_unit': line.price_unit, + 'product_uom_qty': line.product_uom_qty, + })) vals = { - 'partner_id': self.partner_id.id, - 'channel_type': self.channel_type, - 'room_lines': reservations, - 'service_lines': services, - } + 'partner_id': self.partner_id.id, + 'channel_type': self.channel_type, + 'room_lines': reservations, + 'service_lines': services, + } newfol = self.env['hotel.folio'].create(vals) for room in newfol.room_lines: room.on_change_checkin_checkout_product_id() @@ -302,8 +277,9 @@ class FolioWizard(models.TransientModel): action = {'type': 'ir.actions.act_window_close'} return action -class VirtualRoomWizars(models.TransientModel): - _name = 'hotel.virtual.room.wizard' + +class HotelRoomTypeWizards(models.TransientModel): + _name = 'hotel.room.type.wizard' @api.multi def _get_default_checkin(self): @@ -313,8 +289,8 @@ class VirtualRoomWizars(models.TransientModel): def _get_default_checkout(self): return self.folio_wizard_id.checkout - virtual_room_id = fields.Many2one('hotel.room.type', - string="Virtual Rooms") + room_type_id = fields.Many2one('hotel.room.type', + string="Virtual Rooms") rooms_num = fields.Integer('Number of Rooms') max_rooms = fields.Integer('Max', compute="_compute_max") price = fields.Float(string='Price by Room') @@ -346,15 +322,15 @@ class VirtualRoomWizars(models.TransientModel): date_end = date_utils.get_datetime(res.checkout) date_diff = date_utils.date_diff(date_start, date_end, hours=False) minstay_restrictions = self.env['hotel.room.type.restriction.item'].search([ - ('virtual_room_id','=',res.virtual_room_id.id), + ('room_type_id','=',res.room_type_id.id), ]) avail_restrictions = self.env['hotel.room.type.availability'].search([ - ('virtual_room_id','=',res.virtual_room_id.id) + ('room_type_id','=',res.room_type_id.id) ]) - real_max = len(res.virtual_room_id.check_availability_virtual_room( - res.checkin, - res.checkout, - res.virtual_room_id.id)) + real_max = len(res.room_type_id.check_availability_room( + res.checkin, + res.checkout, + res.room_type_id.id)) avail = 100000 min_stay = 0 dates = [] @@ -364,67 +340,59 @@ class VirtualRoomWizars(models.TransientModel): dates.append(ndate_str) if minstay_restrictions: date_min_days = minstay_restrictions.filtered( - lambda r: r.date_start <= ndate_str and \ - r.date_end >= ndate_str).min_stay + lambda r: r.date_start <= ndate_str and \ + r.date_end >= ndate_str).min_stay if date_min_days > min_stay: min_stay = date_min_days if user.has_group('hotel.group_hotel_call'): if avail_restrictions: max_avail = avail_restrictions.filtered( - lambda r: r.date == ndate_str).wmax_avail + lambda r: r.date == ndate_str).wmax_avail if max_avail < avail: avail = min(max_avail, real_max) else: avail = real_max - if avail < 100000 and avail > 0: + if 100000 < avail > 0: res.max_rooms = avail else: res.max_rooms = 0 if min_stay > 0: res.min_stay = min_stay - @api.onchange('rooms_num', 'discount', 'price','virtual_room_id', - 'checkin','checkout') + @api.onchange('rooms_num', 'discount', 'price', 'room_type_id', 'checkin', 'checkout') def update_price(self): - for line in self: - now_utc_dt = date_utils.now() - if not self.checkin: - self.checkin = self.folio_wizard_id.checkin - if not self.checkout: - self.checkout = self.folio_wizard_id.checkout - if self.rooms_num > self.max_rooms: + for record in self: + checkin = record.checkin or record.folio_wizard_id.checkin + checkout = record.checkout or record.folio_wizard_id.checkout + if record.rooms_num > record.max_rooms: raise ValidationError(_("There are not enough rooms!")) # UTC -> Hotel tz tz = self.env['ir.default'].sudo().get('res.config.settings', 'tz_hotel') - chkin_utc_dt = date_utils.get_datetime(self.checkin) - chkout_utc_dt = date_utils.get_datetime(self.checkout) + chkin_utc_dt = date_utils.get_datetime(checkin) + chkout_utc_dt = date_utils.get_datetime(checkout) if chkin_utc_dt >= chkout_utc_dt: dpt_hour = self.env['ir.default'].sudo().get( 'res.config.settings', 'default_departure_hour') checkout_str = (chkin_utc_dt + timedelta(days=1)).strftime( - DEFAULT_SERVER_DATE_FORMAT) + DEFAULT_SERVER_DATE_FORMAT) checkout_str = "%s %s:00" % (checkout_str, dpt_hour) checkout_dt = date_utils.get_datetime(checkout_str, stz=tz) checkout_utc_dt = date_utils.dt_as_timezone(checkout_dt, 'UTC') - self.checkout = checkout_utc_dt.strftime( - DEFAULT_SERVER_DATETIME_FORMAT) - checkout_dt = date_utils.get_datetime(self.checkout, stz=tz) + checkout = checkout_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT) + checkout_dt = date_utils.get_datetime(checkout, stz=tz) # Reservation end day count as free day. Not check it checkout_dt -= timedelta(days=1) - nights = days_diff = date_utils.date_diff(self.checkin, - self.checkout, - hours=False) - start_date_dt = date_utils.dt_as_timezone(chkin_utc_dt, - tz) + nights = date_utils.date_diff(checkin, checkout, hours=False) + start_date_dt = date_utils.dt_as_timezone(chkin_utc_dt, tz) # Reservation end day count as free day. Not check it checkout_dt -= timedelta(days=1) pricelist_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_pricelist_id') + 'res.config.settings', 'parity_pricelist_id') if pricelist_id: pricelist_id = int(pricelist_id) @@ -432,24 +400,31 @@ class VirtualRoomWizars(models.TransientModel): for i in range(0, nights): ndate = start_date_dt + timedelta(days=i) ndate_str = ndate.strftime(DEFAULT_SERVER_DATE_FORMAT) - prod = self.virtual_room_id.product_id.with_context( - lang=self.folio_wizard_id.partner_id.lang, - partner=self.folio_wizard_id.partner_id.id, + prod = record.room_type_id.product_id.with_context( + lang=record.folio_wizard_id.partner_id.lang, + partner=record.folio_wizard_id.partner_id.id, quantity=1, date=ndate_str, pricelist=pricelist_id, - uom=self.virtual_room_id.product_id.uom_id.id) + uom=record.room_type_id.product_id.uom_id.id) res_price += prod.price - self.price = res_price - (res_price * self.discount)/100 - self.total_price = self.rooms_num * self.price - self.amount_reservation = self.total_price + + price = (res_price * record.discount) * 0.01 + total_price = record.rooms_num * price + record.write({ + 'checkin': checkin, + 'checkout': checkout, + 'price': price, + 'total_price': total_price, + 'amount_reservation': total_price, + }) class ReservationWizard(models.TransientModel): _name = 'hotel.reservation.wizard' product_id = fields.Many2one('product.product', - string="Virtual Rooms") + string="Room Types") folio_wizard_id = fields.Many2one('hotel.folio.wizard') @@ -459,9 +434,9 @@ class ReservationWizard(models.TransientModel): help='Number of children there in guest list.') checkin = fields.Datetime('Check In', required=True) checkout = fields.Datetime('Check Out', required=True) - virtual_room_id = fields.Many2one('hotel.room.type', - string='Virtual Room Type', - required=True) + room_type_id = fields.Many2one('hotel.room.type', + string='Virtual Room Type', + required=True) nights = fields.Integer('Nights', readonly=True) price = fields.Float(string='Total') amount_reservation = fields.Float(string='Total', readonly=True) @@ -483,11 +458,11 @@ class ReservationWizard(models.TransientModel): for line in self: if line.checkin and line.checkout: room = self.env['hotel.room'].search([ - ('product_id.id','=',line.product_id.id) + ('product_id.id', '=', line.product_id.id) ]) if line.adults == 0: line.adults = room.capacity - line.virtual_room_id = room.price_virtual_room.id + line.room_type_id = room.price_room_type.id checkout_dt = date_utils.get_datetime(line.checkout) checkout_dt -= timedelta(days=1) occupied = self.env['hotel.reservation'].occupied( @@ -495,10 +470,11 @@ class ReservationWizard(models.TransientModel): checkout_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)) rooms_occupied = occupied.mapped('product_id.id') if line.product_id.id in rooms_occupied: - raise ValidationError(_("This room is occupied!, please, choice other room or change the reservation date")) + raise ValidationError(_("This room is occupied!, please, \ + choice other room or change the reservation date")) @api.multi - @api.onchange('checkin', 'checkout', 'virtual_room_id', 'discount') + @api.onchange('checkin', 'checkout', 'room_type_id', 'discount') def onchange_dates(self): for line in self: if not self.checkin: @@ -512,20 +488,19 @@ class ReservationWizard(models.TransientModel): start_date_dt = date_utils.dt_as_timezone(start_date_utc_dt, hotel_tz) - if line.virtual_room_id: + if line.room_type_id: pricelist_id = self.env['ir.default'].sudo().get( 'res.config.settings', 'parity_pricelist_id') if pricelist_id: pricelist_id = int(pricelist_id) - nights = days_diff = date_utils.date_diff(line.checkin, - line.checkout, - hours=False) + nights = date_utils.date_diff(line.checkin, + line.checkout, + hours=False) res_price = 0 - res_partner = self.partner_id or self.env['res.partner'].browse('1') for i in range(0, nights): ndate = start_date_dt + timedelta(days=i) ndate_str = ndate.strftime(DEFAULT_SERVER_DATE_FORMAT) - prod = line.virtual_room_id.product_id.with_context( + prod = line.room_type_id.product_id.with_context( lang=self.partner_id.lang, partner=self.partner_id.id, quantity=1, @@ -533,10 +508,7 @@ class ReservationWizard(models.TransientModel): pricelist=pricelist_id, uom=line.product_id.uom_id.id) res_price += prod.price - adults = self.env['hotel.room'].search([ - ('product_id.id', '=', line.product_id.id) - ]).capacity - res_price = res_price - (res_price * self.discount)/100 + res_price = res_price - (res_price * self.discount) * 0.01 line.amount_reservation = res_price line.price = res_price checkout_dt = date_utils.get_datetime(self.checkout) @@ -551,34 +523,41 @@ class ReservationWizard(models.TransientModel): ] return {'domain': {'product_id': domain_rooms}} + class ServiceWizard(models.TransientModel): _name = 'hotel.service.wizard' product_id = fields.Many2one('product.product', - string="Service") + string="Service") folio_wizard_id = fields.Many2one('hotel.folio.wizard') discount = fields.Float('discount') - price_unit = fields.Float('Unit Price', required=True, digits=dp.get_precision('Product Price'), default=0.0) - price_total = fields.Float(compute='_compute_amount', string='Subtotal', readonly=True, store=True) - product_uom_qty = fields.Float(string='Quantity', digits=dp.get_precision('Product Unit of Measure'), required=True, default=1.0) + price_unit = fields.Float('Unit Price', required=True, + digits=dp.get_precision('Product Price'), + default=0.0) + price_total = fields.Float(compute='_compute_amount', string='Subtotal', + readonly=True, store=True) + product_uom_qty = fields.Float(string='Quantity', + digits=dp.get_precision('Product Unit of Measure'), + required=True, + default=1.0) @api.onchange('product_id') def onchange_product_id(self): if self.product_id: #TODO change pricelist for partner pricelist_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_pricelist_id') + 'res.config.settings', 'parity_pricelist_id') prod = self.product_id.with_context( - lang=self.folio_wizard_id.partner_id.lang, - partner=self.folio_wizard_id.partner_id.id, - quantity=1, - date=fields.Datetime.now(), - pricelist=pricelist_id, - uom=self.product_id.uom_id.id) + lang=self.folio_wizard_id.partner_id.lang, + partner=self.folio_wizard_id.partner_id.id, + quantity=1, + date=fields.Datetime.now(), + pricelist=pricelist_id, + uom=self.product_id.uom_id.id) self.price_unit = prod.price @api.depends('price_unit', 'product_uom_qty', 'discount') def _compute_amount(self): for ser in self: total = (ser.price_unit * ser.product_uom_qty) - ser.price_total = total - (total * ser.discount) / 100 + ser.price_total = total - (total * ser.discount) * 0.01 diff --git a/hotel_calendar/wizard/wizard_reservation.xml b/hotel_calendar/wizard/wizard_reservation.xml index 5d880e580..a9ff1a9f3 100644 --- a/hotel_calendar/wizard/wizard_reservation.xml +++ b/hotel_calendar/wizard/wizard_reservation.xml @@ -19,7 +19,7 @@
- - + @@ -50,7 +50,7 @@ nolabel="1" attrs="{'invisible': [('autoassign','=',True)]}"> - + diff --git a/hotel_calendar_channel_connector/models/inherited_hotel_reservation.py b/hotel_calendar_channel_connector/models/inherited_hotel_reservation.py index df0209e8c..30bc6e20e 100644 --- a/hotel_calendar_channel_connector/models/inherited_hotel_reservation.py +++ b/hotel_calendar_channel_connector/models/inherited_hotel_reservation.py @@ -84,10 +84,10 @@ class HotelReservation(models.Model): 'reserve_color_text': record.reserve_color_text, 'splitted': record.splitted, 'parent_reservation': record.parent_reservation and - record.parent_reservation.id or 0, + record.parent_reservation.id or 0, 'room_name': record.product_id.name, - 'partner_phone': record.partner_id.mobile - or record.partner_id.phone or _('Undefined'), + 'partner_phone': record.partner_id.mobile or + record.partner_id.phone or _('Undefined'), 'state': record.state, 'fix_days': record.splitted or record.is_from_ota, 'overbooking': record.overbooking, @@ -98,6 +98,6 @@ class HotelReservation(models.Model): @api.multi def confirm(self): for record in self: - if record.to_assign == True: + if record.to_assign: record.write({'to_read': False, 'to_assign': False}) return super(HotelReservation, self).confirm() diff --git a/hotel_calendar_channel_connector/views/hotel_reservation.xml b/hotel_calendar_channel_connector/views/hotel_reservation.xml index 113ab74fe..8bbb016e8 100644 --- a/hotel_calendar_channel_connector/views/hotel_reservation.xml +++ b/hotel_calendar_channel_connector/views/hotel_reservation.xml @@ -41,7 +41,7 @@ - + diff --git a/hotel_channel_connector/__manifest__.py b/hotel_channel_connector/__manifest__.py index 9e905be3a..b5574049d 100644 --- a/hotel_channel_connector/__manifest__.py +++ b/hotel_channel_connector/__manifest__.py @@ -25,7 +25,7 @@ 'views/general.xml', 'views/inherited_hotel_reservation_views.xml', 'views/inherited_hotel_room_type_views.xml', - 'views/inherited_hotel_virtual_room_availability_views.xml', + 'views/inherited_hotel_room_type_availability_views.xml', 'views/inherited_hotel_folio_views.xml', 'views/inherited_product_pricelist_views.xml', 'views/inherited_product_pricelist_item_views.xml', @@ -36,8 +36,8 @@ 'views/wubook_issue_views.xml', 'views/channel_hotel_reservation_views.xml', 'views/channel_hotel_room_type_views.xml', - 'views/channel_hotel_virtual_room_availability_views.xml', - 'views/channel_hotel_virtual_room_restriction_views.xml', + 'views/channel_hotel_room_type_availability_views.xml', + 'views/channel_hotel_room_type_restriction_views.xml', 'views/channel_product_pricelist_views.xml', 'data/menus.xml', 'data/sequences.xml', diff --git a/hotel_channel_connector/components/exporter.py b/hotel_channel_connector/components/exporter.py index cbd959a16..3f800af4d 100644 --- a/hotel_channel_connector/components/exporter.py +++ b/hotel_channel_connector/components/exporter.py @@ -29,11 +29,11 @@ class HotelChannelConnectorExporter(AbstractComponent): DEFAULT_SERVER_DATE_FORMAT)) ]) - vrooms = vroom_avail_ids.mapped('virtual_room_id') + vrooms = vroom_avail_ids.mapped('room_type_id') avails = [] for vroom in vrooms: vroom_avails = vroom_avail_ids.filtered( - lambda x: x.virtual_room_id.id == vroom.id) + lambda x: x.room_type_id.id == vroom.id) days = [] for vroom_avail in vroom_avails: vroom_avail.with_context({ @@ -139,8 +139,8 @@ class HotelChannelConnectorExporter(AbstractComponent): ('wpushed', '=', False), ('restriction_id', '=', rp.id) ]) - virtual_room_ids = unpushed_rp.mapped('virtual_room_id') - for vroom in virtual_room_ids: + room_type_ids = unpushed_rp.mapped('room_type_id') + for vroom in room_type_ids: restrictions[rp.wpid].update({vroom.wrid: []}) for i in range(0, days_diff): ndate_dt = date_start + timedelta(days=i) diff --git a/hotel_channel_connector/components/importer.py b/hotel_channel_connector/components/importer.py index 13e18b46d..3ccad2f21 100644 --- a/hotel_channel_connector/components/importer.py +++ b/hotel_channel_connector/components/importer.py @@ -17,9 +17,9 @@ class HotelChannelConnectorImporter(AbstractComponent): @api.model def _get_room_values_availability(self, vroom_id, date_str, day_vals, set_max_avail): - virtual_room_avail_obj = self.env['hotel.room.type.availability'] - vroom_avail = virtual_room_avail_obj.search([ - ('virtual_room_id', '=', vroom_id), + room_type_avail_obj = self.env['hotel.room.type.availability'] + vroom_avail = room_type_avail_obj.search([ + ('room_type_id', '=', vroom_id), ('date', '=', date_str) ], limit=1) vals = { @@ -36,10 +36,10 @@ class HotelChannelConnectorImporter(AbstractComponent): }).write(vals) else: vals.update({ - 'virtual_room_id': vroom_id, + 'room_type_id': vroom_id, 'date': date_str, }) - virtual_room_avail_obj.with_context({ + room_type_avail_obj.with_context({ 'wubook_action': False, 'mail_create_nosubscribe': True, }).create(vals) @@ -48,8 +48,8 @@ class HotelChannelConnectorImporter(AbstractComponent): def _get_room_values_restrictions(self, restriction_plan_id, vroom_id, date_str, day_vals): vroom_restr_item_obj = self.env['hotel.room.type.restriction.item'] vroom_restr = vroom_restr_item_obj.search([ - ('virtual_room_id', '=', vroom_id), - ('applied_on', '=', '0_virtual_room'), + ('room_type_id', '=', vroom_id), + ('applied_on', '=', '0_room_type'), ('date_start', '=', date_str), ('date_end', '=', date_str), ('restriction_id', '=', restriction_plan_id), @@ -79,10 +79,10 @@ class HotelChannelConnectorImporter(AbstractComponent): else: vals.update({ 'restriction_id': restriction_plan_id, - 'virtual_room_id': vroom_id, + 'room_type_id': vroom_id, 'date_start': date_str, 'date_end': date_str, - 'applied_on': '0_virtual_room', + 'applied_on': '0_room_type', }) vroom_restr_item_obj.with_context({ 'wubook_action': False, @@ -90,13 +90,13 @@ class HotelChannelConnectorImporter(AbstractComponent): @api.model def _generate_room_values(self, dfrom, dto, values, set_max_avail=False): - virtual_room_restr_obj = self.env['hotel.room.type.restriction'] - hotel_virtual_room_obj = self.env['hotel.room.type'] - def_restr_plan = virtual_room_restr_obj.search([('wpid', '=', '0')]) + room_type_restr_obj = self.env['hotel.room.type.restriction'] + hotel_room_type_obj = self.env['hotel.room.type'] + def_restr_plan = room_type_restr_obj.search([('wpid', '=', '0')]) _logger.info("==== ROOM VALUES (%s -- %s)", dfrom, dto) _logger.info(values) for k_rid, v_rid in values.iteritems(): - vroom = hotel_virtual_room_obj.search([ + vroom = hotel_room_type_obj.search([ ('wrid', '=', k_rid) ], limit=1) if vroom: @@ -159,7 +159,7 @@ class HotelChannelConnectorImporter(AbstractComponent): 'wstatus': wstatus, 'to_read': True, 'state': is_cancellation and 'cancelled' or 'draft', - 'virtual_room_id': vroom.id, + 'room_type_id': vroom.id, 'splitted': split_booking, 'wbook_json': json.dumps(book), 'wmodified': book['was_modified'] @@ -362,10 +362,10 @@ class HotelChannelConnectorImporter(AbstractComponent): "Invalid reservation total price! %.2f != %.2f" % (vals['price_unit'], book['amount']), '', wid=book['reservation_code']) - free_rooms = hotel_vroom_obj.check_availability_virtual_room( + free_rooms = hotel_vroom_obj.check_availability_room( checkin_str, checkout_str, - virtual_room_id=vroom.id, + room_type_id=vroom.id, notthis=used_rooms) if any(free_rooms): vals.update({ @@ -515,7 +515,7 @@ class HotelChannelConnectorImporter(AbstractComponent): @api.model def _generate_pricelist_items(self, channel_plan_id, date_from, date_to, plan_prices): - hotel_virtual_room_obj = self.env['hotel.room.type'] + hotel_room_type_obj = self.env['hotel.room.type'] pricelist = self.env['product.pricelist'].search([ ('wpid', '=', channel_plan_id) ], limit=1) @@ -527,7 +527,7 @@ class HotelChannelConnectorImporter(AbstractComponent): for i in range(0, days_diff): ndate_dt = dfrom_dt + timedelta(days=i) for k_rid, v_rid in plan_prices.iteritems(): - vroom = hotel_virtual_room_obj.search([ + vroom = hotel_room_type_obj.search([ ('wrid', '=', k_rid) ], limit=1) if vroom: @@ -589,7 +589,7 @@ class HotelChannelConnectorImporter(AbstractComponent): @api.model def _generate_restriction_items(self, plan_restrictions): - hotel_virtual_room_obj = self.env['hotel.room.type'] + hotel_room_type_obj = self.env['hotel.room.type'] reserv_restriction_obj = self.env['hotel.room.type.restriction'] restriction_item_obj = self.env['hotel.room.type.restriction.item'] _logger.info("===== RESTRICTIONS") @@ -600,7 +600,7 @@ class HotelChannelConnectorImporter(AbstractComponent): ], limit=1) if restriction_id: for k_rid, v_rid in v_rpid.iteritems(): - vroom = hotel_virtual_room_obj.search([ + vroom = hotel_room_type_obj.search([ ('wrid', '=', k_rid) ], limit=1) if vroom: @@ -614,8 +614,8 @@ class HotelChannelConnectorImporter(AbstractComponent): DEFAULT_SERVER_DATE_FORMAT)), ('date_end', '=', date_dt.strftime( DEFAULT_SERVER_DATE_FORMAT)), - ('applied_on', '=', '0_virtual_room'), - ('virtual_room_id', '=', vroom.id) + ('applied_on', '=', '0_room_type'), + ('room_type_id', '=', vroom.id) ], limit=1) vals = { 'closed_arrival': item['closed_arrival'], @@ -637,8 +637,8 @@ class HotelChannelConnectorImporter(AbstractComponent): DEFAULT_SERVER_DATE_FORMAT), 'date_end': date_dt.strftime( DEFAULT_SERVER_DATE_FORMAT), - 'applied_on': '0_virtual_room', - 'virtual_room_id': vroom.id + 'applied_on': '0_room_type', + 'room_type_id': vroom.id }) restriction_item_obj.with_context({ 'wubook_action': False}).create(vals) diff --git a/hotel_channel_connector/data/sequences.xml b/hotel_channel_connector/data/sequences.xml index 6209d591f..414ee197a 100644 --- a/hotel_channel_connector/data/sequences.xml +++ b/hotel_channel_connector/data/sequences.xml @@ -1,9 +1,9 @@ - + Virtual Room Short Code - hotel.virtual.room + hotel.room.type 4 diff --git a/hotel_channel_connector/models/__init__.py b/hotel_channel_connector/models/__init__.py index dd404b479..96726f45d 100644 --- a/hotel_channel_connector/models/__init__.py +++ b/hotel_channel_connector/models/__init__.py @@ -7,9 +7,9 @@ from . import res_config from . import hotel_room_type from . import product_pricelist from . import inherited_product_pricelist_item -from . import hotel_virtual_room_restriction +from . import hotel_room_type_restriction from . import inherited_reservation_restriction_item -from . import hotel_virtual_room_availability +from . import hotel_room_type_availability from . import hotel_reservation from . import inherited_hotel_folio from . import inherited_res_partner diff --git a/hotel_channel_connector/models/hotel_room_type/common.py b/hotel_channel_connector/models/hotel_room_type/common.py index 4908b3a7d..a48400fb0 100644 --- a/hotel_channel_connector/models/hotel_room_type/common.py +++ b/hotel_channel_connector/models/hotel_room_type/common.py @@ -121,7 +121,7 @@ class HotelRoomType(models.Model): restriction = self.env['hotel.room.type.restriction.item'].search([ ('date_start', '=', date), ('date_end', '=', date), - ('virtual_room_id', '=', self.id), + ('room_type_id', '=', self.id), ('restriction_id', '=', restriction_plan_id) ], limit=1) return restriction diff --git a/hotel_channel_connector/models/hotel_virtual_room_availability/__init__.py b/hotel_channel_connector/models/hotel_room_type_availability/__init__.py similarity index 100% rename from hotel_channel_connector/models/hotel_virtual_room_availability/__init__.py rename to hotel_channel_connector/models/hotel_room_type_availability/__init__.py diff --git a/hotel_channel_connector/models/hotel_virtual_room_availability/common.py b/hotel_channel_connector/models/hotel_room_type_availability/common.py similarity index 76% rename from hotel_channel_connector/models/hotel_virtual_room_availability/common.py rename to hotel_channel_connector/models/hotel_room_type_availability/common.py index 96b3ba1fe..656db3667 100644 --- a/hotel_channel_connector/models/hotel_virtual_room_availability/common.py +++ b/hotel_channel_connector/models/hotel_room_type_availability/common.py @@ -6,7 +6,7 @@ from odoo.addons.queue_job.job import job, related_action from odoo.addons.component.core import Component from odoo.addons.component_event import skip_if -class ChannelHotelVirtualRoomAvailability(models.Model): +class ChannelHotelRoomTypeAvailability(models.Model): _name = 'channel.hotel.room.type.availability' _inherit = 'channel.binding' _inherits = {'hotel.room.type.availability': 'odoo_id'} @@ -14,8 +14,8 @@ class ChannelHotelVirtualRoomAvailability(models.Model): @api.model def _default_channel_max_avail(self): - if self.virtual_room_id: - return self.virtual_room_id.max_real_rooms + if self.room_type_id: + return self.room_type_id.max_real_rooms return -1 odoo_id = fields.Many2one(comodel_names='product.pricelist', @@ -31,10 +31,10 @@ class ChannelHotelVirtualRoomAvailability(models.Model): @api.constrains('channel_max_avail') def _check_wmax_avail(self): for record in self: - if record.channel_max_avail > record.virtual_room_id.total_rooms_count: + if record.channel_max_avail > record.room_type_id.total_rooms_count: raise ValidationError(_("max avail for channel can't be high \ than toal rooms \ - count: %d") % record.virtual_room_id.total_rooms_count) + count: %d") % record.room_type_id.total_rooms_count) @job(default_channel='root.channel') @related_action(action='related_action_unwrap_binding') @@ -46,40 +46,40 @@ class ChannelHotelVirtualRoomAvailability(models.Model): adapter = work.component(usage='backend.adapter') date_dt = date_utils.get_datetime(self.date) adapter.update_availability([{ - 'id': self.virtual_room_id.channel_room_id, + 'id': self.room_type_id.channel_room_id, 'days': [{ 'date': date_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT), 'avail': self.avail, }], }]) -class HotelVirtualRoomAvailability(models.Model): +class HotelRoomTypeAvailability(models.Model): _inherit = 'hotel.room.type.availability' channel_bind_ids = fields.One2many( comodel_name='channel.hotel.room.type.availability', inverse_name='odoo_id', - string='Hotel Virtual Room Availability Connector Bindings') + string='Hotel Room Type Availability Connector Bindings') @api.constrains('avail') def _check_avail(self): vroom_obj = self.env['hotel.virtual.room'] issue_obj = self.env['hotel.channel.connector.issue'] for record in self: - cavail = len(vroom_obj.check_availability_virtual_room( + cavail = len(vroom_obj.check_availability_room( record.date, record.date, - virtual_room_id=record.virtual_room_id.id)) - max_avail = min(cavail, record.virtual_room_id.total_rooms_count) + room_type_id=record.room_type_id.id)) + max_avail = min(cavail, record.room_type_id.total_rooms_count) if record.avail > max_avail: issue_obj.sudo().create({ 'section': 'avail', 'message': _(r"The new availability can't be greater than \ the actual availability \ - \n[%s]\nInput: %d\Limit: %d") % (record.virtual_room_id.name, + \n[%s]\nInput: %d\Limit: %d") % (record.room_type_id.name, record.avail, record), - 'wid': record.virtual_room_id.wrid, + 'wid': record.room_type_id.wrid, 'date_start': record.date, 'date_end': record.date, }) @@ -87,10 +87,10 @@ class HotelVirtualRoomAvailability(models.Model): self._event('on_fix_channel_availability').notify(record) return super(HotelVirtualRoomAvailability, self)._check_avail() - @api.onchange('virtual_room_id') - def onchange_virtual_room_id(self): - if self.virtual_room_id: - self.channel_max_avail = self.virtual_room_id.max_real_rooms + @api.onchange('room_type_id') + def onchange_room_type_id(self): + if self.room_type_id: + self.channel_max_avail = self.room_type_id.max_real_rooms @api.multi def write(self, vals): @@ -105,7 +105,7 @@ class HotelVirtualRoomAvailability(models.Model): date_diff = date_utils.date_diff(checkin, checkout, hours=False) vroom_obj = self.env['hotel.virtual.room'] - virtual_room_avail_obj = self.env['hotel.room.type.availability'] + room_type_avail_obj = self.env['hotel.room.type.availability'] vrooms = vroom_obj.search([ ('room_ids.product_id', '=', product_id) @@ -115,29 +115,29 @@ class HotelVirtualRoomAvailability(models.Model): for i in range(0, date_diff): ndate_dt = date_start + timedelta(days=i) ndate_str = ndate_dt.strftime(DEFAULT_SERVER_DATE_FORMAT) - avail = len(vroom_obj.check_availability_virtual_room( + avail = len(vroom_obj.check_availability_room( ndate_str, ndate_str, - virtual_room_id=vroom.id)) + room_type_id=vroom.id)) max_avail = vroom.max_real_rooms - vroom_avail_id = virtual_room_avail_obj.search([ - ('virtual_room_id', '=', vroom.id), + vroom_avail_id = room_type_avail_obj.search([ + ('room_type_id', '=', vroom.id), ('date', '=', ndate_str)], limit=1) if vroom_avail_id and vroom_avail_id.channel_max_avail >= 0: max_avail = vroom_avail_id.channel_max_avail avail = max( - min(avail, vroom.total_rooms_count, max_avail), 0) + min(avail, vroom.total_rooms_count, max_avail), 0) if vroom_avail_id: vroom_avail_id.write({'avail': avail}) else: - virtual_room_avail_obj.create({ - 'virtual_room_id': vroom.id, + room_type_avail_obj.create({ + 'room_type_id': vroom.id, 'date': ndate_str, 'avail': avail, }) -class ChannelBindingHotelVirtualRoomAvailabilityListener(Component): +class ChannelBindingHotelRoomTypeAvailabilityListener(Component): _name = 'channel.binding.hotel.room.type.availability.listener' _inherit = 'base.connector.listener' _apply_on = ['channel.hotel.room.type.availability'] diff --git a/hotel_channel_connector/models/hotel_virtual_room_restriction/__init__.py b/hotel_channel_connector/models/hotel_room_type_restriction/__init__.py similarity index 100% rename from hotel_channel_connector/models/hotel_virtual_room_restriction/__init__.py rename to hotel_channel_connector/models/hotel_room_type_restriction/__init__.py diff --git a/hotel_channel_connector/models/hotel_virtual_room_restriction/common.py b/hotel_channel_connector/models/hotel_room_type_restriction/common.py similarity index 95% rename from hotel_channel_connector/models/hotel_virtual_room_restriction/common.py rename to hotel_channel_connector/models/hotel_room_type_restriction/common.py index 089439c5c..98e44f3a4 100644 --- a/hotel_channel_connector/models/hotel_virtual_room_restriction/common.py +++ b/hotel_channel_connector/models/hotel_room_type_restriction/common.py @@ -6,11 +6,11 @@ from odoo.addons.queue_job.job import job, related_action from odoo.addons.component.core import Component from odoo.addons.component_event import skip_if -class ChannelHotelVirtualRoomRestriction(models.Model): +class ChannelHotelRoomTypeRestriction(models.Model): _name = 'channel.hotel.room.type.restriction' _inherit = 'channel.binding' _inherits = {'hotel.room.type.restriction': 'odoo_id'} - _description = 'Channel Hotel Virtual Room Restriction' + _description = 'Channel Hotel Room Type Restriction' odoo_id = fields.Many2one(comodel_names='hotel.room.type.restriction', string='Hotel Virtual Room Restriction', @@ -70,7 +70,7 @@ class ChannelHotelVirtualRoomRestriction(models.Model): importer = work.component(usage='channel.importer') return importer.import_restriction_plans() -class HotelVirtualRoomRestriction(models.Model): +class HotelRoomTypeRestriction(models.Model): _inherit = 'hotel.room.type.restriction' channel_bind_ids = fields.One2many( @@ -92,7 +92,7 @@ class HotelVirtualRoomRestriction(models.Model): names.append((name[0], name[1])) return names -class ChannelBindingHotelVirtualRoomRestrictionListener(Component): +class ChannelBindingHotelRoomTypeRestrictionListener(Component): _name = 'channel.binding.hotel.room.type.restriction.listener' _inherit = 'base.connector.listener' _apply_on = ['channel.hotel.room.type.restriction'] diff --git a/hotel_channel_connector/models/inherited_hotel_folio.py b/hotel_channel_connector/models/inherited_hotel_folio.py index 5e025125a..f5b4b26fd 100644 --- a/hotel_channel_connector/models/inherited_hotel_folio.py +++ b/hotel_channel_connector/models/inherited_hotel_folio.py @@ -48,11 +48,11 @@ class HotelFolio(models.Model): dates = rline.get_real_checkin_checkout() vals = { 'num': len( - self.room_lines.filtered(lambda r: r.get_real_checkin_checkout()[0] == dates[0] and r.get_real_checkin_checkout()[1] == dates[1] and r.virtual_room_id.id == rline.virtual_room_id.id and (r.to_send or import_all) and not r.parent_reservation and r.state == rline.state and ((r.state == 'cancelled' and not r.channel_modified) or r.state != 'cancelled')) + self.room_lines.filtered(lambda r: r.get_real_checkin_checkout()[0] == dates[0] and r.get_real_checkin_checkout()[1] == dates[1] and r.room_type_id.id == rline.room_type_id.id and (r.to_send or import_all) and not r.parent_reservation and r.state == rline.state and ((r.state == 'cancelled' and not r.channel_modified) or r.state != 'cancelled')) ), - 'virtual_room': { - 'id': rline.virtual_room_id.id, - 'name': rline.virtual_room_id.name, + 'room_type': { + 'id': rline.room_type_id.id, + 'name': rline.room_type_id.name, }, 'checkin': dates[0], 'checkout': dates[1], @@ -62,13 +62,13 @@ class HotelFolio(models.Model): } founded = False for srline in info_grouped: - if srline['num'] == vals['num'] and srline['virtual_room']['id'] == vals['virtual_room']['id'] and srline['checkin'] == vals['checkin'] and srline['checkout'] == vals['checkout']: + if srline['num'] == vals['num'] and srline['room_type']['id'] == vals['room_type']['id'] and srline['checkin'] == vals['checkin'] and srline['checkout'] == vals['checkout']: founded = True break if not founded: info_grouped.append(vals) return sorted(sorted(info_grouped, key=lambda k: k['num'], - reverse=True), key=lambda k: k['virtual_room']['id']) + reverse=True), key=lambda k: k['room_type']['id']) @api.depends('room_lines') def _compute_has_cancelled_reservations_to_send(self): diff --git a/hotel_channel_connector/models/res_config.py b/hotel_channel_connector/models/res_config.py index 83779211f..4de7e08a5 100644 --- a/hotel_channel_connector/models/res_config.py +++ b/hotel_channel_connector/models/res_config.py @@ -122,7 +122,7 @@ class HotelChannelConnectorConfiguration(models.TransientModel): vroom_restr_it_obj = self.env['hotel.room.type.restriction.item'] # Secure Wubook Input restriction_item_ids = vroom_restr_it_obj.search([ - ('applied_on', '=', '0_virtual_room'), + ('applied_on', '=', '0_room_type'), ('date_start', '<', now_utc_str), ]) if any(restriction_item_ids): @@ -132,7 +132,7 @@ class HotelChannelConnectorConfiguration(models.TransientModel): # Put to push restrictions restriction_item_ids = vroom_restr_it_obj.search([ ('restriction_id', '=', restriction_id), - ('applied_on', '=', '0_virtual_room'), + ('applied_on', '=', '0_room_type'), ('wpushed', '=', True), ('date_start', '>=', now_utc_str), ]) diff --git a/hotel_channel_connector/tests/__init__.py b/hotel_channel_connector/tests/__init__.py index cde75d095..db8af0785 100644 --- a/hotel_channel_connector/tests/__init__.py +++ b/hotel_channel_connector/tests/__init__.py @@ -21,7 +21,7 @@ # ############################################################################## from . import test_wubook -from . import test_virtual_room_availability_model +from . import test_room_type_availability_model from . import test_wubook_issue_model from . import test_reservation_restriction_item_model from . import test_reservation_restriction_model @@ -31,5 +31,5 @@ from . import test_wubook_channel_info_model from . import test_product_pricelist_model from . import test_hotel_calendar_management_model from . import test_hotel_folio_model -from . import test_hotel_virtual_room_model +from . import test_hotel_room_type_model from . import test_hotel_reservation_model diff --git a/hotel_channel_connector/tests/test_virtual_room_availability_model.py b/hotel_channel_connector/tests/test_virtual_room_availability_model.py index be0d4cd78..6a2167674 100644 --- a/hotel_channel_connector/tests/test_virtual_room_availability_model.py +++ b/hotel_channel_connector/tests/test_virtual_room_availability_model.py @@ -34,7 +34,7 @@ class TestVirtualRoomAvailability(TestHotelWubook): day_utc_dt = now_utc_dt + timedelta(days=1) vroom_avail_obj = self.env['hotel.room.type.availability'] avail = vroom_avail_obj.search([ - ('virtual_room_id', '=', self.hotel_vroom_budget.id), + ('room_type_id', '=', self.hotel_vroom_budget.id), ('date', '=', now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)) ], limit=1) avail.write({ diff --git a/hotel_channel_connector/tests/test_wubook.py b/hotel_channel_connector/tests/test_wubook.py index 7d1076921..db0b01b41 100644 --- a/hotel_channel_connector/tests/test_wubook.py +++ b/hotel_channel_connector/tests/test_wubook.py @@ -589,7 +589,7 @@ class TestWubook(TestHotelWubook): for vroom in vrooms: items = vroom_restr_item_obj.search([ - ('virtual_room_id', '=', vroom.id), + ('room_type_id', '=', vroom.id), ('date_start', '>=', checkin_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)), ('date_end', diff --git a/hotel_channel_connector/views/channel_hotel_room_type_views.xml b/hotel_channel_connector/views/channel_hotel_room_type_views.xml index e3d56323f..7ccbbddb1 100644 --- a/hotel_channel_connector/views/channel_hotel_room_type_views.xml +++ b/hotel_channel_connector/views/channel_hotel_room_type_views.xml @@ -1,9 +1,9 @@ - - channel.hotel.virtual.room.form - channel.hotel.virtual.room + + channel.hotel.room.type.form + channel.hotel.room.type @@ -15,9 +15,9 @@ - - channel.hotel.virtual.room.tree - channel.hotel.virtual.room + + channel.hotel.room.type.tree + channel.hotel.room.type diff --git a/hotel_channel_connector/views/channel_hotel_virtual_room_availability_views.xml b/hotel_channel_connector/views/channel_hotel_virtual_room_availability_views.xml index e880e75f2..13549fc11 100644 --- a/hotel_channel_connector/views/channel_hotel_virtual_room_availability_views.xml +++ b/hotel_channel_connector/views/channel_hotel_virtual_room_availability_views.xml @@ -1,7 +1,7 @@ - + channel.hotel.room.type.availability.form channel.hotel.room.type.availability @@ -14,7 +14,7 @@ - + channel.hotel.room.type.availability.tree channel.hotel.virtual.availability.room diff --git a/hotel_channel_connector/views/channel_hotel_virtual_room_restriction_views.xml b/hotel_channel_connector/views/channel_hotel_virtual_room_restriction_views.xml index 2d598827b..fb34401e0 100644 --- a/hotel_channel_connector/views/channel_hotel_virtual_room_restriction_views.xml +++ b/hotel_channel_connector/views/channel_hotel_virtual_room_restriction_views.xml @@ -1,7 +1,7 @@ - + channel.hotel.room.type.restriction.form channel.hotel.room.type.restriction @@ -14,7 +14,7 @@ - + channel.hotel.room.type.restriction.tree channel.hotel.virtual.restriction.room diff --git a/hotel_channel_connector/views/channel_product_pricelist_views.xml b/hotel_channel_connector/views/channel_product_pricelist_views.xml index 5dcd3c715..60b2d52d8 100644 --- a/hotel_channel_connector/views/channel_product_pricelist_views.xml +++ b/hotel_channel_connector/views/channel_product_pricelist_views.xml @@ -14,7 +14,7 @@ - + channel.hotel.product.pricelist.tree channel.hotel.product.pricelist.room diff --git a/hotel_channel_connector/views/inherited_hotel_room_type_views.xml b/hotel_channel_connector/views/inherited_hotel_room_type_views.xml index d456ae39d..12a51319c 100644 --- a/hotel_channel_connector/views/inherited_hotel_room_type_views.xml +++ b/hotel_channel_connector/views/inherited_hotel_room_type_views.xml @@ -1,7 +1,7 @@ - + hotel.room.type diff --git a/hotel_channel_connector/views/inherited_hotel_virtual_room_availability_views.xml b/hotel_channel_connector/views/inherited_hotel_virtual_room_availability_views.xml index c3751049e..600229e62 100644 --- a/hotel_channel_connector/views/inherited_hotel_virtual_room_availability_views.xml +++ b/hotel_channel_connector/views/inherited_hotel_virtual_room_availability_views.xml @@ -2,9 +2,9 @@ - + hotel.room.type.availability - + @@ -23,9 +23,9 @@ - + hotel.room.type.availability - + tree