finance logging

remotes/origin/yandex_rebiling
Andrey 8 years ago
parent 2ab0a525bb
commit 87d37636e5
  1. 7
      finance/views.py

@ -109,8 +109,7 @@ class InvoiceDetailView(APIView):
price = request.JSON.get('price', None) price = request.JSON.get('price', None)
comment = request.JSON.get('comment', None) comment = request.JSON.get('comment', None)
real_price = request.JSON.get('real_price', None) real_price = request.JSON.get('real_price', None)
# rebilling_on = request.JSON.get('is_rebilling', False) pay_count = int(request.JSON.get('pay_count', '1'))
pay_count = int(request.JSON.get('pay_count', 0)) + 1
if bill_id is None: if bill_id is None:
return Response("Не передан id счёта", status=400) return Response("Не передан id счёта", status=400)
@ -137,7 +136,6 @@ class InvoiceDetailView(APIView):
is_open=is_open, is_open=is_open,
rebilling_on=True, rebilling_on=True,
) )
invoice.create_child_pays(pay_count)
else: else:
try: try:
@ -174,6 +172,9 @@ class InvoiceDetailView(APIView):
invoice.is_open = is_open invoice.is_open = is_open
invoice.comment = comment invoice.comment = comment
if pay_count > 1:
invoice.create_child_pays(pay_count)
if invoice.method == 'Y' and invoice.yandex_pay is None: if invoice.method == 'Y' and invoice.yandex_pay is None:
yandex_pay = Payment.objects.create( yandex_pay = Payment.objects.create(
order_amount=invoice.price, order_amount=invoice.price,

Loading…
Cancel
Save