Commit ad1ab19a authored by Michal Čihař's avatar Michal Čihař

Calculate due date

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 641cfca3
...@@ -18,8 +18,11 @@ ...@@ -18,8 +18,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from datetime import timedelta
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.utils import timezone from django.utils import timezone
from weblate.billing.models import Billing from weblate.billing.models import Billing
...@@ -40,8 +43,9 @@ class Command(BaseCommand): ...@@ -40,8 +43,9 @@ class Command(BaseCommand):
' * {0}'.format(bill) ' * {0}'.format(bill)
) )
header = False header = False
due_date = timezone.now() - timedelta(days=30)
for bill in Billing.objects.filter(state=Billing.STATE_ACTIVE): for bill in Billing.objects.filter(state=Billing.STATE_ACTIVE):
if not bill.invoice_set.filter(end__gt=timezone.now()).exists(): if not bill.invoice_set.filter(end__gt=due_date).exists():
if not header: if not header:
self.stdout.write('Following billings are past due date:') self.stdout.write('Following billings are past due date:')
header = True header = True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment