2016-03-28 12:54:35 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django.db import migrations, models
|
2016-05-30 10:23:59 +00:00
|
|
|
import accounting.models
|
2016-08-24 20:09:23 +00:00
|
|
|
import django.db.models.deletion
|
2016-05-30 10:23:59 +00:00
|
|
|
from django.conf import settings
|
2016-03-28 12:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
|
|
dependencies = [
|
2016-08-24 20:09:23 +00:00
|
|
|
('subscription', '0001_initial'),
|
2016-08-10 11:52:57 +00:00
|
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
2016-03-29 10:45:10 +00:00
|
|
|
('core', '0001_initial'),
|
2016-08-24 20:09:23 +00:00
|
|
|
('club', '0002_auto_20160824_2152'),
|
2016-03-28 12:54:35 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='Counter',
|
|
|
|
fields=[
|
2016-08-24 20:09:23 +00:00
|
|
|
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
|
|
|
('name', models.CharField(max_length=30, verbose_name='name')),
|
|
|
|
('type', models.CharField(choices=[('BAR', 'Bar'), ('OFFICE', 'Office'), ('EBOUTIC', 'Eboutic')], max_length=255, verbose_name='counter type')),
|
|
|
|
('club', models.ForeignKey(to='club.Club', related_name='counters')),
|
|
|
|
('edit_groups', models.ManyToManyField(to='core.Group', blank=True, related_name='editable_counters')),
|
2016-03-28 12:54:35 +00:00
|
|
|
],
|
2016-08-10 11:52:57 +00:00
|
|
|
options={
|
|
|
|
'verbose_name': 'counter',
|
|
|
|
},
|
2016-03-28 12:54:35 +00:00
|
|
|
),
|
2016-05-30 10:23:59 +00:00
|
|
|
migrations.CreateModel(
|
|
|
|
name='Customer',
|
|
|
|
fields=[
|
2016-08-10 11:52:57 +00:00
|
|
|
('user', models.OneToOneField(primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
|
2016-08-24 20:09:23 +00:00
|
|
|
('account_id', models.CharField(unique=True, max_length=10, verbose_name='account id')),
|
|
|
|
('amount', accounting.models.CurrencyField(decimal_places=2, max_digits=12, verbose_name='amount')),
|
2016-05-30 10:23:59 +00:00
|
|
|
],
|
|
|
|
options={
|
|
|
|
'verbose_name': 'customer',
|
2016-08-10 11:52:57 +00:00
|
|
|
'ordering': ['account_id'],
|
2016-08-24 20:09:23 +00:00
|
|
|
'verbose_name_plural': 'customers',
|
2016-08-10 11:52:57 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='Permanency',
|
|
|
|
fields=[
|
2016-08-24 20:09:23 +00:00
|
|
|
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
2016-08-10 11:52:57 +00:00
|
|
|
('start', models.DateTimeField(verbose_name='start date')),
|
|
|
|
('end', models.DateTimeField(verbose_name='end date')),
|
2016-08-24 20:09:23 +00:00
|
|
|
('counter', models.ForeignKey(to='counter.Counter', related_name='permanencies')),
|
|
|
|
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, related_name='permanencies')),
|
2016-08-10 11:52:57 +00:00
|
|
|
],
|
|
|
|
options={
|
|
|
|
'verbose_name': 'permanency',
|
2016-05-30 10:23:59 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='Product',
|
|
|
|
fields=[
|
2016-08-24 20:09:23 +00:00
|
|
|
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
|
|
|
('name', models.CharField(max_length=64, verbose_name='name')),
|
|
|
|
('description', models.TextField(blank=True, verbose_name='description')),
|
|
|
|
('code', models.CharField(max_length=16, blank=True, verbose_name='code')),
|
|
|
|
('purchase_price', accounting.models.CurrencyField(decimal_places=2, max_digits=12, verbose_name='purchase price')),
|
|
|
|
('selling_price', accounting.models.CurrencyField(decimal_places=2, max_digits=12, verbose_name='selling price')),
|
|
|
|
('special_selling_price', accounting.models.CurrencyField(decimal_places=2, max_digits=12, verbose_name='special selling price')),
|
|
|
|
('icon', models.ImageField(upload_to='products', null=True, verbose_name='icon', blank=True)),
|
|
|
|
('limit_age', models.IntegerField(default=0, verbose_name='limit age')),
|
|
|
|
('tray', models.BooleanField(verbose_name='tray price', default=False)),
|
|
|
|
('buying_groups', models.ManyToManyField(related_name='products', to='core.Group', verbose_name='buying groups')),
|
|
|
|
('club', models.ForeignKey(verbose_name='club', to='club.Club', related_name='products')),
|
|
|
|
('parent_product', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, null=True, related_name='children_products', verbose_name='parent product', to='counter.Product', blank=True)),
|
2016-05-30 10:23:59 +00:00
|
|
|
],
|
2016-08-10 11:52:57 +00:00
|
|
|
options={
|
|
|
|
'verbose_name': 'product',
|
|
|
|
},
|
2016-05-30 10:23:59 +00:00
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='ProductType',
|
|
|
|
fields=[
|
2016-08-24 20:09:23 +00:00
|
|
|
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
|
|
|
('name', models.CharField(max_length=30, verbose_name='name')),
|
|
|
|
('description', models.TextField(null=True, verbose_name='description', blank=True)),
|
2016-08-10 11:52:57 +00:00
|
|
|
('icon', models.ImageField(upload_to='products', null=True, blank=True)),
|
|
|
|
],
|
|
|
|
options={
|
|
|
|
'verbose_name': 'product type',
|
|
|
|
},
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='Refilling',
|
|
|
|
fields=[
|
2016-08-24 20:09:23 +00:00
|
|
|
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
|
|
|
('amount', accounting.models.CurrencyField(decimal_places=2, max_digits=12, verbose_name='amount')),
|
|
|
|
('date', models.DateTimeField(verbose_name='date')),
|
|
|
|
('payment_method', models.CharField(choices=[('CHECK', 'Check'), ('CASH', 'Cash'), ('CARD', 'Credit card')], max_length=255, default='CASH', verbose_name='payment method')),
|
|
|
|
('bank', models.CharField(choices=[('OTHER', 'Autre'), ('SOCIETE-GENERALE', 'Société générale'), ('BANQUE-POPULAIRE', 'Banque populaire'), ('BNP', 'BNP'), ('CAISSE-EPARGNE', "Caisse d'épargne"), ('CIC', 'CIC'), ('CREDIT-AGRICOLE', 'Crédit Agricole'), ('CREDIT-MUTUEL', 'Credit Mutuel'), ('CREDIT-LYONNAIS', 'Credit Lyonnais'), ('LA-POSTE', 'La Poste')], max_length=255, default='OTHER', verbose_name='bank')),
|
|
|
|
('is_validated', models.BooleanField(verbose_name='is validated', default=False)),
|
|
|
|
('counter', models.ForeignKey(to='counter.Counter', related_name='refillings')),
|
|
|
|
('customer', models.ForeignKey(to='counter.Customer', related_name='refillings')),
|
|
|
|
('operator', models.ForeignKey(to=settings.AUTH_USER_MODEL, related_name='refillings_as_operator')),
|
2016-05-30 10:23:59 +00:00
|
|
|
],
|
2016-08-10 11:52:57 +00:00
|
|
|
options={
|
|
|
|
'verbose_name': 'refilling',
|
|
|
|
},
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='Selling',
|
|
|
|
fields=[
|
2016-08-24 20:09:23 +00:00
|
|
|
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
|
|
|
('label', models.CharField(max_length=64, verbose_name='label')),
|
|
|
|
('unit_price', accounting.models.CurrencyField(decimal_places=2, max_digits=12, verbose_name='unit price')),
|
2016-08-10 11:52:57 +00:00
|
|
|
('quantity', models.IntegerField(verbose_name='quantity')),
|
2016-08-24 20:09:23 +00:00
|
|
|
('date', models.DateTimeField(verbose_name='date')),
|
|
|
|
('payment_method', models.CharField(choices=[('SITH_ACCOUNT', 'Sith account'), ('CARD', 'Credit card')], max_length=255, default='SITH_ACCOUNT', verbose_name='payment method')),
|
|
|
|
('is_validated', models.BooleanField(verbose_name='is validated', default=False)),
|
|
|
|
('club', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, null=True, to='club.Club', related_name='sellings')),
|
|
|
|
('counter', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, null=True, to='counter.Counter', related_name='sellings')),
|
|
|
|
('customer', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, null=True, to='counter.Customer', related_name='buyings')),
|
|
|
|
('product', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, null=True, to='counter.Product', related_name='sellings', blank=True)),
|
|
|
|
('seller', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, null=True, to=settings.AUTH_USER_MODEL, related_name='sellings_as_operator')),
|
2016-08-10 11:52:57 +00:00
|
|
|
],
|
|
|
|
options={
|
|
|
|
'verbose_name': 'selling',
|
|
|
|
},
|
2016-05-30 10:23:59 +00:00
|
|
|
),
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='product',
|
|
|
|
name='product_type',
|
2016-08-24 20:09:23 +00:00
|
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, null=True, related_name='products', verbose_name='product type', to='counter.ProductType', blank=True),
|
2016-05-30 10:23:59 +00:00
|
|
|
),
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='counter',
|
|
|
|
name='products',
|
2016-08-24 20:09:23 +00:00
|
|
|
field=models.ManyToManyField(to='counter.Product', blank=True, related_name='counters'),
|
|
|
|
),
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='counter',
|
|
|
|
name='sellers',
|
2016-12-10 00:58:30 +00:00
|
|
|
field=models.ManyToManyField(related_name='counters', to='core.User', blank=True, verbose_name='sellers'),
|
2016-08-24 20:09:23 +00:00
|
|
|
),
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='counter',
|
|
|
|
name='view_groups',
|
|
|
|
field=models.ManyToManyField(to='core.Group', blank=True, related_name='viewable_counters'),
|
2016-05-30 10:23:59 +00:00
|
|
|
),
|
2016-03-28 12:54:35 +00:00
|
|
|
]
|