def create_invoices(request): """ Generates packing from procurements """ shop = Shop.objects.get() # TODO: Select from shop only packings = Packing.objects.all() process_packings(packings) return HttpResponseRedirect('/')
def handle(self, *args, **options): """ Process Procurement Orders """ invoices = Invoice.objects.all() for invoice in invoices: print u"%s deleted" % invoice invoice.delete() packings = Packing.objects.all() process_packings(packings) invoices = Invoice.objects.all() create_invoices(invoices)
def handle(self, *args, **options): """ Process Procurement Orders """ Invoice.objects.all().delete() # for invoice in invoices: # print u'%s deleted' % invoice # invoice.delete() packings = Packing.objects.all() process_packings(packings) # invoices = Invoice.objects.all() # create_invoices(invoices)
def generate_invoices(self, request, queryset): packing_count = process_packings(queryset) packing_errors = len(queryset) - packing_count success_message = "Generated invoices for %s packing item(s)" % packing_count error_message = ( "Could not create invoices for %s packing item(s) because they were not fulfilled" % packing_errors ) if packing_count > 0: self.message_user(request, success_message) if packing_errors > 0: self.message_user(request, error_message)