def post_save_post_delete_bookingextra(sender, instance, **kwargs): if not hasattr(instance, 'avoid_all'): with transaction.atomic(savepoint=False): if not hasattr(instance, 'avoid_booking_update'): BookingServices.update_booking(instance) if not hasattr(instance, 'avoid_bookingpackage_update'): BookingServices.update_bookingpackage(instance)
def post_save_quoteservice(instance): if not hasattr(instance, 'avoid_all'): with transaction.atomic(savepoint=False): BookingServices.update_quoteservice_paxvariants_amounts(instance) if instance.quote_package: BookingServices.update_quotepackage_service_pax_variants_amounts(instance) BookingServices.update_quotepackage(instance) BookingServices.update_quote(instance)
def get_distribution(booking_service): rooms = BookingServices.find_groups(booking_service=booking_service, service=booking_service.service, for_cost=True) dist = '' room_count = { '10': 0, # SGL counter '20': 0, # DBL counter '30': 0, # TPL counter '21': 0, # DBL+1Child '22': 0, # DBL+2Child '31': 0, # TPL+1Child } room_types = { '10': 'SGL', '20': 'DBL', '30': 'TPL', '21': 'DBL&1Chld', '22': 'DBL&2Chld', '31': 'TPL&1Chld', } for room in rooms: try: room_count['%d%d' % (room[0], room[1])] += 1 except KeyError: # unknown room type. skip pass for k in room_count.keys(): if room_count[k]: if dist: dist += ' + ' dist += '%d %s' % (room_count[k], room_types[k]) dist += ' ({} {})'.format(booking_service.room_type, booking_service.board_type) return dist
def post_save_post_delete_bookingservicepax(sender, instance, **kwargs): if not hasattr(instance, 'avoid_bookingservice_update'): with transaction.atomic(savepoint=False): BookingServices.update_bookingservice_amounts(instance.booking_service)
def post_save_quotepackage(sender, instance, **kwargs): if not hasattr(instance, 'avoid_all'): with transaction.atomic(savepoint=False): BookingServices.update_quoteservice_paxvariants_amounts(instance) BookingServices.sync_quotepackage_services(instance) BookingServices.update_quote(instance)
def post_delete_quoteservice_paxvariant(sender, instance, **kwargs): if not hasattr(instance, 'avoid_all'): with transaction.atomic(savepoint=False): BookingServices.update_quote_paxvariant_amounts(instance)
def post_save_quoteservice_paxvariant(sender, instance, **kwargs): if not hasattr(instance, 'avoid_all'): with transaction.atomic(savepoint=False): if instance.quote_service.base_category == QUOTE_SERVICE_CATEGORY_QUOTE_PACKAGE: BookingServices.sync_quotepackage_children_paxvariants(instance) BookingServices.update_quote_paxvariant_amounts(instance)
def pre_save_quoteservice_paxvariant_setup_amounts(sender, instance, **kwargs): if not hasattr(instance, 'avoid_all'): BookingServices.setup_paxvariant_amounts(instance)
def post_save_quote_paxvariant(sender, instance, **kwargs): if not hasattr(instance, 'code_updated') and not hasattr(instance, 'avoid_all'): with transaction.atomic(savepoint=False): BookingServices.sync_quote_children_paxvariants(instance)
def pre_save_bookingextra(sender, instance, **kwargs): if not hasattr(instance, 'avoid_all') and not hasattr(instance, 'avoid_update'): BookingServices.setup_bookingservice_amounts(instance) BookingServices.validate_basebookingservice(instance)