Exemplo n.º 1
0
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('/')
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
 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)
     
Exemplo n.º 4
0
    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)