# Generated by Django 3.2.16 on 2023-02-08 13:22

import ckeditor.fields
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('contenttypes', '0002_remove_content_type_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='Batch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('year', models.CharField(max_length=1, verbose_name='années')),
                ('number', models.IntegerField(validators=[django.core.validators.MaxValueValidator(999), django.core.validators.MinValueValidator(1)], verbose_name='numéro de lot')),
                ('quantity', models.IntegerField(validators=[django.core.validators.MaxValueValidator(999), django.core.validators.MinValueValidator(1)], verbose_name='quantité')),
                ('box_quantity', models.IntegerField(default=6, validators=[django.core.validators.MaxValueValidator(6), django.core.validators.MinValueValidator(1)], verbose_name='quantité du carton')),
                ('batch_number', models.CharField(blank=True, max_length=10, unique=True, verbose_name='numéro de lot')),
                ('customer', models.CharField(default='PSA', max_length=50, verbose_name='client')),
                ('active', models.BooleanField(default=True, verbose_name='terminé')),
                ('is_barcode', models.BooleanField(default=False, verbose_name='Nouveau code barre')),
                ('start_date', models.DateField(null=True, verbose_name='date de début')),
                ('end_date', models.DateField(null=True, verbose_name='date de fin')),
                ('closing_date', models.DateTimeField(blank=True, null=True, verbose_name='date de cloture')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('created_by', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'permissions': [('pdfgen_batch', 'Can pdfgen batch')],
            },
        ),
        migrations.CreateModel(
            name='Default',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=30, unique=True, verbose_name='code defaut')),
                ('description', models.CharField(max_length=200, verbose_name='libellé')),
            ],
        ),
        migrations.CreateModel(
            name='SparePart',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code_produit', models.CharField(max_length=100, verbose_name='code Produit')),
                ('code_magasin', models.CharField(blank=True, max_length=50, verbose_name='code Magasin')),
                ('code_zone', models.CharField(blank=True, max_length=50, verbose_name='code Zone')),
                ('code_site', models.IntegerField(blank=True, null=True, verbose_name='code Site')),
                ('code_emplacement', models.CharField(blank=True, max_length=50, verbose_name='code Emplacement')),
                ('cumul_dispo', models.IntegerField(blank=True, null=True, verbose_name='cumul Dispo')),
            ],
        ),
        migrations.CreateModel(
            name='RepairPart',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('product_code', models.CharField(max_length=100, verbose_name='code produit')),
                ('quantity', models.CharField(max_length=100, verbose_name='n° de pièce')),
                ('object_id', models.PositiveIntegerField()),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
            ],
            options={
                'verbose_name': 'Pièce réparation',
                'ordering': ['id'],
            },
        ),
        migrations.CreateModel(
            name='Repair',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('identify_number', models.CharField(max_length=10, unique=True, verbose_name="n° d'identification")),
                ('barcode', models.CharField(blank=True, max_length=100, verbose_name='code barre')),
                ('vin', models.CharField(blank=True, max_length=20, verbose_name='V.I.N.')),
                ('diagnostic_data', models.TextField(blank=True, max_length=50000, verbose_name='Données Diagnostique')),
                ('new_barcode', models.CharField(blank=True, max_length=100, verbose_name='nouveau code barre')),
                ('product_number', models.CharField(blank=True, max_length=50, verbose_name='référence')),
                ('remark', models.CharField(blank=True, max_length=200, verbose_name='remarques')),
                ('comment', ckeditor.fields.RichTextField(blank=True, max_length=500, verbose_name='Commentaires action')),
                ('face_plate', models.BooleanField(default=False, verbose_name='façade')),
                ('metal_case', models.BooleanField(default=False, verbose_name='boitier')),
                ('fan', models.BooleanField(default=False, verbose_name='ventilateur')),
                ('locating_pin', models.BooleanField(default=False, verbose_name='Boulon arrière')),
                ('spring_locking', models.BooleanField(default=False, verbose_name='verrouillage à ressort')),
                ('status', models.CharField(choices=[('En cours', 'En cours'), ('Réparé', 'Réparé'), ('Rebut', 'Rebut')], default='En cours', max_length=50, verbose_name='status')),
                ('quality_control', models.BooleanField(default=False, verbose_name='contrôle qualité')),
                ('checkout', models.BooleanField(default=False, verbose_name='contrôle de sortie')),
                ('closing_date', models.DateTimeField(blank=True, null=True, verbose_name='date de cloture')),
                ('recovery', models.BooleanField(default=False, verbose_name='reprise')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='ajouté le')),
                ('modified_at', models.DateTimeField(auto_now=True, verbose_name='modifié le')),
                ('batch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='repairs', to='reman.batch')),
                ('created_by', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='repairs_created', to=settings.AUTH_USER_MODEL)),
                ('default', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='repairs', to='reman.default')),
                ('modified_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='repairs_modified', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-modified_at'],
                'permissions': [('close_repair', 'Can close repair'), ('stock_repair', 'Can stock repair')],
            },
        ),
        migrations.CreateModel(
            name='EcuType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('hw_reference', models.CharField(max_length=50, unique=True, verbose_name='hardware')),
                ('hw_type', models.CharField(choices=[('ECU', 'ECU'), ('NAV', 'NAV')], default='ECU', max_length=50, verbose_name='type HW')),
                ('technical_data', models.CharField(max_length=50, verbose_name='modèle produit')),
                ('supplier_oe', models.CharField(blank=True, max_length=50, verbose_name='fabriquant')),
                ('spare_part', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='reman.sparepart')),
            ],
        ),
        migrations.CreateModel(
            name='EcuRefBase',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('reman_reference', models.CharField(max_length=10, unique=True, verbose_name='référence REMAN')),
                ('brand', models.CharField(blank=True, max_length=50, verbose_name='Marque')),
                ('ref_cal_out', models.CharField(blank=True, max_length=10, verbose_name='REF_CAL_OUT')),
                ('ref_psa_out', models.CharField(blank=True, max_length=10, verbose_name='REF_PSA_OUT')),
                ('req_diag', models.CharField(blank=True, max_length=50, verbose_name='REQ_DIAG')),
                ('open_diag', models.CharField(blank=True, max_length=50, verbose_name='OPENDIAG')),
                ('req_ref', models.CharField(blank=True, max_length=50, verbose_name='REQ_REF')),
                ('ref_mat', models.CharField(blank=True, max_length=10, verbose_name='REF_MAT')),
                ('ref_comp', models.CharField(blank=True, max_length=10, verbose_name='REF_COMP')),
                ('req_cal', models.CharField(blank=True, max_length=50, verbose_name='REQ_CAL')),
                ('cal_ktag', models.CharField(blank=True, max_length=10, verbose_name='CAL_KTAG')),
                ('req_status', models.CharField(blank=True, max_length=50, verbose_name='REQ_STATUS')),
                ('status', models.CharField(blank=True, max_length=50, verbose_name='STATUT')),
                ('test_clear_memory', models.CharField(blank=True, max_length=10, verbose_name='TEST_CLEAR_MEMORY')),
                ('cle_appli', models.CharField(blank=True, max_length=50, verbose_name='CLE_APPLI')),
                ('map_data', models.CharField(blank=True, max_length=100, verbose_name='map data')),
                ('product_part', models.CharField(blank=True, max_length=8, verbose_name='product part')),
                ('pf_code', models.CharField(blank=True, max_length=10, verbose_name='PF code REMAN')),
                ('ecu_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='reman.ecutype')),
            ],
        ),
        migrations.CreateModel(
            name='EcuModel',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('barcode', models.CharField(max_length=50, unique=True, verbose_name='code barre PSA')),
                ('oe_raw_reference', models.CharField(blank=True, max_length=50, verbose_name='référence OEM brute')),
                ('oe_reference', models.CharField(blank=True, max_length=50, verbose_name='référence OEM')),
                ('former_oe_reference', models.CharField(blank=True, max_length=50, verbose_name='ancienne référence OEM')),
                ('vehicle', models.CharField(blank=True, max_length=50, verbose_name='vehicule')),
                ('fan', models.CharField(blank=True, max_length=100, verbose_name='FAN')),
                ('rear_bolt', models.CharField(blank=True, max_length=100, verbose_name='REAR BOLT')),
                ('to_dump', models.BooleanField(default=False, verbose_name='à dumper')),
                ('ecu_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='reman.ecutype')),
            ],
            options={
                'permissions': [('check_ecumodel', 'Can check ecu model')],
            },
        ),
        migrations.AddField(
            model_name='default',
            name='ecu_type',
            field=models.ManyToManyField(blank=True, related_name='defaults', to='reman.EcuType'),
        ),
        migrations.AddField(
            model_name='batch',
            name='ecu_ref_base',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='reman.ecurefbase'),
        ),
    ]
