135 lines
6.7 KiB
Python
135 lines
6.7 KiB
Python
# Generated by Django 2.2.4 on 2019-08-16 16:12
|
|
|
|
import datetime
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
import main.models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='IncomingInvoice',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('date', models.DateField(default=datetime.datetime.now)),
|
|
('invoice_id', models.CharField(max_length=200)),
|
|
],
|
|
bases=(main.models.InvoiceDependencies, main.models.FieldTrackerMixin, models.Model),
|
|
),
|
|
migrations.CreateModel(
|
|
name='Inventory',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('date', models.DateField(default=datetime.datetime.now, unique=True)),
|
|
('may_have_changed', models.BooleanField(default=True)),
|
|
],
|
|
bases=(main.models.InvoiceDependencies, models.Model, main.models.FieldTrackerMixin),
|
|
),
|
|
migrations.CreateModel(
|
|
name='OutgoingInvoice',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('date', models.DateField(default=datetime.datetime.now)),
|
|
('total', models.IntegerField(default=0)),
|
|
('profit', models.IntegerField(default=0)),
|
|
('is_frozen', models.BooleanField(default=False)),
|
|
('correction_of', models.OneToOneField(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='corrected_by', to='main.OutgoingInvoice')),
|
|
('inventory', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Inventory')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='OutgoingInvoiceProductPosition',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('loss', models.FloatField()),
|
|
('price_each', models.IntegerField()),
|
|
('total', models.IntegerField()),
|
|
('profit', models.IntegerField()),
|
|
('invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.OutgoingInvoice')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Product',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=100)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='ProductType',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=200)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='UserExtension',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('allow_login', models.BooleanField(default=True)),
|
|
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='ProductInventory',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('count', models.IntegerField()),
|
|
('inventory', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Inventory')),
|
|
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Product')),
|
|
],
|
|
bases=(main.models.InvoiceDependencies, models.Model, main.models.FieldTrackerMixin),
|
|
),
|
|
migrations.AddField(
|
|
model_name='product',
|
|
name='product_type',
|
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.ProductType'),
|
|
),
|
|
migrations.CreateModel(
|
|
name='OutgoingInvoiceProductUserPosition',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('count', models.IntegerField()),
|
|
('productinvoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.OutgoingInvoiceProductPosition')),
|
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
),
|
|
migrations.AddField(
|
|
model_name='outgoinginvoiceproductposition',
|
|
name='product',
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Product'),
|
|
),
|
|
migrations.CreateModel(
|
|
name='Order',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('each_cents', models.IntegerField()),
|
|
('count', models.IntegerField()),
|
|
('incoming_invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.IncomingInvoice')),
|
|
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Product')),
|
|
],
|
|
bases=(main.models.InvoiceDependencies, models.Model, main.models.FieldTrackerMixin),
|
|
),
|
|
migrations.CreateModel(
|
|
name='Consumption',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('count', models.PositiveIntegerField()),
|
|
('date', models.DateField(default=datetime.datetime.now)),
|
|
('issued_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='issued_consumption', to=settings.AUTH_USER_MODEL)),
|
|
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Product')),
|
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
bases=(main.models.InvoiceDependencies, models.Model, main.models.FieldTrackerMixin),
|
|
),
|
|
]
|