# Generated by Django 3.0.7 on 2020-08-21 09:32

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='BusinessTransaction',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='ID')),
                ('type_business_transaction', models.CharField(choices=[('PURCHASE', 'PURCHASE'), ('SALE', 'SALE')], max_length=20)),
                ('slug', models.SlugField(max_length=100)),
                ('overall_discount', models.DecimalField(decimal_places=2, max_digits=14)),
                ('price_HT', models.DecimalField(decimal_places=2, max_digits=14)),
                ('TVA', models.DecimalField(decimal_places=2, max_digits=5)),
                ('IR', models.DecimalField(decimal_places=2, max_digits=14)),
                ('price_TTC', models.DecimalField(decimal_places=2, max_digits=14)),
                ('net_to_pay', models.DecimalField(decimal_places=2, max_digits=14)),
                ('patner', models.PositiveIntegerField(null=True, verbose_name="Sa référence partenaire, s'il la transaction concerne un partenaire")),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Date de création')),
                ('update_at', models.DateTimeField(auto_now=True, verbose_name='Date de dernière modification')),
                ('business_transaction', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='gocom.BusinessTransaction', verbose_name='La transaction anterieure liée si elle existe')),
            ],
            options={
                'verbose_name_plural': 'Transactions',
                'ordering': ['created_at'],
            },
        ),
        migrations.CreateModel(
            name='Currency',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=10)),
                ('slug', models.SlugField(max_length=100)),
                ('label', models.CharField(max_length=50)),
                ('description', models.TextField(max_length=200)),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Date de création')),
                ('update_at', models.DateTimeField(auto_now=True, verbose_name='Date de dernière modification')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='gocom_currencies', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Monnaies',
                'ordering': ['created_at'],
            },
        ),
        migrations.CreateModel(
            name='BusinessTransactionOrigin',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='ID')),
                ('type_business_transaction_origin', models.CharField(choices=[('DEV', 'DEVIS'), ('FACT', 'FACTURE'), ('BDC', 'BON DE COMMANDE'), ('BDL', 'BON DE LIVRAISON')], max_length=30)),
                ('slug', models.SlugField(max_length=100)),
                ('apply_as_input', models.CharField(choices=[('OUI', 'OUI'), ('NON', 'NON')], max_length=6)),
                ('output_application', models.CharField(choices=[('OUI', 'OUI'), ('NON', 'NON')], max_length=6)),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Date de création')),
                ('update_at', models.DateTimeField(auto_now=True, verbose_name='Date de dernière modification')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='gocom_business_transaction_origins', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Origines des transactions',
                'ordering': ['created_at'],
            },
        ),
        migrations.CreateModel(
            name='BusinessTransactionDetail',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='ID')),
                ('unit_price', models.DecimalField(decimal_places=2, max_digits=12)),
                ('slug', models.SlugField(max_length=100)),
                ('quantity', models.DecimalField(decimal_places=2, max_digits=14)),
                ('discount', models.DecimalField(decimal_places=2, max_digits=14)),
                ('total_price', models.DecimalField(decimal_places=2, max_digits=14)),
                ('article_store', models.PositiveIntegerField(null=True, verbose_name='article et magasin concernée')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Date de création')),
                ('update_at', models.DateTimeField(auto_now=True, verbose_name='Date de dernière modification')),
                ('business_transaction', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='gocom.BusinessTransaction', verbose_name='La transaction anterieure liée si elle existe')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='gocom_business_transaction_details', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Détails des transactions',
                'ordering': ['created_at'],
            },
        ),
        migrations.AddField(
            model_name='businesstransaction',
            name='business_transaction_origin',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='gocom.BusinessTransactionOrigin', verbose_name='Origine de la transaction associée'),
        ),
        migrations.AddField(
            model_name='businesstransaction',
            name='currency',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='gocom.Currency', verbose_name='Devises  de la transaction'),
        ),
        migrations.AddField(
            model_name='businesstransaction',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='gocom_business_transactions', to=settings.AUTH_USER_MODEL),
        ),
    ]
