From 0c2bffb8bf159e708f5149f7fdfdbd6ddc0d8ad4 Mon Sep 17 00:00:00 2001 From: gzbender Date: Wed, 12 Sep 2018 14:45:40 +0500 Subject: [PATCH] LIL-633 --- apps/payment/models.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/payment/models.py b/apps/payment/models.py index 21e6171f..761021bc 100644 --- a/apps/payment/models.py +++ b/apps/payment/models.py @@ -193,8 +193,9 @@ class CoursePayment(Payment): verbose_name_plural = 'Платежи за курсы' def save(self, *args, **kwargs): - amount_data = Payment.calc_amount(course_payment=self) - self.amount = amount_data.get('amount') + if self.status is None: + amount_data = Payment.calc_amount(course_payment=self) + self.amount = amount_data.get('amount') super().save(*args, **kwargs) author_balance = getattr(self, 'authorbalance', None) if not author_balance: @@ -226,8 +227,9 @@ class SchoolPayment(Payment): return days def save(self, *args, **kwargs): - amount_data = Payment.calc_amount(school_payment=self) - self.amount = amount_data.get('amount') + if self.status is None: + amount_data = Payment.calc_amount(school_payment=self) + self.amount = amount_data.get('amount') super().save(*args, **kwargs) @property