# Generated by Django 2.2.7 on 2019-11-17 12:12

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import trionyx.models
import trionyx_invoices.models


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Invoice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')),
                ('deleted', models.BooleanField(default=False, verbose_name='Deleted')),
                ('verbose_name', models.TextField(blank=True, default='', verbose_name='Verbose name')),
                ('for_object_id', models.BigIntegerField(blank=True, null=True, verbose_name='Object ID')),
                ('auto_generate_id', models.CharField(blank=True, max_length=32, null=True)),
                ('status', models.IntegerField(choices=[(10, 'Draft'), (20, 'Send'), (30, 'Overdue'), (40, 'Paid'), (99, 'Canceled')], default=10, verbose_name='Status')),
                ('reference', models.CharField(blank=True, max_length=32, null=True, verbose_name='Reference')),
                ('due_date', models.DateField(blank=True, null=True, verbose_name='Due date')),
                ('send_date', models.DateField(blank=True, null=True, verbose_name='Send on')),
                ('send_reminder_date', models.DateField(blank=True, null=True, verbose_name='Reminder send on')),
                ('send_past_due_date', models.DateField(blank=True, null=True, verbose_name='Past due send on')),
                ('discount_total', trionyx.models.PriceField(blank=True, decimal_places=4, default=0.0, max_digits=11, verbose_name='Discount total')),
                ('subtotal', trionyx.models.PriceField(blank=True, decimal_places=4, default=0.0, max_digits=11, verbose_name='Subtotal')),
                ('tax_percentage', models.PositiveIntegerField(blank=True, null=True, verbose_name='Tax percentage')),
                ('tax_total', trionyx.models.PriceField(blank=True, decimal_places=4, default=0.0, max_digits=11, verbose_name='Tax total')),
                ('grand_total', trionyx.models.PriceField(blank=True, decimal_places=4, default=0.0, max_digits=11, verbose_name='Grand total')),
                ('pdf', models.FileField(blank=True, default=None, null=True, upload_to=trionyx_invoices.models.pdf_upload_path)),
                ('payment_instructions', models.TextField(blank=True, null=True, verbose_name='Payment instructions')),
                ('comment', models.TextField(blank=True, null=True, verbose_name='Comment')),
                ('billing_name', models.CharField(blank=True, max_length=128, null=True, verbose_name='Billing name')),
                ('billing_company_name', models.CharField(blank=True, max_length=128, null=True, verbose_name='Billing company name')),
                ('billing_email', models.EmailField(blank=True, max_length=254, null=True, verbose_name='Billing email')),
                ('billing_telephone', models.CharField(blank=True, max_length=32, null=True, verbose_name='Billing telephone')),
                ('billing_address', models.CharField(blank=True, max_length=128, null=True, verbose_name='Billing address')),
                ('billing_postcode', models.CharField(blank=True, max_length=16, null=True, verbose_name='Billing postcode')),
                ('billing_city', models.CharField(blank=True, max_length=256, null=True, verbose_name='Billing city')),
                ('billing_country', models.CharField(blank=True, choices=[('AF', 'Afghanistan'), ('AX', 'Åland Islands'), ('AL', 'Albania'), ('DZ', 'Algeria'), ('AS', 'American Samoa'), ('AD', 'Andorra'), ('AO', 'Angola'), ('AI', 'Anguilla'), ('AQ', 'Antarctica'), ('AG', 'Antigua and Barbuda'), ('AR', 'Argentina'), ('AM', 'Armenia'), ('AW', 'Aruba'), ('AU', 'Australia'), ('AT', 'Austria'), ('AZ', 'Azerbaijan'), ('BS', 'Bahamas'), ('BH', 'Bahrain'), ('BD', 'Bangladesh'), ('BB', 'Barbados'), ('BY', 'Belarus'), ('BE', 'Belgium'), ('BZ', 'Belize'), ('BJ', 'Benin'), ('BM', 'Bermuda'), ('BT', 'Bhutan'), ('BO', 'Bolivia (Plurinational State of)'), ('BQ', 'Bonaire, Sint Eustatius and Saba'), ('BA', 'Bosnia and Herzegovina'), ('BW', 'Botswana'), ('BV', 'Bouvet Island'), ('BR', 'Brazil'), ('IO', 'British Indian Ocean Territory'), ('BN', 'Brunei Darussalam'), ('BG', 'Bulgaria'), ('BF', 'Burkina Faso'), ('BI', 'Burundi'), ('CV', 'Cabo Verde'), ('KH', 'Cambodia'), ('CM', 'Cameroon'), ('CA', 'Canada'), ('KY', 'Cayman Islands'), ('CF', 'Central African Republic'), ('TD', 'Chad'), ('CL', 'Chile'), ('CN', 'China'), ('CX', 'Christmas Island'), ('CC', 'Cocos (Keeling) Islands'), ('CO', 'Colombia'), ('KM', 'Comoros'), ('CG', 'Congo'), ('CD', 'Congo, Democratic Republic of the'), ('CK', 'Cook Islands'), ('CR', 'Costa Rica'), ('CI', "Côte d'Ivoire"), ('HR', 'Croatia'), ('CU', 'Cuba'), ('CW', 'Curaçao'), ('CY', 'Cyprus'), ('CZ', 'Czechia'), ('DK', 'Denmark'), ('DJ', 'Djibouti'), ('DM', 'Dominica'), ('DO', 'Dominican Republic'), ('EC', 'Ecuador'), ('EG', 'Egypt'), ('SV', 'El Salvador'), ('GQ', 'Equatorial Guinea'), ('ER', 'Eritrea'), ('EE', 'Estonia'), ('SZ', 'Eswatini'), ('ET', 'Ethiopia'), ('FK', 'Falkland Islands (Malvinas)'), ('FO', 'Faroe Islands'), ('FJ', 'Fiji'), ('FI', 'Finland'), ('FR', 'France'), ('GF', 'French Guiana'), ('PF', 'French Polynesia'), ('TF', 'French Southern Territories'), ('GA', 'Gabon'), ('GM', 'Gambia'), ('GE', 'Georgia'), ('DE', 'Germany'), ('GH', 'Ghana'), ('GI', 'Gibraltar'), ('GR', 'Greece'), ('GL', 'Greenland'), ('GD', 'Grenada'), ('GP', 'Guadeloupe'), ('GU', 'Guam'), ('GT', 'Guatemala'), ('GG', 'Guernsey'), ('GN', 'Guinea'), ('GW', 'Guinea-Bissau'), ('GY', 'Guyana'), ('HT', 'Haiti'), ('HM', 'Heard Island and McDonald Islands'), ('VA', 'Holy See'), ('HN', 'Honduras'), ('HK', 'Hong Kong'), ('HU', 'Hungary'), ('IS', 'Iceland'), ('IN', 'India'), ('ID', 'Indonesia'), ('IR', 'Iran (Islamic Republic of)'), ('IQ', 'Iraq'), ('IE', 'Ireland'), ('IM', 'Isle of Man'), ('IL', 'Israel'), ('IT', 'Italy'), ('JM', 'Jamaica'), ('JP', 'Japan'), ('JE', 'Jersey'), ('JO', 'Jordan'), ('KZ', 'Kazakhstan'), ('KE', 'Kenya'), ('KI', 'Kiribati'), ('KP', "Korea (Democratic People's Republic of)"), ('KR', 'Korea, Republic of'), ('KW', 'Kuwait'), ('KG', 'Kyrgyzstan'), ('LA', "Lao People's Democratic Republic"), ('LV', 'Latvia'), ('LB', 'Lebanon'), ('LS', 'Lesotho'), ('LR', 'Liberia'), ('LY', 'Libya'), ('LI', 'Liechtenstein'), ('LT', 'Lithuania'), ('LU', 'Luxembourg'), ('MO', 'Macao'), ('MK', 'Macedonia, the former Yugoslav Republic of'), ('MG', 'Madagascar'), ('MW', 'Malawi'), ('MY', 'Malaysia'), ('MV', 'Maldives'), ('ML', 'Mali'), ('MT', 'Malta'), ('MH', 'Marshall Islands'), ('MQ', 'Martinique'), ('MR', 'Mauritania'), ('MU', 'Mauritius'), ('YT', 'Mayotte'), ('MX', 'Mexico'), ('FM', 'Micronesia (Federated States of)'), ('MD', 'Moldova, Republic of'), ('MC', 'Monaco'), ('MN', 'Mongolia'), ('ME', 'Montenegro'), ('MS', 'Montserrat'), ('MA', 'Morocco'), ('MZ', 'Mozambique'), ('MM', 'Myanmar'), ('NA', 'Namibia'), ('NR', 'Nauru'), ('NP', 'Nepal'), ('NL', 'Netherlands'), ('NC', 'New Caledonia'), ('NZ', 'New Zealand'), ('NI', 'Nicaragua'), ('NE', 'Niger'), ('NG', 'Nigeria'), ('NU', 'Niue'), ('NF', 'Norfolk Island'), ('MP', 'Northern Mariana Islands'), ('NO', 'Norway'), ('OM', 'Oman'), ('PK', 'Pakistan'), ('PW', 'Palau'), ('PS', 'Palestine, State of'), ('PA', 'Panama'), ('PG', 'Papua New Guinea'), ('PY', 'Paraguay'), ('PE', 'Peru'), ('PH', 'Philippines'), ('PN', 'Pitcairn'), ('PL', 'Poland'), ('PT', 'Portugal'), ('PR', 'Puerto Rico'), ('QA', 'Qatar'), ('RE', 'Réunion'), ('RO', 'Romania'), ('RU', 'Russian Federation'), ('RW', 'Rwanda'), ('BL', 'Saint Barthélemy'), ('SH', 'Saint Helena, Ascension and Tristan da Cunha'), ('KN', 'Saint Kitts and Nevis'), ('LC', 'Saint Lucia'), ('MF', 'Saint Martin (French part)'), ('PM', 'Saint Pierre and Miquelon'), ('VC', 'Saint Vincent and the Grenadines'), ('WS', 'Samoa'), ('SM', 'San Marino'), ('ST', 'Sao Tome and Principe'), ('SA', 'Saudi Arabia'), ('SN', 'Senegal'), ('RS', 'Serbia'), ('SC', 'Seychelles'), ('SL', 'Sierra Leone'), ('SG', 'Singapore'), ('SX', 'Sint Maarten (Dutch part)'), ('SK', 'Slovakia'), ('SI', 'Slovenia'), ('SB', 'Solomon Islands'), ('SO', 'Somalia'), ('ZA', 'South Africa'), ('GS', 'South Georgia and the South Sandwich Islands'), ('SS', 'South Sudan'), ('ES', 'Spain'), ('LK', 'Sri Lanka'), ('SD', 'Sudan'), ('SR', 'Suriname'), ('SJ', 'Svalbard and Jan Mayen'), ('SE', 'Sweden'), ('CH', 'Switzerland'), ('SY', 'Syrian Arab Republic'), ('TW', 'Taiwan, Province of China'), ('TJ', 'Tajikistan'), ('TZ', 'Tanzania, United Republic of'), ('TH', 'Thailand'), ('TL', 'Timor-Leste'), ('TG', 'Togo'), ('TK', 'Tokelau'), ('TO', 'Tonga'), ('TT', 'Trinidad and Tobago'), ('TN', 'Tunisia'), ('TR', 'Turkey'), ('TM', 'Turkmenistan'), ('TC', 'Turks and Caicos Islands'), ('TV', 'Tuvalu'), ('UG', 'Uganda'), ('UA', 'Ukraine'), ('AE', 'United Arab Emirates'), ('GB', 'United Kingdom of Great Britain and Northern Ireland'), ('US', 'United States of America'), ('UM', 'United States Minor Outlying Islands'), ('UY', 'Uruguay'), ('UZ', 'Uzbekistan'), ('VU', 'Vanuatu'), ('VE', 'Venezuela (Bolivarian Republic of)'), ('VN', 'Viet Nam'), ('VG', 'Virgin Islands (British)'), ('VI', 'Virgin Islands (U.S.)'), ('WF', 'Wallis and Futuna'), ('EH', 'Western Sahara'), ('YE', 'Yemen'), ('ZM', 'Zambia'), ('ZW', 'Zimbabwe')], max_length=2, null=True, verbose_name='Billing country')),
                ('created_by', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Created by')),
                ('for_object_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='contenttypes.ContentType', verbose_name='Object type')),
            ],
            options={
                'verbose_name': 'Invoice',
                'verbose_name_plural': 'Invoices',
            },
        ),
        migrations.CreateModel(
            name='InvoiceType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')),
                ('deleted', models.BooleanField(default=False, verbose_name='Deleted')),
                ('verbose_name', models.TextField(blank=True, default='', verbose_name='Verbose name')),
                ('code', models.CharField(max_length=32, unique=True)),
                ('name', models.CharField(max_length=128)),
                ('created_by', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Created by')),
            ],
            options={
                'verbose_name': 'Invoice type',
                'verbose_name_plural': 'Invoice types',
            },
        ),
        migrations.CreateModel(
            name='InvoiceItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')),
                ('deleted', models.BooleanField(default=False, verbose_name='Deleted')),
                ('verbose_name', models.TextField(blank=True, default='', verbose_name='Verbose name')),
                ('type', models.IntegerField(choices=[(10, 'Hourly rate'), (20, 'Price')], verbose_name='Type')),
                ('auto_generate_id', models.CharField(blank=True, max_length=32, null=True)),
                ('reference', models.CharField(blank=True, max_length=32, null=True, verbose_name='Reference')),
                ('description', models.TextField(blank=True, null=True, verbose_name='Description')),
                ('order', models.PositiveIntegerField(blank=True, null=True, verbose_name='Order')),
                ('hourly_rate', trionyx.models.PriceField(blank=True, decimal_places=4, default=0.0, max_digits=11, verbose_name='Hourly rate')),
                ('hours', models.DecimalField(blank=True, decimal_places=2, max_digits=19, null=True, verbose_name='Hours')),
                ('price', trionyx.models.PriceField(blank=True, decimal_places=4, default=0.0, max_digits=11, verbose_name='Price')),
                ('qty', models.PositiveIntegerField(blank=True, null=True, verbose_name='Qty')),
                ('row_total', trionyx.models.PriceField(blank=True, decimal_places=4, default=0.0, max_digits=11, verbose_name='Row total')),
                ('created_by', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Created by')),
                ('invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='trionyx_invoices.Invoice', verbose_name='Invoice')),
            ],
            options={
                'verbose_name': 'Invoice item',
                'verbose_name_plural': 'Invoice items',
            },
        ),
        migrations.CreateModel(
            name='InvoiceComment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')),
                ('deleted', models.BooleanField(default=False, verbose_name='Deleted')),
                ('verbose_name', models.TextField(blank=True, default='', verbose_name='Verbose name')),
                ('is_public', models.BooleanField(blank=True, default=False, verbose_name='Is public')),
                ('is_send', models.BooleanField(blank=True, default=False, verbose_name='Is send')),
                ('comment', models.TextField(verbose_name='Comment')),
                ('created_by', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Created by')),
                ('invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='trionyx_invoices.Invoice', verbose_name='Invoice')),
            ],
            options={
                'verbose_name': 'Invoice comment',
                'verbose_name_plural': 'Invoice comments',
            },
        ),
        migrations.AddField(
            model_name='invoice',
            name='type',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='invoices', to='trionyx_invoices.InvoiceType', verbose_name='Type'),
        ),
    ]
