From 02d8d73f39343a52422f8397436d31cfbfa8a755 Mon Sep 17 00:00:00 2001 From: Richard Pentecost Date: Wed, 8 May 2024 15:05:14 +0100 Subject: [PATCH] delete existing payments on paid order seeded in database --- datahub/omis/order/management/commands/set_order_as_paid.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/datahub/omis/order/management/commands/set_order_as_paid.py b/datahub/omis/order/management/commands/set_order_as_paid.py index a17961f30..906ebfbb3 100644 --- a/datahub/omis/order/management/commands/set_order_as_paid.py +++ b/datahub/omis/order/management/commands/set_order_as_paid.py @@ -5,6 +5,7 @@ from datahub.company.models import Advisor, Contact from datahub.omis.order.models import Order from datahub.omis.order.serializers import OrderAssigneeSerializer +from datahub.omis.payment.models import Payment class Command(BaseCommand): @@ -35,7 +36,10 @@ def handle(self, *args, **options): serializer.is_valid(raise_exception=True) serializer.save() order.generate_quote(user, True) + order.accept_quote(by=contact) + Payment.objects.filter(order=order).delete() + order.mark_as_paid(by=user, payments_data=[ { 'amount': 50000,