From a4b557e47623a44e29cf586884d18fc170c2a821 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20NO=C3=8BL?= <tnoel@entrouvert.com>
Date: Mon, 3 Aug 2020 23:25:33 +0200
Subject: [PATCH] family: allow large invoice amount (#45713)

---
 .../migrations/0011_auto_20200803_2326.py     |  45 ++++++++++++++++++
 passerelle/apps/family/models.py              |   4 +-
 tests/data/family_data_fondettes.zip          | Bin 404041 -> 267854 bytes
 3 files changed, 47 insertions(+), 2 deletions(-)
 create mode 100644 passerelle/apps/family/migrations/0011_auto_20200803_2326.py

diff --git a/passerelle/apps/family/migrations/0011_auto_20200803_2326.py b/passerelle/apps/family/migrations/0011_auto_20200803_2326.py
new file mode 100644
index 00000000..4ec48103
--- /dev/null
+++ b/passerelle/apps/family/migrations/0011_auto_20200803_2326.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.18 on 2020-08-03 21:26
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('family', '0010_auto_20190209_0946'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='adult',
+            name='sex',
+            field=models.CharField(choices=[('M', 'Male'), ('F', 'Female')], max_length=1, verbose_name='Sex'),
+        ),
+        migrations.AlterField(
+            model_name='child',
+            name='sex',
+            field=models.CharField(choices=[('M', 'Male'), ('F', 'Female')], max_length=1, verbose_name='Sex'),
+        ),
+        migrations.AlterField(
+            model_name='genericfamily',
+            name='archive',
+            field=models.FileField(max_length=256, upload_to='archives', verbose_name='Data Archive'),
+        ),
+        migrations.AlterField(
+            model_name='genericfamily',
+            name='file_format',
+            field=models.CharField(choices=[('native', 'Native'), ('concerto_fondettes', 'Concerto extract from Fondettes'), ('concerto_orleans', 'Concerto extract from Orléans')], default='native', max_length=40, verbose_name='File Format'),
+        ),
+        migrations.AlterField(
+            model_name='invoice',
+            name='amount',
+            field=models.DecimalField(decimal_places=2, default=0, max_digits=8, verbose_name='Amount'),
+        ),
+        migrations.AlterField(
+            model_name='invoice',
+            name='total_amount',
+            field=models.DecimalField(decimal_places=2, default=0, max_digits=8, verbose_name='Total amount'),
+        ),
+    ]
diff --git a/passerelle/apps/family/models.py b/passerelle/apps/family/models.py
index c8813331..f4cb4f91 100644
--- a/passerelle/apps/family/models.py
+++ b/passerelle/apps/family/models.py
@@ -482,9 +482,9 @@ class Invoice(models.Model):
     issue_date = models.DateField(_('Issue date'), null=True)
     pay_limit_date = models.DateField(_('Due date'), null=True)
     litigation_date = models.DateField(_('Litigation date'), null=True)
-    total_amount = models.DecimalField(_('Total amount'), max_digits=6,
+    total_amount = models.DecimalField(_('Total amount'), max_digits=8,
                         decimal_places=2, default=0)
-    amount = models.DecimalField(_('Amount'), max_digits=6, decimal_places=2, default=0)
+    amount = models.DecimalField(_('Amount'), max_digits=8, decimal_places=2, default=0)
     payment_date = models.DateTimeField(_('Payment date'), null=True)
     paid = models.BooleanField(_('Paid'), default=False)
     autobilling = models.BooleanField(_('Autobilling'), default=False)
diff --git a/tests/data/family_data_fondettes.zip b/tests/data/family_data_fondettes.zip
index d26ff4da060f831f83a86bc90a7f06b9df9c84ec..ac6e241780d5c391e23e584c6eaee51e6cb6d709 100644
GIT binary patch
-- 
2.27.0

