feat: added shop models
This commit is contained in:
@@ -0,0 +1,250 @@
|
||||
# Generated by Django 5.0.3 on 2024-03-24 12:51
|
||||
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
from decimal import Decimal
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="OrderLine",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"quantity",
|
||||
models.DecimalField(
|
||||
decimal_places=4,
|
||||
default=Decimal("1"),
|
||||
max_digits=13,
|
||||
verbose_name="Cantidad",
|
||||
),
|
||||
),
|
||||
(
|
||||
"price",
|
||||
models.DecimalField(
|
||||
decimal_places=4, max_digits=13, verbose_name="Precio"
|
||||
),
|
||||
),
|
||||
(
|
||||
"base_total",
|
||||
models.DecimalField(
|
||||
decimal_places=4,
|
||||
default=Decimal("0"),
|
||||
max_digits=13,
|
||||
verbose_name="Total sin impuestos",
|
||||
),
|
||||
),
|
||||
(
|
||||
"tax_value",
|
||||
models.PositiveIntegerField(verbose_name="Valor de impuestos"),
|
||||
),
|
||||
(
|
||||
"taxes",
|
||||
models.DecimalField(
|
||||
decimal_places=4, max_digits=13, verbose_name="Impuestos"
|
||||
),
|
||||
),
|
||||
(
|
||||
"total",
|
||||
models.DecimalField(
|
||||
decimal_places=4, max_digits=13, verbose_name="Total"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Línea de pedido",
|
||||
"verbose_name_plural": "Líneas de pedido",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Product",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("name", models.CharField(max_length=96, verbose_name="Nombre")),
|
||||
(
|
||||
"description",
|
||||
models.CharField(
|
||||
blank=True,
|
||||
default="",
|
||||
max_length=1000,
|
||||
verbose_name="Descripción",
|
||||
),
|
||||
),
|
||||
(
|
||||
"stock",
|
||||
models.DecimalField(
|
||||
decimal_places=4,
|
||||
default=Decimal("0"),
|
||||
max_digits=13,
|
||||
verbose_name="Stock",
|
||||
),
|
||||
),
|
||||
(
|
||||
"unit",
|
||||
models.CharField(
|
||||
choices=[("UNIT", "Unidad"), ("KG", "kg"), ("L", "L")],
|
||||
default="UNIT",
|
||||
max_length=6,
|
||||
verbose_name="Unidad de medida",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Producto",
|
||||
"verbose_name_plural": "Productos",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Tax",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"code",
|
||||
models.CharField(
|
||||
max_length=8, unique=True, verbose_name="Código de impuesto"
|
||||
),
|
||||
),
|
||||
(
|
||||
"value",
|
||||
models.PositiveIntegerField(
|
||||
verbose_name="Valor entero (porcentaje)"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Impuesto",
|
||||
"verbose_name_plural": "Impuestos",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Order",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"creation_date",
|
||||
models.DateTimeField(
|
||||
auto_now_add=True, verbose_name="Fecha de creación"
|
||||
),
|
||||
),
|
||||
(
|
||||
"last_modification_date",
|
||||
models.DateTimeField(
|
||||
auto_now=True, verbose_name="Fecha de última modificación"
|
||||
),
|
||||
),
|
||||
(
|
||||
"base_total",
|
||||
models.DecimalField(
|
||||
decimal_places=2,
|
||||
default=Decimal("0"),
|
||||
max_digits=13,
|
||||
verbose_name="Base imponible",
|
||||
),
|
||||
),
|
||||
(
|
||||
"total",
|
||||
models.DecimalField(
|
||||
decimal_places=2,
|
||||
default=Decimal("0"),
|
||||
max_digits=13,
|
||||
verbose_name="Total",
|
||||
),
|
||||
),
|
||||
(
|
||||
"lines",
|
||||
models.ManyToManyField(to="shop.orderline", verbose_name="Líneas"),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Pedido",
|
||||
"verbose_name_plural": "Pedidos",
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="orderline",
|
||||
name="product",
|
||||
field=models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="shop.product",
|
||||
verbose_name="Producto",
|
||||
),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="ProductPrice",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"price",
|
||||
models.DecimalField(
|
||||
decimal_places=2, max_digits=11, verbose_name="Precio"
|
||||
),
|
||||
),
|
||||
(
|
||||
"date",
|
||||
models.DateTimeField(
|
||||
default=django.utils.timezone.now, verbose_name="Fecha"
|
||||
),
|
||||
),
|
||||
(
|
||||
"product",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="prices",
|
||||
to="shop.product",
|
||||
verbose_name="Producto",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Precio de producto",
|
||||
"verbose_name_plural": "Precio de producto",
|
||||
},
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user