def handle(self, *args, **options):
        """
        Process Procurement Orders
        """
        packings = Packing.objects.all()
        for packing in packings:
            packing.delete()

        procurements = Procurement.objects.all()
        process_procurement_orders(procurements)
        
Exemple #2
0
def create_packing_orders(request):
    """
    Generates packing from procurements
    """

    shop = Shop.objects.get()

    # Delete previous packing/invoices
    # TODO: Keep them! But make sure they get closed
    management.call_command('reset', 'fulfilment', noinput=True, verbosity=0, interactive=False);
    management.call_command('reset', 'invoices', noinput=True, verbosity=0, interactive=False);

    # Create packing
    # TODO: Select the shop only
    print "Creating packing..."
    procurements = Procurement.objects.all()
    packings = process_procurement_orders(procurements)

    # Set packing item defaults
    print "Setting item defaults..."
    items = PackingItem.objects.filter(packing__in=packings)
    packing_item_defaults(items)

    return HttpResponseRedirect('/')