add new command
This commit is contained in:
11
core/apps/orders/management/commands/update_party.py
Normal file
11
core/apps/orders/management/commands/update_party.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from django.core.management import BaseCommand
|
||||
|
||||
from core.apps.orders.models import Party, PartyAmount
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
parties = Party.objects.all()
|
||||
for party in parties:
|
||||
party.party_amount.payment_amount = party.party_amount.total_price - party.party_amount.paid_amount
|
||||
self.stdout.write("Parties updated")
|
||||
Reference in New Issue
Block a user