0001_initial.py 15.4 KB
Newer Older
Skia's avatar
Skia committed
1
2
3
4
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
5
import accounting.models
6
import django.db.models.deletion
7
from django.conf import settings
8
import django.db.models.deletion
Skia's avatar
Skia committed
9
10
11
12
13


class Migration(migrations.Migration):

    dependencies = [
Sli's avatar
Sli committed
14
        ("subscription", "0001_initial"),
Skia's avatar
Skia committed
15
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
Sli's avatar
Sli committed
16
17
        ("core", "0001_initial"),
        ("club", "0002_auto_20160824_2152"),
Skia's avatar
Skia committed
18
19
20
21
    ]

    operations = [
        migrations.CreateModel(
Sli's avatar
Sli committed
22
            name="Counter",
Skia's avatar
Skia committed
23
            fields=[
Sli's avatar
Sli committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
                (
                    "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",
                    ),
                ),
46
47
48
49
50
51
52
53
                (
                    "club",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="club.Club",
                        related_name="counters",
                    ),
                ),
Sli's avatar
Sli committed
54
55
56
57
58
59
                (
                    "edit_groups",
                    models.ManyToManyField(
                        to="core.Group", blank=True, related_name="editable_counters"
                    ),
                ),
Skia's avatar
Skia committed
60
            ],
Sli's avatar
Sli committed
61
            options={"verbose_name": "counter"},
Skia's avatar
Skia committed
62
        ),
63
        migrations.CreateModel(
Sli's avatar
Sli committed
64
            name="Customer",
65
            fields=[
Sli's avatar
Sli committed
66
67
68
                (
                    "user",
                    models.OneToOneField(
69
70
71
72
                        on_delete=django.db.models.deletion.CASCADE,
                        primary_key=True,
                        serialize=False,
                        to=settings.AUTH_USER_MODEL,
Sli's avatar
Sli committed
73
74
75
76
77
78
79
80
81
82
83
84
85
86
                    ),
                ),
                (
                    "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"
                    ),
                ),
87
88
            ],
            options={
Sli's avatar
Sli committed
89
90
91
                "verbose_name": "customer",
                "ordering": ["account_id"],
                "verbose_name_plural": "customers",
Skia's avatar
Skia committed
92
93
94
            },
        ),
        migrations.CreateModel(
Sli's avatar
Sli committed
95
            name="Permanency",
Skia's avatar
Skia committed
96
            fields=[
Sli's avatar
Sli committed
97
98
99
100
101
102
103
104
105
106
107
108
109
110
                (
                    "id",
                    models.AutoField(
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                        auto_created=True,
                    ),
                ),
                ("start", models.DateTimeField(verbose_name="start date")),
                ("end", models.DateTimeField(verbose_name="end date")),
                (
                    "counter",
                    models.ForeignKey(
111
112
113
                        on_delete=django.db.models.deletion.CASCADE,
                        to="counter.Counter",
                        related_name="permanencies",
Sli's avatar
Sli committed
114
115
116
117
118
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
119
120
121
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                        related_name="permanencies",
Sli's avatar
Sli committed
122
123
                    ),
                ),
Skia's avatar
Skia committed
124
            ],
Sli's avatar
Sli committed
125
            options={"verbose_name": "permanency"},
126
127
        ),
        migrations.CreateModel(
Sli's avatar
Sli committed
128
            name="Product",
129
            fields=[
Sli's avatar
Sli committed
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
                (
                    "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(
187
188
189
190
                        on_delete=django.db.models.deletion.CASCADE,
                        verbose_name="club",
                        to="club.Club",
                        related_name="products",
Sli's avatar
Sli committed
191
192
193
194
195
196
197
198
199
200
201
202
203
                    ),
                ),
                (
                    "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,
                    ),
                ),
204
            ],
Sli's avatar
Sli committed
205
            options={"verbose_name": "product"},
206
207
        ),
        migrations.CreateModel(
Sli's avatar
Sli committed
208
            name="ProductType",
209
            fields=[
Sli's avatar
Sli committed
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
                (
                    "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),
                ),
                (
                    "icon",
                    models.ImageField(upload_to="products", null=True, blank=True),
                ),
Skia's avatar
Skia committed
228
            ],
Sli's avatar
Sli committed
229
            options={"verbose_name": "product type"},
Skia's avatar
Skia committed
230
231
        ),
        migrations.CreateModel(
Sli's avatar
Sli committed
232
            name="Refilling",
Skia's avatar
Skia committed
233
            fields=[
Sli's avatar
Sli committed
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
                (
                    "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",
289
290
291
292
293
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="counter.Counter",
                        related_name="refillings",
                    ),
Sli's avatar
Sli committed
294
295
296
                ),
                (
                    "customer",
297
298
299
300
301
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="counter.Customer",
                        related_name="refillings",
                    ),
Sli's avatar
Sli committed
302
303
304
305
                ),
                (
                    "operator",
                    models.ForeignKey(
306
                        on_delete=django.db.models.deletion.CASCADE,
Sli's avatar
Sli committed
307
308
309
310
                        to=settings.AUTH_USER_MODEL,
                        related_name="refillings_as_operator",
                    ),
                ),
311
            ],
Sli's avatar
Sli committed
312
            options={"verbose_name": "refilling"},
Skia's avatar
Skia committed
313
314
        ),
        migrations.CreateModel(
Sli's avatar
Sli committed
315
            name="Selling",
Skia's avatar
Skia committed
316
            fields=[
Sli's avatar
Sli committed
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
                (
                    "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"
                    ),
                ),
                ("quantity", models.IntegerField(verbose_name="quantity")),
                ("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",
                    ),
                ),
Skia's avatar
Skia committed
397
            ],
Sli's avatar
Sli committed
398
            options={"verbose_name": "selling"},
399
400
        ),
        migrations.AddField(
Sli's avatar
Sli committed
401
402
403
404
405
406
407
408
409
410
            model_name="product",
            name="product_type",
            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,
            ),
411
412
        ),
        migrations.AddField(
Sli's avatar
Sli committed
413
414
415
416
417
            model_name="counter",
            name="products",
            field=models.ManyToManyField(
                to="counter.Product", blank=True, related_name="counters"
            ),
418
419
        ),
        migrations.AddField(
Sli's avatar
Sli committed
420
421
422
423
424
425
426
427
            model_name="counter",
            name="sellers",
            field=models.ManyToManyField(
                related_name="counters",
                to="core.User",
                blank=True,
                verbose_name="sellers",
            ),
428
429
        ),
        migrations.AddField(
Sli's avatar
Sli committed
430
431
432
433
434
            model_name="counter",
            name="view_groups",
            field=models.ManyToManyField(
                to="core.Group", blank=True, related_name="viewable_counters"
            ),
435
        ),
Skia's avatar
Skia committed
436
    ]