From aa6dca71382eb6d8b351adb9dd034c91003e7d0e Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 12 Apr 2018 17:14:30 +0300 Subject: [PATCH 1/2] finance logging --- finance/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/finance/models.py b/finance/models.py index 5849def..8014373 100755 --- a/finance/models.py +++ b/finance/models.py @@ -99,8 +99,9 @@ class InvoiceRebilling(Invoice): bill=self.bill, comment=self.comment, method=self.method, - status=self.status, + status='W', is_open=self.is_open, + price=self.price, rebilling_on=False, expected_date=(timezone.now() + relativedelta(months=idx+1)), ) From 2ab0a525bbf1b8c6b4e3066d3f958da655b6286c Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 12 Apr 2018 17:25:55 +0300 Subject: [PATCH 2/2] finance logging --- finance/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/finance/views.py b/finance/views.py index 313228d..47d7ef9 100644 --- a/finance/views.py +++ b/finance/views.py @@ -109,8 +109,8 @@ class InvoiceDetailView(APIView): price = request.JSON.get('price', None) comment = request.JSON.get('comment', None) real_price = request.JSON.get('real_price', None) - rebilling_on = request.JSON.get('is_rebilling', False) - pay_count = request.JSON.get('pay_count', None) + # rebilling_on = request.JSON.get('is_rebilling', False) + pay_count = int(request.JSON.get('pay_count', 0)) + 1 if bill_id is None: return Response("Не передан id счёта", status=400) @@ -129,7 +129,7 @@ class InvoiceDetailView(APIView): if bill.check_validate(invoice_id) and is_open: return Response("Уже есть платёж открывающий курс", status=400) - if rebilling_on: + if pay_count > 1: invoice = InvoiceRebilling.objects.create( bill=bill, method=method,