Coverage for app/venv/lib/python3.14/site-packages/weblate/billing/management/commands/extend_pending.py: 0%

12 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 07:15 +0000

1# Copyright © Michal Čihař <michal@weblate.org> 

2# 

3# SPDX-License-Identifier: GPL-3.0-or-later 

4 

5from datetime import timedelta 

6 

7from django.utils import timezone 

8 

9from weblate.billing.models import Billing 

10from weblate.utils.management.base import BaseCommand 

11 

12 

13class Command(BaseCommand): 

14 """Command for billing check.""" 

15 

16 help = "extend pending approval billings" 

17 

18 def handle(self, *args, **options) -> None: 

19 pending = [ 

20 bill 

21 for bill in Billing.objects.filter(state=Billing.STATE_TRIAL) 

22 if bill.payment.get("libre_request") 

23 ] 

24 for bill in pending: 

25 bill.expiry = timezone.now() + timedelta(days=9 * 7) 

26 bill.removal = None 

27 Billing.objects.bulk_update(pending, ["expiry", "removal"])