From dd61d122b08dbf10ebfa9f567d8babcf3e282d36 Mon Sep 17 00:00:00 2001 From: Dario Lodeiros Date: Wed, 7 Nov 2018 19:49:26 +0100 Subject: [PATCH] Change parity by default --- .../models/hotel_calendar_management.py | 4 +- .../models/inherited_hotel_reservation.py | 6 +- ...erited_hotel_room_type_restriction_item.py | 30 +++++----- hotel_calendar/models/inherited_ir_default.py | 2 +- .../inherited_product_pricelist_item.py | 30 +++++----- hotel_calendar/tests/common.py | 4 +- .../tests/test_management_calendar.py | 58 +++++++++---------- .../tests/test_product_pricelist.py | 4 +- .../tests/test_reservations_calendar.py | 2 +- hotel_channel_connector/controllers/main.py | 16 ++--- hotel_channel_connector/i18n/es.po | 40 ++++++------- .../models/channel_backend/common.py | 6 +- .../test_hotel_calendar_management_model.py | 8 +-- .../test_product_pricelist_item_model.py | 16 ++--- .../tests/test_product_pricelist_model.py | 36 ++++++------ 15 files changed, 131 insertions(+), 131 deletions(-) diff --git a/hotel_calendar/models/hotel_calendar_management.py b/hotel_calendar/models/hotel_calendar_management.py index 5a7ab9a8c..cee2666e5 100644 --- a/hotel_calendar/models/hotel_calendar_management.py +++ b/hotel_calendar/models/hotel_calendar_management.py @@ -267,10 +267,10 @@ class HotelCalendarManagement(models.TransientModel): vals = {} if not pricelist_id: pricelist_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_pricelist_id') + 'res.config.settings', 'default_pricelist_id') if not restriction_id: restriction_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_restrictions_id') + 'res.config.settings', 'default_restrictions_id') pricelist_id = int(pricelist_id) vals.update({'pricelist_id': pricelist_id}) diff --git a/hotel_calendar/models/inherited_hotel_reservation.py b/hotel_calendar/models/inherited_hotel_reservation.py index 4c7baf716..986eb85c8 100644 --- a/hotel_calendar/models/inherited_hotel_reservation.py +++ b/hotel_calendar/models/inherited_hotel_reservation.py @@ -59,7 +59,7 @@ class HotelReservation(models.Model): @api.model def _hcalendar_room_data(self, rooms): pricelist_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_pricelist_id') + 'res.config.settings', 'default_pricelist_id') if pricelist_id: pricelist_id = int(pricelist_id) json_rooms = [] @@ -117,7 +117,7 @@ class HotelReservation(models.Model): @api.model def get_hcalendar_pricelist_data(self, dfrom, dto): pricelist_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_pricelist_id') + 'res.config.settings', 'default_pricelist_id') if pricelist_id: pricelist_id = int(pricelist_id) date_start = fields.Date.from_string(dfrom) - timedelta(days=1) @@ -157,7 +157,7 @@ class HotelReservation(models.Model): @api.model def get_hcalendar_restrictions_data(self, dfrom, dto): restriction_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_restrictions_id') + 'res.config.settings', 'default_restrictions_id') if restriction_id: restriction_id = int(restriction_id) date_start = fields.Date.from_string(dfrom) - timedelta(days=1) diff --git a/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py b/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py index 651237951..0e436ce75 100644 --- a/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py +++ b/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py @@ -11,12 +11,12 @@ class HotelRoomTypeResrtrictionItem(models.Model): @api.model def create(self, vals): res = super(HotelRoomTypeResrtrictionItem, self).create(vals) - restrictions_parity_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_restrictions_id') - if restrictions_parity_id: - restrictions_parity_id = int(restrictions_parity_id) + restrictions_default_id = self.env['ir.default'].sudo().get( + 'res.config.settings', 'default_restrictions_id') + if restrictions_default_id: + restrictions_default_id = int(restrictions_default_id) restriction_id = res.restriction_id.id - if restriction_id == restrictions_parity_id and \ + if restriction_id == restrictions_default_id and \ self.applied_on == '0_room_type': self.env['bus.hotel.calendar'].send_restriction_notification({ 'restriction_id': self.restriction_id.id, @@ -35,15 +35,15 @@ class HotelRoomTypeResrtrictionItem(models.Model): @api.multi def write(self, vals): - restrictions_parity_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_restrictions_id') - if restrictions_parity_id: - restrictions_parity_id = int(restrictions_parity_id) + restrictions_default_id = self.env['ir.default'].sudo().get( + 'res.config.settings', 'default_restrictions_id') + if restrictions_default_id: + restrictions_default_id = int(restrictions_default_id) ret_vals = super(HotelRoomTypeResrtrictionItem, self).write(vals) bus_hotel_calendar_obj = self.env['bus.hotel.calendar'] for record in self: - if record.restriction_id.id != restrictions_parity_id or \ + if record.restriction_id.id != restrictions_default_id or \ record.applied_on != '0_room_type': continue bus_hotel_calendar_obj.send_restriction_notification({ @@ -63,14 +63,14 @@ class HotelRoomTypeResrtrictionItem(models.Model): @api.multi def unlink(self): - restrictions_parity_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_restrictions_id') - if restrictions_parity_id: - restrictions_parity_id = int(restrictions_parity_id) + restrictions_default_id = self.env['ir.default'].sudo().get( + 'res.config.settings', 'default_restrictions_id') + if restrictions_default_id: + restrictions_default_id = int(restrictions_default_id) # Construct dictionary with relevant info of removed records unlink_vals = [] for record in self: - if record.restriction_id.id != restrictions_parity_id or \ + if record.restriction_id.id != restrictions_default_id or \ record.applied_on != '0_room_type': continue unlink_vals.append({ diff --git a/hotel_calendar/models/inherited_ir_default.py b/hotel_calendar/models/inherited_ir_default.py index ce5cf8f98..baf735d36 100644 --- a/hotel_calendar/models/inherited_ir_default.py +++ b/hotel_calendar/models/inherited_ir_default.py @@ -10,7 +10,7 @@ class IrDefault(models.Model): @api.model def set(self, model_name, field_name, value, user_id=False, company_id=False, condition=False): super(IrDefault, self).set(model_name, field_name, value, user_id, company_id, condition) - if model_name == 'res.config.settings' and field_name == 'parity_pricelist_id': + if model_name == 'res.config.settings' and field_name == 'default_pricelist_id': pricelist_id = int(value) self.env['room.pricelist.cached'].search([]).unlink() diff --git a/hotel_calendar/models/inherited_product_pricelist_item.py b/hotel_calendar/models/inherited_product_pricelist_item.py index 5489bc22c..0c025e27e 100644 --- a/hotel_calendar/models/inherited_product_pricelist_item.py +++ b/hotel_calendar/models/inherited_product_pricelist_item.py @@ -9,17 +9,17 @@ class ProductPricelistItem(models.Model): @api.model def create(self, vals): res = super(ProductPricelistItem, self).create(vals) - pricelist_parity_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_pricelist_id') - if pricelist_parity_id: - pricelist_parity_id = int(pricelist_parity_id) + pricelist_default_id = self.env['ir.default'].sudo().get( + 'res.config.settings', 'default_pricelist_id') + if pricelist_default_id: + pricelist_default_id = int(pricelist_default_id) pricelist_id = res.pricelist_id.id product_tmpl_id = res.product_tmpl_id.id date_start = res.date_start 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 room_type: + if pricelist_id == pricelist_default_id and room_type: prod = room_type.product_id.with_context( quantity=1, date=date_start, @@ -51,10 +51,10 @@ class ProductPricelistItem(models.Model): @api.multi def write(self, vals): - pricelist_parity_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_pricelist_id') - if pricelist_parity_id: - pricelist_parity_id = int(pricelist_parity_id) + pricelist_default_id = self.env['ir.default'].sudo().get( + 'res.config.settings', 'default_pricelist_id') + if pricelist_default_id: + pricelist_default_id = int(pricelist_default_id) ret_vals = super(ProductPricelistItem, self).write(vals) room_pr_cached_obj = self.env['room.pricelist.cached'] @@ -64,7 +64,7 @@ class ProductPricelistItem(models.Model): for record in self: pricelist_id = vals.get('pricelist_id') or \ record.pricelist_id.id - if pricelist_id != pricelist_parity_id: + if pricelist_id != pricelist_default_id: continue date_start = vals.get('date_start') or record.date_start product_tmpl_id = vals.get('product_tmpl_id') or \ @@ -104,14 +104,14 @@ class ProductPricelistItem(models.Model): @api.multi def unlink(self): - pricelist_parity_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_pricelist_id') - if pricelist_parity_id: - pricelist_parity_id = int(pricelist_parity_id) + pricelist_default_id = self.env['ir.default'].sudo().get( + 'res.config.settings', 'default_pricelist_id') + if pricelist_default_id: + pricelist_default_id = int(pricelist_default_id) # Construct dictionary with relevant info of removed records unlink_vals = [] for record in self: - if record.pricelist_id.id != pricelist_parity_id: + if record.pricelist_id.id != pricelist_default_id: continue room_type = self.env['hotel.room.type'].search([ ('product_id.product_tmpl_id', '=', record.product_tmpl_id.id) diff --git a/hotel_calendar/tests/common.py b/hotel_calendar/tests/common.py index 7b3f0cccd..ca7b61af7 100644 --- a/hotel_calendar/tests/common.py +++ b/hotel_calendar/tests/common.py @@ -31,8 +31,8 @@ class TestHotelCalendar(TestHotel): # Minimal Hotel Calendar Configuration cls.tz_hotel = 'Europe/Madrid' - cls.parity_pricelist_id = cls.pricelist_1.id - cls.parity_restrictions_id = cls.restriction_1.id + cls.default_pricelist_id = cls.pricelist_1.id + cls.default_restrictions_id = cls.restriction_1.id cls.env['ir.default'].sudo().set_default('res.config.settings', 'default_arrival_hour', '14:00') diff --git a/hotel_calendar/tests/test_management_calendar.py b/hotel_calendar/tests/test_management_calendar.py index ed86204a9..ba4c42cf5 100644 --- a/hotel_calendar/tests/test_management_calendar.py +++ b/hotel_calendar/tests/test_management_calendar.py @@ -45,8 +45,8 @@ class TestManagementCalendar(TestHotelCalendar): hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, True) for room_type in room_types: for k_pr, v_pr in hcal_data['prices'].iteritems(): @@ -67,7 +67,7 @@ class TestManagementCalendar(TestHotelCalendar): self.hotel_room_type_special.product_id.product_tmpl_id.id ) pr_ids = prices_obj.search([ - ('pricelist_id', '=', self.parity_pricelist_id), + ('pricelist_id', '=', self.default_pricelist_id), ('product_tmpl_id', 'in', prod_tmpl_ids), ]) pr_ids.sudo(self.user_hotel_manager).unlink() @@ -75,8 +75,8 @@ class TestManagementCalendar(TestHotelCalendar): hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, True) self.assertFalse(any(hcal_data['prices']), "Hotel Calendar Management \ Prices doesn't match after remove!") @@ -92,8 +92,8 @@ class TestManagementCalendar(TestHotelCalendar): hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, True) for room_type in room_types: for k_pr, v_pr in hcal_data['restrictions'].iteritems(): @@ -113,7 +113,7 @@ class TestManagementCalendar(TestHotelCalendar): self.user_hotel_manager) rest_ids = rest_it_obj.search([ ('applied_on', '=', '0_room_type'), - ('restriction_id', '=', self.parity_restrictions_id), + ('restriction_id', '=', self.default_restrictions_id), ('room_type_id', 'in', (self.hotel_room_type_budget.id, self.hotel_room_type_special.id)), ]) @@ -122,8 +122,8 @@ class TestManagementCalendar(TestHotelCalendar): hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, True) self.assertFalse( any(hcal_data['restrictions']), @@ -143,8 +143,8 @@ class TestManagementCalendar(TestHotelCalendar): hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, True) for room_type in room_types: for k_pr, v_pr in hcal_data['availability'].iteritems(): @@ -168,8 +168,8 @@ class TestManagementCalendar(TestHotelCalendar): hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, True) for room_type in room_types: for k_pr, v_pr in hcal_data['availability'].iteritems(): @@ -191,8 +191,8 @@ class TestManagementCalendar(TestHotelCalendar): hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, True) for room_type in room_types: for k_pr, v_pr in hcal_data['availability'].iteritems(): @@ -260,8 +260,8 @@ class TestManagementCalendar(TestHotelCalendar): # Save new values hotel_cal_mngt_obj.save_changes( - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, cprices, crestrictions, cavails) @@ -270,8 +270,8 @@ class TestManagementCalendar(TestHotelCalendar): hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, True) for room_type in room_types: @@ -347,8 +347,8 @@ class TestManagementCalendar(TestHotelCalendar): hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, True) avail_end_utc_dt = reserv_end_utc_dt - timedelta(days=1) @@ -376,22 +376,22 @@ class TestManagementCalendar(TestHotelCalendar): hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( False, adv_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT), - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, True) with self.assertRaises(ValidationError): hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( now_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT), False, - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, True) with self.assertRaises(ValidationError): hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( False, False, - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, True) hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), @@ -400,7 +400,7 @@ class TestManagementCalendar(TestHotelCalendar): False, True) self.assertTrue(any(hcal_data), "Hotel Calendar invalid default \ - management parity models!") + management default models!") def test_calendar_settings(self): hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo( diff --git a/hotel_calendar/tests/test_product_pricelist.py b/hotel_calendar/tests/test_product_pricelist.py index 21695e173..b1a86099a 100644 --- a/hotel_calendar/tests/test_product_pricelist.py +++ b/hotel_calendar/tests/test_product_pricelist.py @@ -34,7 +34,7 @@ class TestProductPricelist(TestHotelCalendar): pritem_obj = self.env['product.pricelist.item'] plitem = pritem_obj.search([ - ('pricelist_id', '=', self.parity_pricelist_id), + ('pricelist_id', '=', self.default_pricelist_id), ('product_tmpl_id', '=', room_type_tmpl_id.id), ('date_start', '=', now_utc_str), ('date_end', '=', now_utc_str), @@ -49,7 +49,7 @@ class TestProductPricelist(TestHotelCalendar): 999.9) plitem = pritem_obj.search([ - ('pricelist_id', '=', self.parity_pricelist_id), + ('pricelist_id', '=', self.default_pricelist_id), ('product_tmpl_id', '=', room_type_tmpl_id.id), ('date_start', '=', now_utc_str), ('date_end', '=', now_utc_str), diff --git a/hotel_calendar/tests/test_reservations_calendar.py b/hotel_calendar/tests/test_reservations_calendar.py index 9fc4d09d2..fb149f2f1 100644 --- a/hotel_calendar/tests/test_reservations_calendar.py +++ b/hotel_calendar/tests/test_reservations_calendar.py @@ -78,7 +78,7 @@ class TestReservationsCalendar(TestHotelCalendar): pricelist_item_obj = self.env['product.pricelist.item'].sudo( self.user_hotel_manager) pr_ids = pricelist_item_obj.search([ - ('pricelist_id', '=', self.parity_pricelist_id), + ('pricelist_id', '=', self.default_pricelist_id), ('product_tmpl_id', 'in', ( self.hotel_room_type_budget.product_id.product_tmpl_id.id, self.hotel_room_type_special.product_id.product_tmpl_id.id)), diff --git a/hotel_channel_connector/controllers/main.py b/hotel_channel_connector/controllers/main.py index 313d970f6..451081f97 100644 --- a/hotel_channel_connector/controllers/main.py +++ b/hotel_channel_connector/controllers/main.py @@ -81,20 +81,20 @@ class website_wubook(http.Controller): if wubook_obj.init_connection(): wubook_obj.fetch_rooms_values(dfrom, dto) - parity_restr_id = request.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_restrictions_id') - if parity_restr_id: + default_restr_id = request.env['ir.default'].sudo().get( + 'res.config.settings', 'default_restrictions_id') + if default_restr_id: room_type_restr_obj = request.env['hotel.room.type.restriction'] - restr_id = room_type_restr_obj.sudo().browse(int(parity_restr_id)) + restr_id = room_type_restr_obj.sudo().browse(int(default_restr_id)) if restr_id and restr_id.wpid and restr_id.wpid != '0': wubook_obj.fetch_rplan_restrictions(dfrom, dto, rpid=restr_id.wpid) - parity_pricelist_id = request.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_pricelist_id') - if parity_pricelist_id: + default_pricelist_id = request.env['ir.default'].sudo().get( + 'res.config.settings', 'default_pricelist_id') + if default_pricelist_id: pricelist_id = request.env['product.pricelist'].sudo().browse( - int(parity_pricelist_id)) + int(default_pricelist_id)) if pricelist_id and pricelist_id.wpid: wubook_obj.fetch_plan_prices(pricelist_id.wpid, dfrom, dto) wubook_obj.close_connection() diff --git a/hotel_channel_connector/i18n/es.po b/hotel_channel_connector/i18n/es.po index 0c7d89a28..21340a9a9 100644 --- a/hotel_channel_connector/i18n/es.po +++ b/hotel_channel_connector/i18n/es.po @@ -201,7 +201,7 @@ msgstr "Información de canales importada con éxito" #. module: hotel_wubook_proto #: code:addons/hotel_wubook_proto/wizard/wubook_installer.py:95 #, python-format -msgid "Configure Hotel Parity" +msgid "Configure Hotel Default" msgstr "Configurar paridad del hotel" #. module: hotel_wubook_proto @@ -229,7 +229,7 @@ msgstr "Continuar" #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_channel_info_create_uid #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_config_settings_create_uid #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_create_uid -#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_parity_create_uid +#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_default_create_uid #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_issue_create_uid #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_wizard_availability_create_uid #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_wizard_plan_prices_create_uid @@ -241,7 +241,7 @@ msgstr "Creado por" #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_channel_info_create_date #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_config_settings_create_date #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_create_date -#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_parity_create_date +#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_default_create_date #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_issue_create_date #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_wizard_availability_create_date #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_wizard_plan_prices_create_date @@ -250,12 +250,12 @@ msgid "Created on" msgstr "Creado en" #. module: hotel_wubook_proto -#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_parity_date_end +#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_default_date_end msgid "Date End" msgstr "Fecha finalización" #. module: hotel_wubook_proto -#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_parity_date_start +#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_default_date_start msgid "Date Start" msgstr "Fecha de inicio" @@ -264,7 +264,7 @@ msgstr "Fecha de inicio" #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_config_settings_display_name #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_display_name #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_display_name -#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_parity_display_name +#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_default_display_name #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_issue_display_name #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_wizard_availability_display_name #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_wizard_plan_prices_display_name @@ -361,7 +361,7 @@ msgid "Fetch from WuBook" msgstr "Recuperar de WuBook" #. module: hotel_wubook_proto -#: model:ir.ui.view,arch_db:hotel_wubook_proto.view_wubook_configuration_installer_parity +#: model:ir.ui.view,arch_db:hotel_wubook_proto.view_wubook_configuration_installer_default msgid "Finish Installation" msgstr "Finalizar instalación" @@ -375,7 +375,7 @@ msgstr "De" #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_config_settings_id #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_id #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_id -#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_parity_id +#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_default_id #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_issue_id #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_wizard_availability_id #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_wizard_plan_prices_id @@ -396,7 +396,7 @@ msgid "Import Availability" msgstr "Importar Disponibilidad" #. module: hotel_wubook_proto -#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_parity_import_data +#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_default_import_data msgid "Import Data From WuBook" msgstr "Importar datos de WuBook" @@ -475,7 +475,7 @@ msgstr "LCode" #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_channel_info___last_update #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_config_settings___last_update #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer___last_update -#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_parity___last_update +#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_default___last_update #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_issue___last_update #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_wizard_availability___last_update #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_wizard_plan_prices___last_update @@ -486,7 +486,7 @@ msgstr "Última modificación en" #. module: hotel_wubook_proto #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_channel_info_write_uid #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_config_settings_write_uid -#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_parity_write_uid +#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_default_write_uid #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_write_uid #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_issue_write_uid #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_wizard_availability_write_uid @@ -498,7 +498,7 @@ msgstr "Última actualización por" #. module: hotel_wubook_proto #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_channel_info_write_date #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_config_settings_write_date -#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_parity_write_date +#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_default_write_date #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_write_date #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_issue_write_date #: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_wizard_availability_write_date @@ -657,7 +657,7 @@ msgid "Pricelist item" msgstr "Elemento Tarifa" #. module: hotel_wubook_proto -#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_parity_parity_pricelist_id +#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_default_default_pricelist_id msgid "Product Pricelist" msgstr "Lista de precios del producto" @@ -700,7 +700,7 @@ msgid "Restriction Plans successfully imported" msgstr "Planes de precios importados con éxito" #. module: hotel_wubook_proto -#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_parity_parity_restrictions_id +#: model:ir.model.fields,field_description:hotel_wubook_proto.field_wubook_installer_default_default_restrictions_id msgid "Restrictions" msgstr "Restricciones" @@ -769,7 +769,7 @@ msgstr "" "Entrada: %d\\Límite: %d" #. module: hotel_wubook_proto -#: model:ir.ui.view,arch_db:hotel_wubook_proto.view_wubook_configuration_installer_parity +#: model:ir.ui.view,arch_db:hotel_wubook_proto.view_wubook_configuration_installer_default msgid "These models are used as masters" msgstr "Estos modelos se usan como maestros" @@ -855,8 +855,8 @@ msgid "WuBook Configuration" msgstr "WuBook Configuración" #. module: hotel_wubook_proto -#: model:ir.ui.view,arch_db:hotel_wubook_proto.view_wubook_configuration_installer_parity -msgid "WuBook Configuration Parity" +#: model:ir.ui.view,arch_db:hotel_wubook_proto.view_wubook_configuration_installer_default +msgid "WuBook Configuration Default" msgstr "Paridad de configuración de WuBook" #. module: hotel_wubook_proto @@ -1096,9 +1096,9 @@ msgid "wubook.installer" msgstr "wubook.installer" #. module: hotel_wubook_proto -#: model:ir.model,name:hotel_wubook_proto.model_wubook_installer_parity -msgid "wubook.installer.parity" -msgstr "wubook.installer.parity" +#: model:ir.model,name:hotel_wubook_proto.model_wubook_installer_default +msgid "wubook.installer.default" +msgstr "wubook.installer.default" #. module: hotel_wubook_proto #: model:ir.model,name:hotel_wubook_proto.model_wubook_issue diff --git a/hotel_channel_connector/models/channel_backend/common.py b/hotel_channel_connector/models/channel_backend/common.py index 4d1b12e2d..068d03065 100644 --- a/hotel_channel_connector/models/channel_backend/common.py +++ b/hotel_channel_connector/models/channel_backend/common.py @@ -218,11 +218,11 @@ class ChannelBackend(models.Model): 'wstatus': 0 }) - # Get Parity Models + # Get Default Models pricelist_id = int(self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_pricelist_id')) + 'res.config.settings', 'default_pricelist_id')) restriction_id = int(self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_restrictions_id')) + 'res.config.settings', 'default_restrictions_id')) room_type_restr_it_obj = self.env['hotel.room.type.restriction.item'] # Secure Wubook Input diff --git a/hotel_channel_connector/tests/test_hotel_calendar_management_model.py b/hotel_channel_connector/tests/test_hotel_calendar_management_model.py index 6baeaca53..344098c24 100644 --- a/hotel_channel_connector/tests/test_hotel_calendar_management_model.py +++ b/hotel_channel_connector/tests/test_hotel_calendar_management_model.py @@ -86,8 +86,8 @@ class TestHotelCalendarManagement(TestHotelWubook): # Save new values hotel_cal_mngt_obj.save_changes( - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, cprices, crestrictions, cavails) @@ -96,8 +96,8 @@ class TestHotelCalendarManagement(TestHotelWubook): hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.parity_pricelist_id, - self.parity_restrictions_id, + self.default_pricelist_id, + self.default_restrictions_id, True) for room_type in room_types: diff --git a/hotel_channel_connector/tests/test_product_pricelist_item_model.py b/hotel_channel_connector/tests/test_product_pricelist_item_model.py index eacd24063..8e35477d8 100644 --- a/hotel_channel_connector/tests/test_product_pricelist_item_model.py +++ b/hotel_channel_connector/tests/test_product_pricelist_item_model.py @@ -36,11 +36,11 @@ class TestProductPricelistItem(TestHotelWubook): budget_product_id = self.hotel_room_type_budget.product_id pr_item_obj = self.env['product.pricelist.item'] - parity_pricelist = self.env['product.pricelist'].browse([ - self.parity_pricelist_id]) - parity_pricelist.write({'wpid': 1234}) + default_pricelist = self.env['product.pricelist'].browse([ + self.default_pricelist_id]) + default_pricelist.write({'wpid': 1234}) pricelist_item = pr_item_obj.sudo(self.user_hotel_manager).create({ - 'pricelist_id': self.parity_pricelist_id, + 'pricelist_id': self.default_pricelist_id, 'date_start': day_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), 'date_end': day_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), 'compute_price': 'fixed', @@ -57,11 +57,11 @@ class TestProductPricelistItem(TestHotelWubook): budget_product_id = self.hotel_room_type_budget.product_id pr_item_obj = self.env['product.pricelist.item'] - parity_pricelist = self.env['product.pricelist'].browse([ - self.parity_pricelist_id]) - parity_pricelist.write({'wpid': 1234}) + default_pricelist = self.env['product.pricelist'].browse([ + self.default_pricelist_id]) + default_pricelist.write({'wpid': 1234}) pricelist_item = pr_item_obj.sudo(self.user_hotel_manager).create({ - 'pricelist_id': self.parity_pricelist_id, + 'pricelist_id': self.default_pricelist_id, 'date_start': day_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), 'date_end': day_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), 'compute_price': 'fixed', diff --git a/hotel_channel_connector/tests/test_product_pricelist_model.py b/hotel_channel_connector/tests/test_product_pricelist_model.py index 63abc6438..484f9a786 100644 --- a/hotel_channel_connector/tests/test_product_pricelist_model.py +++ b/hotel_channel_connector/tests/test_product_pricelist_model.py @@ -26,9 +26,9 @@ from .common import TestHotelWubook class TestProductPricelist(TestHotelWubook): def test_get_wubook_prices(self): - parity_pricelist = self.env['product.pricelist'].browse([ - self.parity_pricelist_id]) - wprices = parity_pricelist.sudo( + default_pricelist = self.env['product.pricelist'].browse([ + self.default_pricelist_id]) + wprices = default_pricelist.sudo( self.user_hotel_manager).get_wubook_prices() self.assertTrue(any(wprices), "Can't get any price for wubook") @@ -40,31 +40,31 @@ class TestProductPricelist(TestHotelWubook): self.assertTrue(npricelist, "Can't create test pricelist") def test_write(self): - parity_pricelist = self.env['product.pricelist'].browse([ - self.parity_pricelist_id]) - parity_pricelist.sudo(self.user_hotel_manager).write({ + default_pricelist = self.env['product.pricelist'].browse([ + self.default_pricelist_id]) + default_pricelist.sudo(self.user_hotel_manager).write({ 'name': 'Pricelist Test New Name #1' }) self.assertEqual( - parity_pricelist.name, + default_pricelist.name, 'Pricelist Test New Name #1', 'Invalid pricelist name') def test_unlink(self): - parity_pricelist = self.env['product.pricelist'].browse([ - self.parity_pricelist_id]) - parity_pricelist.sudo(self.user_hotel_manager).unlink() + default_pricelist = self.env['product.pricelist'].browse([ + self.default_pricelist_id]) + default_pricelist.sudo(self.user_hotel_manager).unlink() def test_import_price_plans(self): - parity_pricelist = self.env['product.pricelist'].browse([ - self.parity_pricelist_id]) - parity_pricelist.import_price_plans() + default_pricelist = self.env['product.pricelist'].browse([ + self.default_pricelist_id]) + default_pricelist.import_price_plans() def test_name_get(self): - parity_pricelist = self.env['product.pricelist'].browse([ - self.parity_pricelist_id]) - rest_name = parity_pricelist.sudo(self.user_hotel_manager).name_get() + default_pricelist = self.env['product.pricelist'].browse([ + self.default_pricelist_id]) + rest_name = default_pricelist.sudo(self.user_hotel_manager).name_get() self.assertTrue('WuBook' in rest_name[0][1], 'Invalid Name') - parity_pricelist.sudo(self.user_hotel_manager).write({'wpid': ''}) - rest_name = parity_pricelist.sudo(self.user_hotel_manager).name_get() + default_pricelist.sudo(self.user_hotel_manager).write({'wpid': ''}) + rest_name = default_pricelist.sudo(self.user_hotel_manager).name_get() self.assertFalse('WuBook' in rest_name[0][1], 'Invalid Name')