mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] Added backend_id in searchs
This commit is contained in:
@@ -108,6 +108,7 @@ class HotelReservationImporter(Component):
|
||||
tprice += room_day_price
|
||||
# Get OTA
|
||||
ota_id = self.env['channel.ota.info'].search([
|
||||
('backend_id', '=', self.backend_record.id),
|
||||
('ota_id', '=', str(book['id_channel'])),
|
||||
], limit=1)
|
||||
|
||||
@@ -248,21 +249,25 @@ class HotelReservationImporter(Component):
|
||||
# Search Folio. If exists.
|
||||
folio_id = False
|
||||
if crcode != 'undefined':
|
||||
reserv_folio = channel_reserv_obj.search([
|
||||
('ota_reservation_id', '=', crcode)
|
||||
reserv_bind = channel_reserv_obj.search([
|
||||
('ota_reservation_id', '=', crcode),
|
||||
], limit=1)
|
||||
if reserv_folio:
|
||||
folio_id = reserv_folio.odoo_id.folio_id
|
||||
if reserv_bind:
|
||||
folio_id = reserv_bind.folio_id
|
||||
else:
|
||||
reserv_folio = channel_reserv_obj.search([
|
||||
('external_id', '=', rcode)
|
||||
reserv_bind = channel_reserv_obj.search([
|
||||
('backend_id', '=', self.backend_record.id),
|
||||
('external_id', '=', rcode),
|
||||
], limit=1)
|
||||
if reserv_folio:
|
||||
folio_id = reserv_folio.odoo_id.folio_id
|
||||
if reserv_bind:
|
||||
folio_id = reserv_bind.folio_id
|
||||
|
||||
# Need update reservations?
|
||||
reservs_processed = False
|
||||
reservs_binds = channel_reserv_obj.search([('external_id', '=', rcode)])
|
||||
reservs_binds = channel_reserv_obj.search([
|
||||
('backend_id', '=', self.backend_record.id),
|
||||
('external_id', '=', rcode),
|
||||
])
|
||||
for reserv_bind in reservs_binds:
|
||||
self._update_reservation_binding(reserv_bind, book)
|
||||
reservs_processed = True
|
||||
@@ -286,6 +291,7 @@ class HotelReservationImporter(Component):
|
||||
# Iterate booked rooms
|
||||
for broom in book['booked_rooms']:
|
||||
room_type_bind = channel_room_type_obj.search([
|
||||
('backend_id', '=', self.backend_record.id),
|
||||
('external_id', '=', broom['room_id'])
|
||||
], limit=1)
|
||||
if not room_type_bind:
|
||||
|
||||
@@ -38,7 +38,8 @@ class HotelRoomTypeImporter(Component):
|
||||
for room in results:
|
||||
map_record = room_mapper.map_record(room)
|
||||
room_bind = channel_room_type_obj.search([
|
||||
('external_id', '=', room['id'])
|
||||
('backend_id', '=', self.backend_record.id),
|
||||
('external_id', '=', room['id']),
|
||||
], limit=1)
|
||||
if room_bind:
|
||||
room_bind.with_context({'connector_no_export':True}).write(map_record.values())
|
||||
|
||||
@@ -34,7 +34,8 @@ class HotelRoomTypeRestrictionImporter(Component):
|
||||
for plan in results:
|
||||
plan_record = restriction_mapper.map_record(plan)
|
||||
plan_bind = channel_restriction_obj.search([
|
||||
('external_id', '=', str(plan['id']))
|
||||
('backend_id', '=', self.backend_record.id),
|
||||
('external_id', '=', str(plan['id'])),
|
||||
], limit=1)
|
||||
if not plan_bind:
|
||||
channel_restriction_obj.with_context({
|
||||
|
||||
@@ -32,12 +32,14 @@ class HotelRoomTypeRestrictionImporter(Component):
|
||||
_logger.info(plan_restrictions)
|
||||
for k_rpid, v_rpid in plan_restrictions.items():
|
||||
channel_restriction_id = channel_reserv_restriction_obj.search([
|
||||
('external_id', '=', k_rpid)
|
||||
('backend_id', '=', self.backend_record.id),
|
||||
('external_id', '=', k_rpid),
|
||||
], limit=1)
|
||||
if channel_restriction_id:
|
||||
for k_rid, v_rid in v_rpid.items():
|
||||
channel_room_type = channel_hotel_room_type_obj.search([
|
||||
('external_id', '=', k_rid)
|
||||
('backend_id', '=', self.backend_record.id),
|
||||
('external_id', '=', k_rid),
|
||||
], limit=1)
|
||||
if channel_room_type:
|
||||
for item in v_rid:
|
||||
|
||||
@@ -38,7 +38,8 @@ class ProductPricelistImporter(Component):
|
||||
continue # FIXME: Ignore Virtual Plans
|
||||
plan_record = pricelist_mapper.map_record(plan)
|
||||
plan_bind = channel_product_listprice_obj.search([
|
||||
('external_id', '=', str(plan['id']))
|
||||
('backend_id', '=', self.backend_record.id),
|
||||
('external_id', '=', str(plan['id'])),
|
||||
], limit=1)
|
||||
if not plan_bind:
|
||||
channel_product_listprice_obj.with_context({
|
||||
|
||||
@@ -26,7 +26,8 @@ class ProductPricelistItemImporter(Component):
|
||||
_logger.info(plan_prices)
|
||||
channel_hotel_room_type_obj = self.env['channel.hotel.room.type']
|
||||
pricelist_bind = self.env['channel.product.pricelist'].search([
|
||||
('external_id', '=', channel_plan_id)
|
||||
('backend_id', '=', self.backend_record.id),
|
||||
('external_id', '=', channel_plan_id),
|
||||
], limit=1)
|
||||
pricelist_item_mapper = self.component(
|
||||
usage='import.mapper',
|
||||
@@ -40,7 +41,8 @@ class ProductPricelistItemImporter(Component):
|
||||
ndate_dt = dfrom_dt + timedelta(days=i)
|
||||
for k_rid, v_rid in plan_prices.items():
|
||||
channel_room_type = channel_hotel_room_type_obj.search([
|
||||
('external_id', '=', k_rid)
|
||||
('backend_id', '=', self.backend_record.id),
|
||||
('external_id', '=', k_rid),
|
||||
], limit=1)
|
||||
if channel_room_type:
|
||||
ndate_str = ndate_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
|
||||
Reference in New Issue
Block a user