|
|
|
@ -205,13 +205,14 @@ class Payment(PolymorphicModel): |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
def save(self, *args, **kwargs): |
|
|
|
def save(self, *args, **kwargs): |
|
|
|
|
|
|
|
paid = self.status in [Pingback.PINGBACK_TYPE_REGULAR, Pingback.PINGBACK_TYPE_GOODWILL, |
|
|
|
|
|
|
|
Pingback.PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED,] |
|
|
|
amount_data = Payment.calc_amount(payment=self) |
|
|
|
amount_data = Payment.calc_amount(payment=self) |
|
|
|
self.amount = amount_data.get('amount') |
|
|
|
if self.status is None: |
|
|
|
|
|
|
|
self.amount = amount_data.get('amount') |
|
|
|
if isinstance(self, SchoolPayment): |
|
|
|
if isinstance(self, SchoolPayment): |
|
|
|
self.weekdays = amount_data.get('weekdays') |
|
|
|
self.weekdays = amount_data.get('weekdays') |
|
|
|
super().save(*args, **kwargs) |
|
|
|
super().save(*args, **kwargs) |
|
|
|
paid = self.status in [Pingback.PINGBACK_TYPE_REGULAR, Pingback.PINGBACK_TYPE_GOODWILL, |
|
|
|
|
|
|
|
Pingback.PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED,] |
|
|
|
|
|
|
|
if isinstance(self, CoursePayment): |
|
|
|
if isinstance(self, CoursePayment): |
|
|
|
author_balance = getattr(self, 'authorbalance', None) |
|
|
|
author_balance = getattr(self, 'authorbalance', None) |
|
|
|
if not author_balance and paid: |
|
|
|
if not author_balance and paid: |
|
|
|
@ -240,7 +241,6 @@ class CoursePayment(Payment): |
|
|
|
verbose_name_plural = 'Платежи за курсы' |
|
|
|
verbose_name_plural = 'Платежи за курсы' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SchoolPayment(Payment): |
|
|
|
class SchoolPayment(Payment): |
|
|
|
weekdays = ArrayField(models.IntegerField(), size=7, verbose_name='Дни недели') |
|
|
|
weekdays = ArrayField(models.IntegerField(), size=7, verbose_name='Дни недели') |
|
|
|
add_days = models.BooleanField('Докупленные дни', default=False) |
|
|
|
add_days = models.BooleanField('Докупленные дни', default=False) |
|
|
|
|