Ejemplo n.º 1
0
    def handle(self, *args, **options):
        """
        Process Packing Items to CSV
        """

        packing_items = PackingItem.objects.all()
        packing_item_defaults(packing_items)
Ejemplo n.º 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('/')