# Generated by Django 3.2.12 on 2022-03-21 16:09

from django.db import migrations, models
import django.db.models.deletion
import django.db.models.expressions


def supprimer_type_facture_accompte(apps, schema):
    Document = apps.get_model("gestion", "Document")
    Document.objects.filter(type="FAC-AVO").update(type="FAC")


class Migration(migrations.Migration):
    dependencies = [
        ("gestion", "0023_document_date"),
    ]

    operations = [
        migrations.RunPython(
            code=supprimer_type_facture_accompte, reverse_code=migrations.RunPython.noop
        ),
        migrations.AddField(
            model_name="reglement",
            name="facture",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                related_name="comme_facture",
                to="gestion.document",
                verbose_name="Facture associée",
            ),
        ),
        migrations.AlterField(
            model_name="document",
            name="type",
            field=models.CharField(
                choices=[
                    ("DEV", "Devis"),
                    ("CON", "Contrat"),
                    ("FAC", "Facture"),
                    ("BDL", "Bon de livraison"),
                    ("JUS", "Justificatif de dépense"),
                    ("JUS-BIL", "Billet de train"),
                    ("JUS-TRAIN", "Justificatif de train"),
                    ("JUS-CEM", "Carte d'embarquement"),
                    ("PAY", "Preuve de paiement"),
                    ("PAY-CHK", "Scan du chèque"),
                    ("PAY-TKT", "Ticket de caisse"),
                    ("EXA", "Exemplaire fourni"),
                    ("EXA-BAT", "BAT"),
                    ("EXA-TRA", "Tract"),
                    ("EXA-AFF", "Affiche"),
                    ("EXA-CAP", "Capture d'écran"),
                    ("PHO", "Photographie de l'objet ou de l'événement"),
                    ("AUT", "Autre (à détailler dans les commentaires)"),
                    ("ATT", "Attestation"),
                    ("ATT-GRA", "Attestation de gratuité"),
                    ("ATT-CON", "Attestation de concours en nature"),
                    ("ATT-REG", "Attestation de règlement des consommations"),
                    (
                        "ATT-ESP",
                        "Demande d'autorisation d'occupation de l'espace public",
                    ),
                ],
                max_length=10,
                verbose_name="Type de document",
            ),
        ),
        migrations.AlterField(
            model_name="reglement",
            name="preuve",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                related_name="comme_preuve_paiement",
                to="gestion.document",
                verbose_name="Preuve de paiement",
            ),
        ),
    ]
