From: Guillaume Pellerin Date: Wed, 1 Dec 2021 09:39:59 +0000 (+0100) Subject: add conditions X-Git-Tag: 2.5.1~25^2~9^2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=d756d1f8e9015979c4ca8bb9421b323e4cf35c03;p=teleforma.git add conditions --- diff --git a/teleforma/management/commands/teleforma-copy-students.py b/teleforma/management/commands/teleforma-copy-students.py index 2b9fa9c2..44f2fd0e 100644 --- a/teleforma/management/commands/teleforma-copy-students.py +++ b/teleforma/management/commands/teleforma-copy-students.py @@ -86,7 +86,16 @@ class Command(BaseCommand): for payment in payments: date_created = deepcopy(payment.date_modified) date_paid = deepcopy(payment.date_paid) - if date_paid: + month = deepcopy(payment.month) + payments_to = Payment.objects.using(self.db_to).filter(student=student, month=month) + if payments_to: + payment_to = payments_to[0] + payment_to.value = payment.value + payment_to.type = payment.type + payment_to.scheduled = payment.scheduled + payment_to.online_paid = payment.online_paid + payement_to.date_paid = payment.date_paid + elif date_paid: if date_paid >= self.date_limit: payment.pk = None payment.save(using=self.db_to)