Example #1
0
 def process_one(self, request, picklist=None):
     if picklist is not None:
         if process_picklist(picklist):
             self.message_user(request, '%s was processed!' % picklist.name)
         else:
             self.message_user(request, '%s was not processed!' % picklist.name)
     else:
         return None
Example #2
0
 def process_one(self, request, picklist=None):
     if picklist is not None:
         if process_picklist(picklist):
             self.message_user(request, '%s was processed!' % picklist.name)
         else:
             self.message_user(request, '%s was not processed!' % picklist.name)
     else:
         return None
Example #3
0
 def test_process_picklist(self):
     # confirm both jars are marked available and active
     sip1a = Product.active.get(slug="sip-1-a")
     self.assertEqual(sip1a.jar_set.filter(is_active=True).count(), 14)
     self.assertEqual(sip1a.jar_set.filter(is_available=True).count(), 14)
     # generate valid picklist from order #1
     picklist = create_picklist(self.order)
     retval = process_picklist(picklist)
     self.assertEqual(retval, True)
     # check that jars are no longer active
     self.assertEqual(sip1a.jar_set.filter(is_active=True).count(), 12)
     # check status of picklist
     self.assertEqual(picklist.status, PickList.PROCESSED)
     # check status of order
     self.assertEqual(self.order.status, Order.DELIVERED)
     # process it again
     # (should fail as status should have changed)
     retval2 = process_picklist(picklist)
     self.assertEqual(retval2, False)
Example #4
0
 def test_process_picklist(self):
     # confirm both jars are marked available and active
     sip1a = Product.active.get(slug='sip-1-a')
     self.assertEqual(sip1a.jar_set.filter(is_active=True).count(), 14)
     self.assertEqual(sip1a.jar_set.filter(is_available=True).count(), 14)
     # generate valid picklist from order #1
     picklist = create_picklist(self.order)
     retval = process_picklist(picklist)
     self.assertEqual(retval, True)
     # check that jars are no longer active
     self.assertEqual(sip1a.jar_set.filter(is_active=True).count(), 12)
     # check status of picklist
     self.assertEqual(picklist.status, PickList.PROCESSED)
     # check status of order
     self.assertEqual(self.order.status, Order.DELIVERED)
     # process it again
     # (should fail as status should have changed)
     retval2 = process_picklist(picklist)
     self.assertEqual(retval2, False)
Example #5
0
 def make_processed(self, request, queryset):
     picklists_processed = 0
     for picklist in queryset:
         if (process_picklist(picklist)):
             picklists_processed += 1
     if picklists_processed == 0:
         self.message_user(request, 'No picklists were processed!')
     else:
         if picklists_processed == 1:
             self.message_user(request, 'One picklist was processed!')
         else:
             self.message_user(request, '%d picklists were processed!' % picklists_processed)
Example #6
0
 def make_processed(self, request, queryset):
     picklists_processed = 0
     for picklist in queryset:
         if (process_picklist(picklist)):
             picklists_processed += 1
     if picklists_processed == 0:
         self.message_user(request, 'No picklists were processed!')
     else:
         if picklists_processed == 1:
             self.message_user(request, 'One picklist was processed!')
         else:
             self.message_user(request, '%d picklists were processed!' % picklists_processed)