12345678910111213141516171819202122232425262728293031323334353637 |
- # -*- coding: utf-8 -*-
- from __future__ import unicode_literals
- # Standard python libs
- import logging
- # Django specific imports
- from argparse import RawTextHelpFormatter
- from django.core.management.base import BaseCommand, CommandError
- # Coin specific imports
- from coin.billing.models import Invoice
- class Command(BaseCommand):
- help = """
- Send a reminder to members for invoices which are due and not paid since a few
- weeks.
- """
- def create_parser(self, *args, **kwargs):
- parser = super(Command, self).create_parser(*args, **kwargs)
- parser.formatter_class = RawTextHelpFormatter
- return parser
- def handle(self, *args, **options):
- invoices = Invoice.objects.filter(status="open")
- for invoice in invoices:
- if not invoice.reminder_needed():
- continue
- invoice.send_reminder(auto=True)
|