def cancel(self, user, reason=None, silent=False): self.is_cancelled = True self.rejection_reason = reason self.occurrences.filter_by(is_valid=True).update({'is_cancelled': True}, synchronize_session='fetch') if not silent: notify_cancellation(self) log_msg = u'Reservation cancelled: {}'.format(reason) if reason else 'Reservation cancelled' self.add_edit_log(ReservationEditLog(user_name=user.getFullName(), info=[log_msg]))
def cancel(self, user, reason=None, silent=False): self.is_cancelled = True self.rejection_reason = reason self.occurrences.filter_by(is_valid=True).update({'is_cancelled': True, 'rejection_reason': reason}, synchronize_session='fetch') if not silent: notify_cancellation(self) log_msg = u'Reservation cancelled: {}'.format(reason) if reason else 'Reservation cancelled' self.add_edit_log(ReservationEditLog(user_name=user.full_name, info=[log_msg]))
def cancel(self, user, reason=None, silent=False): self.is_cancelled = True self.rejection_reason = reason self.occurrences.filter_by(is_valid=True).update( {"is_cancelled": True, "rejection_reason": reason}, synchronize_session="fetch" ) if not silent: notify_cancellation(self) log_msg = u"Reservation cancelled: {}".format(reason) if reason else "Reservation cancelled" self.add_edit_log(ReservationEditLog(user_name=user.full_name, info=[log_msg]))
def cancel(self, user, reason=None, silent=False): self.state = ReservationState.cancelled self.rejection_reason = reason or None criteria = (ReservationOccurrence.is_valid, ReservationOccurrence.is_within_cancel_grace_period) self.occurrences.filter(*criteria).update({ ReservationOccurrence.state: ReservationOccurrenceState.cancelled, ReservationOccurrence.rejection_reason: reason }, synchronize_session='fetch') signals.rb.booking_state_changed.send(self) if not silent: notify_cancellation(self) log_msg = u'Reservation cancelled: {}'.format(reason) if reason else 'Reservation cancelled' self.add_edit_log(ReservationEditLog(user_name=user.full_name, info=[log_msg]))