2016-10-31 07:19:46 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2017-01-07 10:17:06 +00:00
|
|
|
import django.db.models.deletion
|
2024-06-24 11:07:36 +00:00
|
|
|
from django.db import migrations, models
|
2016-10-31 07:19:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
2018-10-04 19:29:19 +00:00
|
|
|
dependencies = [("counter", "0011_auto_20161004_2039")]
|
2016-10-31 07:19:46 +00:00
|
|
|
|
|
|
|
operations = [
|
2017-01-07 10:17:06 +00:00
|
|
|
migrations.CreateModel(
|
2018-10-04 19:29:19 +00:00
|
|
|
name="ShoppingList",
|
2017-01-07 10:17:06 +00:00
|
|
|
fields=[
|
2018-10-04 19:29:19 +00:00
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
verbose_name="ID",
|
|
|
|
primary_key=True,
|
|
|
|
serialize=False,
|
|
|
|
auto_created=True,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("date", models.DateTimeField(verbose_name="date")),
|
|
|
|
("name", models.CharField(max_length=64, verbose_name="name")),
|
|
|
|
("todo", models.BooleanField(verbose_name="todo")),
|
|
|
|
(
|
|
|
|
"comment",
|
|
|
|
models.TextField(verbose_name="comment", blank=True, null=True),
|
|
|
|
),
|
2017-04-25 07:49:05 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2018-10-04 19:29:19 +00:00
|
|
|
name="ShoppingListItem",
|
2017-04-25 07:49:05 +00:00
|
|
|
fields=[
|
2018-10-04 19:29:19 +00:00
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
verbose_name="ID",
|
|
|
|
primary_key=True,
|
|
|
|
serialize=False,
|
|
|
|
auto_created=True,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("name", models.CharField(max_length=64, verbose_name="name")),
|
|
|
|
(
|
|
|
|
"tobuy_quantity",
|
|
|
|
models.IntegerField(
|
|
|
|
verbose_name="quantity to buy",
|
|
|
|
help_text="quantity to buy during the next shopping session",
|
|
|
|
default=6,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"bought_quantity",
|
|
|
|
models.IntegerField(
|
|
|
|
verbose_name="quantity bought",
|
|
|
|
help_text="quantity bought during the last shopping session",
|
|
|
|
default=0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"shopping_lists",
|
|
|
|
models.ManyToManyField(
|
|
|
|
verbose_name="shopping lists",
|
|
|
|
related_name="shopping_items_to_buy",
|
|
|
|
to="stock.ShoppingList",
|
|
|
|
),
|
|
|
|
),
|
2017-01-07 10:17:06 +00:00
|
|
|
],
|
|
|
|
),
|
2016-10-31 07:19:46 +00:00
|
|
|
migrations.CreateModel(
|
2018-10-04 19:29:19 +00:00
|
|
|
name="Stock",
|
2016-10-31 07:19:46 +00:00
|
|
|
fields=[
|
2018-10-04 19:29:19 +00:00
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
verbose_name="ID",
|
|
|
|
primary_key=True,
|
|
|
|
serialize=False,
|
|
|
|
auto_created=True,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("name", models.CharField(max_length=64, verbose_name="name")),
|
|
|
|
(
|
|
|
|
"counter",
|
|
|
|
models.OneToOneField(
|
2019-10-05 22:38:25 +00:00
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
2018-10-04 19:29:19 +00:00
|
|
|
verbose_name="counter",
|
|
|
|
related_name="stock",
|
|
|
|
to="counter.Counter",
|
|
|
|
),
|
|
|
|
),
|
2016-10-31 07:19:46 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2018-10-04 19:29:19 +00:00
|
|
|
name="StockItem",
|
2016-10-31 07:19:46 +00:00
|
|
|
fields=[
|
2018-10-04 19:29:19 +00:00
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
verbose_name="ID",
|
|
|
|
primary_key=True,
|
|
|
|
serialize=False,
|
|
|
|
auto_created=True,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("name", models.CharField(max_length=64, verbose_name="name")),
|
|
|
|
(
|
|
|
|
"unit_quantity",
|
|
|
|
models.IntegerField(
|
|
|
|
verbose_name="unit quantity",
|
|
|
|
help_text="number of element in one box",
|
|
|
|
default=0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"effective_quantity",
|
|
|
|
models.IntegerField(
|
|
|
|
verbose_name="effective quantity",
|
|
|
|
help_text="number of box",
|
|
|
|
default=0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"minimal_quantity",
|
|
|
|
models.IntegerField(
|
|
|
|
verbose_name="minimal quantity",
|
|
|
|
help_text="if the effective quantity is less than the minimal, item is added to the shopping list",
|
|
|
|
default=1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"stock_owner",
|
2019-10-05 22:32:54 +00:00
|
|
|
models.ForeignKey(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
related_name="items",
|
|
|
|
to="stock.Stock",
|
|
|
|
),
|
2018-10-04 19:29:19 +00:00
|
|
|
),
|
|
|
|
(
|
|
|
|
"type",
|
|
|
|
models.ForeignKey(
|
|
|
|
blank=True,
|
|
|
|
null=True,
|
|
|
|
verbose_name="type",
|
|
|
|
related_name="stock_items",
|
|
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
|
|
to="counter.ProductType",
|
|
|
|
),
|
|
|
|
),
|
2016-10-31 07:19:46 +00:00
|
|
|
],
|
|
|
|
),
|
2017-01-07 10:17:06 +00:00
|
|
|
migrations.AddField(
|
2018-10-04 19:29:19 +00:00
|
|
|
model_name="shoppinglistitem",
|
|
|
|
name="stockitem_owner",
|
|
|
|
field=models.ForeignKey(
|
2019-10-05 22:32:54 +00:00
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
null=True,
|
|
|
|
related_name="shopping_item",
|
|
|
|
to="stock.StockItem",
|
2018-10-04 19:29:19 +00:00
|
|
|
),
|
2017-04-25 07:49:05 +00:00
|
|
|
),
|
|
|
|
migrations.AddField(
|
2018-10-04 19:29:19 +00:00
|
|
|
model_name="shoppinglistitem",
|
|
|
|
name="type",
|
|
|
|
field=models.ForeignKey(
|
|
|
|
blank=True,
|
|
|
|
null=True,
|
|
|
|
verbose_name="type",
|
|
|
|
related_name="shoppinglist_items",
|
|
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
|
|
to="counter.ProductType",
|
|
|
|
),
|
2017-01-07 10:17:06 +00:00
|
|
|
),
|
|
|
|
migrations.AddField(
|
2018-10-04 19:29:19 +00:00
|
|
|
model_name="shoppinglist",
|
|
|
|
name="stock_owner",
|
|
|
|
field=models.ForeignKey(
|
2019-10-05 22:32:54 +00:00
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
null=True,
|
|
|
|
related_name="shopping_lists",
|
|
|
|
to="stock.Stock",
|
2018-10-04 19:29:19 +00:00
|
|
|
),
|
2017-01-07 10:17:06 +00:00
|
|
|
),
|
2016-10-31 07:19:46 +00:00
|
|
|
]
|