]> git.parisson.com Git - teleforma.git/commitdiff
import: fix last bugs
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 17 Mar 2021 15:37:59 +0000 (16:37 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 17 Mar 2021 15:37:59 +0000 (16:37 +0100)
teleforma/views/crfpa.py

index 83da3cb5282cbb548fecc9cd4ed92eb8113ef6de..006857fd846d91baabea0e4e7f76bd87f3598687 100644 (file)
@@ -445,7 +445,7 @@ class UserXLSBook(object):
             student.level = level
             student.period = period
             student.iej = IEJ.objects.get(name=iej)
-            student.is_subscribed = False
+            student.is_subscribed = True
 
             student.save()
 
@@ -467,7 +467,7 @@ class UserXLSBook(object):
                 student.date_subscribed = self.date_str_to_datetime(register_date)
 
             if total_reduction:
-                discount = Discount(student=student, value=float(total_reduction), description=desc_reduction)
+                discount = Discount(student=student, value=-float(total_reduction), description=desc_reduction)
                 discount.save()
             student.balance = float(balance)
 
@@ -492,11 +492,12 @@ class UserXLSBook(object):
             amount = row[i]
             payment_type = row[i+1]
             payments = Payment.objects.filter(student=student, month=month[0])
+            student.restricted = False
             if not payments and amount:
                 payment = Payment(student=student, value=float(amount), month=month[0], type=payment_type, online_paid=True)
                 print(last_name.encode('utf8') + ' : add payment')
                 payment.save()
-                student.is_subscribed = True
+                student.restricted = True
             i += 2
 
         student.save()