Commits

Joel Mohler  committed 73fafcd

reservations with empty serial list bug

  • Participants
  • Parent commits a9e3352

Comments (0)

Files changed (1)

File camprental/RentalSchema.py

     def maintenance_status_get(self):
         my_reservation = self.det_line.Reservation
         session = self.session().__class__()
-        reservations = session.query(Reservation.id, Reservation.job_name, Reservation.ticket, Reservation.checkout_date, Reservation.return_date) \
+        if my_reservation.checkout_date is None or my_reservation.return_date is None:
+            reservations = []
+        else:
+            reservations = session.query(Reservation.id, Reservation.job_name, Reservation.ticket, Reservation.checkout_date, Reservation.return_date) \
                 .join(ReservationItems).filter(ReservationItems.item_id==self.item.id) \
                 .filter(Reservation.id!=my_reservation.id) \
                 .filter(expr.and_(Reservation.return_date>=my_reservation.checkout_date,Reservation.checkout_date<=my_reservation.return_date)) \
     session.add(row)
     session.commit()
 
+    # add an inventory item
+    session = session_source()
+    row = Inventory()
+    row.name = 'CANOE8'
+    row.description = "8 Foot Canoe"
+    row.serialized = True
+    session.add(row)
+    session.commit()
+
     session= session_source()
     res = Reservation(ssrc=session_source)
     session.add(res)