fix: set lowercase for verbose name strings
This commit is contained in:
@@ -0,0 +1,554 @@
|
|||||||
|
# Generated by Django 5.0.6 on 2024-06-02 19:47
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
import django.utils.timezone
|
||||||
|
from decimal import Decimal
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("files", "0001_initial"),
|
||||||
|
("shop", "0002_alter_productprice_options_alter_tax_options_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="brand",
|
||||||
|
name="creation_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now_add=True, verbose_name="fecha de creación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="brand",
|
||||||
|
name="last_modification_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now=True, verbose_name="fecha de última modificación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="brand",
|
||||||
|
name="name",
|
||||||
|
field=models.CharField(max_length=100, unique=True, verbose_name="nombre"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="customer",
|
||||||
|
name="address",
|
||||||
|
field=models.CharField(max_length=255, verbose_name="dirección"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="customer",
|
||||||
|
name="city",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="ciudad"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="customer",
|
||||||
|
name="country",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="país"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="customer",
|
||||||
|
name="creation_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now_add=True, verbose_name="fecha de creación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="customer",
|
||||||
|
name="email",
|
||||||
|
field=models.EmailField(max_length=254, verbose_name="e-mail"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="customer",
|
||||||
|
name="first_name",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="nombre"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="customer",
|
||||||
|
name="last_modification_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now=True, verbose_name="fecha de última modificación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="customer",
|
||||||
|
name="last_name",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="apellidos"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="customer",
|
||||||
|
name="state",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="región"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="customer",
|
||||||
|
name="vat_id",
|
||||||
|
field=models.CharField(
|
||||||
|
max_length=32, unique=True, verbose_name="documento de identidad"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="customer",
|
||||||
|
name="zip",
|
||||||
|
field=models.CharField(max_length=32, verbose_name="código postal"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="base_total",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2,
|
||||||
|
default=Decimal("0"),
|
||||||
|
max_digits=13,
|
||||||
|
verbose_name="base imponible",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="billing_address",
|
||||||
|
field=models.CharField(
|
||||||
|
max_length=255, verbose_name="dirección de facturación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="billing_city",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="ciudad de facturación"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="billing_country",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="país de facturación"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="billing_state",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="región de facturación"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="billing_zip",
|
||||||
|
field=models.CharField(
|
||||||
|
max_length=32, verbose_name="código postal de facturación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="contact_phone",
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True, max_length=32, verbose_name="teléfono de contacto"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="creation_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now_add=True, verbose_name="fecha de creación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="customer",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.PROTECT,
|
||||||
|
to="shop.customer",
|
||||||
|
verbose_name="cliente",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="last_modification_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now=True, verbose_name="fecha de última modificación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="shipping_address",
|
||||||
|
field=models.CharField(max_length=255, verbose_name="dirección"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="shipping_city",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="ciudad"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="shipping_country",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="país"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="shipping_state",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="región"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="shipping_zip",
|
||||||
|
field=models.CharField(max_length=32, verbose_name="código postal"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="status",
|
||||||
|
field=models.CharField(default="PEN", max_length=3, verbose_name="estado"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="order",
|
||||||
|
name="total",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2,
|
||||||
|
default=Decimal("0"),
|
||||||
|
max_digits=13,
|
||||||
|
verbose_name="total",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="orderline",
|
||||||
|
name="base_total",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=4,
|
||||||
|
default=Decimal("0"),
|
||||||
|
max_digits=13,
|
||||||
|
verbose_name="total sin impuestos",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="orderline",
|
||||||
|
name="creation_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now_add=True, verbose_name="fecha de creación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="orderline",
|
||||||
|
name="last_modification_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now=True, verbose_name="fecha de última modificación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="orderline",
|
||||||
|
name="order",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
related_name="lines",
|
||||||
|
to="shop.order",
|
||||||
|
verbose_name="pedido",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="orderline",
|
||||||
|
name="price",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=4, max_digits=13, verbose_name="precio"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="orderline",
|
||||||
|
name="product",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="shop.product",
|
||||||
|
verbose_name="producto",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="orderline",
|
||||||
|
name="quantity",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=4,
|
||||||
|
default=Decimal("1"),
|
||||||
|
max_digits=13,
|
||||||
|
verbose_name="cantidad",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="orderline",
|
||||||
|
name="tax_value",
|
||||||
|
field=models.PositiveIntegerField(verbose_name="valor de impuestos"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="orderline",
|
||||||
|
name="taxes",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=4, max_digits=13, verbose_name="impuestos"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="orderline",
|
||||||
|
name="total",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=4, max_digits=13, verbose_name="total"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="product",
|
||||||
|
name="brand",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
to="shop.brand",
|
||||||
|
verbose_name="marca",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="product",
|
||||||
|
name="creation_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now_add=True, verbose_name="fecha de creación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="product",
|
||||||
|
name="description",
|
||||||
|
field=models.TextField(blank=True, default="", verbose_name="descripción"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="product",
|
||||||
|
name="images",
|
||||||
|
field=models.ManyToManyField(
|
||||||
|
blank=True, to="files.fileupload", verbose_name="imágenes"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="product",
|
||||||
|
name="is_digital_asset",
|
||||||
|
field=models.BooleanField(
|
||||||
|
default=False, verbose_name="es un activo digital"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="product",
|
||||||
|
name="last_modification_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now=True, verbose_name="fecha de última modificación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="product",
|
||||||
|
name="name",
|
||||||
|
field=models.CharField(max_length=96, verbose_name="nombre"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="product",
|
||||||
|
name="sku",
|
||||||
|
field=models.CharField(
|
||||||
|
max_length=64, unique=True, verbose_name="código de referencia"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="product",
|
||||||
|
name="stock",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=4,
|
||||||
|
default=Decimal("0"),
|
||||||
|
max_digits=13,
|
||||||
|
verbose_name="stock",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="product",
|
||||||
|
name="tags",
|
||||||
|
field=models.ManyToManyField(
|
||||||
|
blank=True, to="shop.tag", verbose_name="etiquetas"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="productbatch",
|
||||||
|
name="code",
|
||||||
|
field=models.CharField(
|
||||||
|
db_index=True, max_length=32, unique=True, verbose_name="código"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="productbatch",
|
||||||
|
name="creation_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now_add=True, verbose_name="fecha de creación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="productbatch",
|
||||||
|
name="expiration_date",
|
||||||
|
field=models.DateField(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
verbose_name="fecha de caducidad / consumo preferente",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="productbatch",
|
||||||
|
name="last_modification_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now=True, verbose_name="fecha de última modificación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="productbatch",
|
||||||
|
name="product",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.PROTECT,
|
||||||
|
to="shop.product",
|
||||||
|
verbose_name="producto",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="productbatch",
|
||||||
|
name="provider",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
to="shop.provider",
|
||||||
|
verbose_name="proveedor",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="productbatch",
|
||||||
|
name="quantity",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=4,
|
||||||
|
default=Decimal("1"),
|
||||||
|
max_digits=13,
|
||||||
|
verbose_name="cantidad",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="productprice",
|
||||||
|
name="creation_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now_add=True, verbose_name="fecha de creación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="productprice",
|
||||||
|
name="current",
|
||||||
|
field=models.BooleanField(
|
||||||
|
default=False, verbose_name="es el precio actual"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="productprice",
|
||||||
|
name="date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
default=django.utils.timezone.now, verbose_name="fecha"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="productprice",
|
||||||
|
name="last_modification_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now=True, verbose_name="fecha de última modificación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="productprice",
|
||||||
|
name="price",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2, max_digits=11, verbose_name="precio"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="productprice",
|
||||||
|
name="product",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
related_name="prices",
|
||||||
|
to="shop.product",
|
||||||
|
verbose_name="producto",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="productprice",
|
||||||
|
name="tax",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.PROTECT,
|
||||||
|
to="shop.tax",
|
||||||
|
verbose_name="impuesto aplicable",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="provider",
|
||||||
|
name="address",
|
||||||
|
field=models.CharField(max_length=255, verbose_name="dirección"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="provider",
|
||||||
|
name="city",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="ciudad"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="provider",
|
||||||
|
name="country",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="país"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="provider",
|
||||||
|
name="creation_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now_add=True, verbose_name="fecha de creación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="provider",
|
||||||
|
name="email",
|
||||||
|
field=models.EmailField(max_length=254, verbose_name="e-mail de contacto"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="provider",
|
||||||
|
name="last_modification_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now=True, verbose_name="fecha de última modificación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="provider",
|
||||||
|
name="name",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="nombre"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="provider",
|
||||||
|
name="state",
|
||||||
|
field=models.CharField(max_length=64, verbose_name="región"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="provider",
|
||||||
|
name="vat_id",
|
||||||
|
field=models.CharField(
|
||||||
|
max_length=32, unique=True, verbose_name="documento de identidad"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="provider",
|
||||||
|
name="zip",
|
||||||
|
field=models.CharField(max_length=32, verbose_name="código postal"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="tax",
|
||||||
|
name="code",
|
||||||
|
field=models.CharField(
|
||||||
|
max_length=8, unique=True, verbose_name="código de impuesto"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="tax",
|
||||||
|
name="creation_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now_add=True, verbose_name="fecha de creación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="tax",
|
||||||
|
name="last_modification_date",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now=True, verbose_name="fecha de última modificación"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="tax",
|
||||||
|
name="value",
|
||||||
|
field=models.PositiveIntegerField(verbose_name="valor entero (porcentaje)"),
|
||||||
|
),
|
||||||
|
]
|
||||||
+74
-72
@@ -8,10 +8,10 @@ from django.utils.text import gettext_lazy as _
|
|||||||
|
|
||||||
class TimestampedModel(models.Model):
|
class TimestampedModel(models.Model):
|
||||||
creation_date = models.DateTimeField(
|
creation_date = models.DateTimeField(
|
||||||
auto_now_add=True, verbose_name=_("Fecha de creación")
|
auto_now_add=True, verbose_name=_("fecha de creación")
|
||||||
)
|
)
|
||||||
last_modification_date = models.DateTimeField(
|
last_modification_date = models.DateTimeField(
|
||||||
auto_now=True, verbose_name=_("Fecha de última modificación")
|
auto_now=True, verbose_name=_("fecha de última modificación")
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@@ -36,37 +36,39 @@ class Product(TimestampedModel):
|
|||||||
blank=False,
|
blank=False,
|
||||||
null=False,
|
null=False,
|
||||||
unique=True,
|
unique=True,
|
||||||
verbose_name=_("Código de referencia"),
|
verbose_name=_("código de referencia"),
|
||||||
)
|
)
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
max_length=96,
|
max_length=96,
|
||||||
blank=False,
|
blank=False,
|
||||||
null=False,
|
null=False,
|
||||||
verbose_name=_("Nombre"),
|
verbose_name=_("nombre"),
|
||||||
)
|
)
|
||||||
description = models.TextField(
|
description = models.TextField(
|
||||||
blank=True,
|
blank=True,
|
||||||
default="",
|
default="",
|
||||||
verbose_name=_("Descripción"),
|
verbose_name=_("descripción"),
|
||||||
)
|
)
|
||||||
stock = models.DecimalField(
|
stock = models.DecimalField(
|
||||||
max_digits=13,
|
max_digits=13,
|
||||||
decimal_places=4,
|
decimal_places=4,
|
||||||
default=Decimal("0"),
|
default=Decimal("0"),
|
||||||
verbose_name=_("Stock"),
|
verbose_name=_("stock"),
|
||||||
|
)
|
||||||
|
is_digital_asset = models.BooleanField(
|
||||||
|
default=False, verbose_name=_("es un activo digital")
|
||||||
)
|
)
|
||||||
is_digital_asset = models.BooleanField(default=False)
|
|
||||||
url = models.URLField(blank=True, verbose_name=_("URL de descarga"))
|
url = models.URLField(blank=True, verbose_name=_("URL de descarga"))
|
||||||
images = models.ManyToManyField(
|
images = models.ManyToManyField(
|
||||||
"files.FileUpload", blank=True, verbose_name=_("Imágenes")
|
"files.FileUpload", blank=True, verbose_name=_("imágenes")
|
||||||
)
|
)
|
||||||
tags = models.ManyToManyField("shop.Tag", blank=True, verbose_name=_("Etiquetas"))
|
tags = models.ManyToManyField("shop.Tag", blank=True, verbose_name=_("etiquetas"))
|
||||||
brand = models.ForeignKey(
|
brand = models.ForeignKey(
|
||||||
"shop.Brand",
|
"shop.Brand",
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
on_delete=models.SET_NULL,
|
on_delete=models.SET_NULL,
|
||||||
verbose_name=_("Marca"),
|
verbose_name=_("marca"),
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
@@ -84,21 +86,21 @@ class Product(TimestampedModel):
|
|||||||
|
|
||||||
class ProductPrice(TimestampedModel):
|
class ProductPrice(TimestampedModel):
|
||||||
price = models.DecimalField(
|
price = models.DecimalField(
|
||||||
max_digits=11, decimal_places=2, verbose_name=_("Precio")
|
max_digits=11, decimal_places=2, verbose_name=_("precio")
|
||||||
)
|
)
|
||||||
date = models.DateTimeField(default=timezone.now, verbose_name=_("Fecha"))
|
date = models.DateTimeField(default=timezone.now, verbose_name=_("fecha"))
|
||||||
product = models.ForeignKey(
|
product = models.ForeignKey(
|
||||||
"shop.Product",
|
"shop.Product",
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
verbose_name=_("Producto"),
|
verbose_name=_("producto"),
|
||||||
related_name="prices",
|
related_name="prices",
|
||||||
)
|
)
|
||||||
tax = models.ForeignKey(
|
tax = models.ForeignKey(
|
||||||
"shop.Tax",
|
"shop.Tax",
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
verbose_name=_("Impuesto aplicable"),
|
verbose_name=_("impuesto aplicable"),
|
||||||
)
|
)
|
||||||
current = models.BooleanField(default=False, verbose_name=_("Es el precio actual"))
|
current = models.BooleanField(default=False, verbose_name=_("es el precio actual"))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.price} - {self.tax.code}"
|
return f"{self.price} - {self.tax.code}"
|
||||||
@@ -116,26 +118,26 @@ class ProductPrice(TimestampedModel):
|
|||||||
|
|
||||||
class ProductBatch(TimestampedModel):
|
class ProductBatch(TimestampedModel):
|
||||||
code = models.CharField(
|
code = models.CharField(
|
||||||
max_length=32, unique=True, db_index=True, verbose_name=_("Código")
|
max_length=32, unique=True, db_index=True, verbose_name=_("código")
|
||||||
)
|
)
|
||||||
product = models.ForeignKey(
|
product = models.ForeignKey(
|
||||||
"shop.Product", on_delete=models.PROTECT, verbose_name=_("Producto")
|
"shop.Product", on_delete=models.PROTECT, verbose_name=_("producto")
|
||||||
)
|
)
|
||||||
quantity = models.DecimalField(
|
quantity = models.DecimalField(
|
||||||
max_digits=13,
|
max_digits=13,
|
||||||
decimal_places=4,
|
decimal_places=4,
|
||||||
default=Decimal("1"),
|
default=Decimal("1"),
|
||||||
verbose_name=_("Cantidad"),
|
verbose_name=_("cantidad"),
|
||||||
)
|
)
|
||||||
expiration_date = models.DateField(
|
expiration_date = models.DateField(
|
||||||
blank=True, null=True, verbose_name=_("Fecha de caducidad / consumo preferente")
|
blank=True, null=True, verbose_name=_("fecha de caducidad / consumo preferente")
|
||||||
)
|
)
|
||||||
provider = models.ForeignKey(
|
provider = models.ForeignKey(
|
||||||
"shop.Provider",
|
"shop.Provider",
|
||||||
on_delete=models.SET_NULL,
|
on_delete=models.SET_NULL,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
verbose_name=_("Proveedor"),
|
verbose_name=_("proveedor"),
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
@@ -148,10 +150,10 @@ class ProductBatch(TimestampedModel):
|
|||||||
|
|
||||||
class Tax(TimestampedModel):
|
class Tax(TimestampedModel):
|
||||||
code = models.CharField(
|
code = models.CharField(
|
||||||
max_length=8, blank=False, unique=True, verbose_name=_("Código de impuesto")
|
max_length=8, blank=False, unique=True, verbose_name=_("código de impuesto")
|
||||||
)
|
)
|
||||||
value = models.PositiveIntegerField(
|
value = models.PositiveIntegerField(
|
||||||
null=False, blank=False, verbose_name=_("Valor entero (porcentaje)")
|
null=False, blank=False, verbose_name=_("valor entero (porcentaje)")
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
@@ -168,19 +170,19 @@ class Customer(TimestampedModel):
|
|||||||
max_length=32,
|
max_length=32,
|
||||||
blank=False,
|
blank=False,
|
||||||
unique=True,
|
unique=True,
|
||||||
verbose_name=_("Documento de identidad"),
|
verbose_name=_("documento de identidad"),
|
||||||
)
|
)
|
||||||
first_name = models.CharField(max_length=64, blank=False, verbose_name=_("Nombre"))
|
first_name = models.CharField(max_length=64, blank=False, verbose_name=_("nombre"))
|
||||||
last_name = models.CharField(
|
last_name = models.CharField(
|
||||||
max_length=64, blank=False, verbose_name=_("Apellidos")
|
max_length=64, blank=False, verbose_name=_("apellidos")
|
||||||
)
|
)
|
||||||
email = models.EmailField(blank=False, verbose_name=_("E-mail"))
|
email = models.EmailField(blank=False, verbose_name=_("e-mail"))
|
||||||
|
|
||||||
address = models.CharField(max_length=255, blank=False, verbose_name=_("Dirección"))
|
address = models.CharField(max_length=255, blank=False, verbose_name=_("dirección"))
|
||||||
city = models.CharField(max_length=64, blank=False, verbose_name=_("Ciudad"))
|
city = models.CharField(max_length=64, blank=False, verbose_name=_("ciudad"))
|
||||||
state = models.CharField(max_length=64, blank=False, verbose_name=_("Región"))
|
state = models.CharField(max_length=64, blank=False, verbose_name=_("región"))
|
||||||
country = models.CharField(max_length=64, blank=False, verbose_name=_("País"))
|
country = models.CharField(max_length=64, blank=False, verbose_name=_("país"))
|
||||||
zip = models.CharField(max_length=32, blank=False, verbose_name=_("Código postal"))
|
zip = models.CharField(max_length=32, blank=False, verbose_name=_("código postal"))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.vat_id} - {self.first_name} {self.last_name}"
|
return f"{self.vat_id} - {self.first_name} {self.last_name}"
|
||||||
@@ -195,11 +197,11 @@ class Provider(TimestampedModel):
|
|||||||
max_length=32,
|
max_length=32,
|
||||||
blank=False,
|
blank=False,
|
||||||
unique=True,
|
unique=True,
|
||||||
verbose_name=_("Documento de identidad"),
|
verbose_name=_("documento de identidad"),
|
||||||
)
|
)
|
||||||
name = models.CharField(max_length=64, blank=False, verbose_name=_("Nombre"))
|
name = models.CharField(max_length=64, blank=False, verbose_name=_("nombre"))
|
||||||
|
|
||||||
email = models.EmailField(blank=False, verbose_name=_("E-mail de contacto"))
|
email = models.EmailField(blank=False, verbose_name=_("e-mail de contacto"))
|
||||||
phone = models.CharField(
|
phone = models.CharField(
|
||||||
max_length=16,
|
max_length=16,
|
||||||
blank=True,
|
blank=True,
|
||||||
@@ -208,11 +210,11 @@ class Provider(TimestampedModel):
|
|||||||
verbose_name=_("Teléfono de contacto"),
|
verbose_name=_("Teléfono de contacto"),
|
||||||
)
|
)
|
||||||
|
|
||||||
address = models.CharField(max_length=255, blank=False, verbose_name=_("Dirección"))
|
address = models.CharField(max_length=255, blank=False, verbose_name=_("dirección"))
|
||||||
city = models.CharField(max_length=64, blank=False, verbose_name=_("Ciudad"))
|
city = models.CharField(max_length=64, blank=False, verbose_name=_("ciudad"))
|
||||||
state = models.CharField(max_length=64, blank=False, verbose_name=_("Región"))
|
state = models.CharField(max_length=64, blank=False, verbose_name=_("región"))
|
||||||
country = models.CharField(max_length=64, blank=False, verbose_name=_("País"))
|
country = models.CharField(max_length=64, blank=False, verbose_name=_("país"))
|
||||||
zip = models.CharField(max_length=32, blank=False, verbose_name=_("Código postal"))
|
zip = models.CharField(max_length=32, blank=False, verbose_name=_("código postal"))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.vat_id} - {self.name}"
|
return f"{self.vat_id} - {self.name}"
|
||||||
@@ -224,7 +226,7 @@ class Provider(TimestampedModel):
|
|||||||
|
|
||||||
class Brand(TimestampedModel):
|
class Brand(TimestampedModel):
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
max_length=100, unique=True, blank=False, null=False, verbose_name=_("Nombre")
|
max_length=100, unique=True, blank=False, null=False, verbose_name=_("nombre")
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@@ -237,14 +239,14 @@ class OrderLine(TimestampedModel):
|
|||||||
"shop.Order",
|
"shop.Order",
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
related_name="lines",
|
related_name="lines",
|
||||||
verbose_name=_("Pedido"),
|
verbose_name=_("pedido"),
|
||||||
)
|
)
|
||||||
product = models.ForeignKey(
|
product = models.ForeignKey(
|
||||||
"shop.Product",
|
"shop.Product",
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
null=False,
|
null=False,
|
||||||
blank=False,
|
blank=False,
|
||||||
verbose_name=_("Producto"),
|
verbose_name=_("producto"),
|
||||||
)
|
)
|
||||||
quantity = models.DecimalField(
|
quantity = models.DecimalField(
|
||||||
max_digits=13,
|
max_digits=13,
|
||||||
@@ -252,12 +254,12 @@ class OrderLine(TimestampedModel):
|
|||||||
default=Decimal("1"),
|
default=Decimal("1"),
|
||||||
null=False,
|
null=False,
|
||||||
blank=False,
|
blank=False,
|
||||||
verbose_name=_("Cantidad"),
|
verbose_name=_("cantidad"),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Precio del producto en el momento en el que se crea el pedido
|
# Precio del producto en el momento en el que se crea el pedido
|
||||||
price = models.DecimalField(
|
price = models.DecimalField(
|
||||||
max_digits=13, decimal_places=4, verbose_name=_("Precio")
|
max_digits=13, decimal_places=4, verbose_name=_("precio")
|
||||||
)
|
)
|
||||||
|
|
||||||
# base_total = quantity * price
|
# base_total = quantity * price
|
||||||
@@ -267,22 +269,22 @@ class OrderLine(TimestampedModel):
|
|||||||
default=Decimal("0"),
|
default=Decimal("0"),
|
||||||
null=False,
|
null=False,
|
||||||
blank=False,
|
blank=False,
|
||||||
verbose_name=_("Total sin impuestos"),
|
verbose_name=_("total sin impuestos"),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Valor entero del impuesto en el momento en el que se crea el pedido
|
# Valor entero del impuesto en el momento en el que se crea el pedido
|
||||||
tax_value = models.PositiveIntegerField(
|
tax_value = models.PositiveIntegerField(
|
||||||
null=False, blank=False, verbose_name=_("Valor de impuestos")
|
null=False, blank=False, verbose_name=_("valor de impuestos")
|
||||||
)
|
)
|
||||||
|
|
||||||
# taxes = price * quantity * (tax_value / 100)
|
# taxes = price * quantity * (tax_value / 100)
|
||||||
taxes = models.DecimalField(
|
taxes = models.DecimalField(
|
||||||
max_digits=13, decimal_places=4, verbose_name=_("Impuestos")
|
max_digits=13, decimal_places=4, verbose_name=_("impuestos")
|
||||||
)
|
)
|
||||||
|
|
||||||
# total = base_total + taxes
|
# total = base_total + taxes
|
||||||
total = models.DecimalField(
|
total = models.DecimalField(
|
||||||
max_digits=13, decimal_places=4, verbose_name=_("Total")
|
max_digits=13, decimal_places=4, verbose_name=_("total")
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
@@ -295,72 +297,72 @@ class OrderLine(TimestampedModel):
|
|||||||
|
|
||||||
class Order(TimestampedModel):
|
class Order(TimestampedModel):
|
||||||
class Statuses(models.TextChoices):
|
class Statuses(models.TextChoices):
|
||||||
STATUS_PENDING = "PEN", _("Pendiente de pago")
|
STATUS_PENDING = "PEN", _("pendiente de pago")
|
||||||
STATUS_PAID = "PAI", _("Pagado")
|
STATUS_PAID = "PAI", _("pagado")
|
||||||
STATUS_READY = "RDY", _("Preparado")
|
STATUS_READY = "RDY", _("preparado")
|
||||||
STATUS_TO_BE_SENT = "TBS", _("Listo para ser enviado")
|
STATUS_TO_BE_SENT = "TBS", _("listo para ser enviado")
|
||||||
STATUS_SENT = "SNT", _("Enviado")
|
STATUS_SENT = "SNT", _("enviado")
|
||||||
STATUS_DELIVERED = "DLV", _("Entregado")
|
STATUS_DELIVERED = "DLV", _("entregado")
|
||||||
STATUS_FINISHED = "FIN", _("Finalizado")
|
STATUS_FINISHED = "FIN", _("finalizado")
|
||||||
STATUS_CANCELED = "CAN", _("Cancelado")
|
STATUS_CANCELED = "CAN", _("cancelado")
|
||||||
STATUS_RETURNED = "RTN", _("Devuelto")
|
STATUS_RETURNED = "RTN", _("devuelto")
|
||||||
|
|
||||||
uuid = models.UUIDField(default=uuid4, verbose_name=_("UUID"), db_index=True)
|
uuid = models.UUIDField(default=uuid4, verbose_name=_("UUID"), db_index=True)
|
||||||
|
|
||||||
status = models.CharField(
|
status = models.CharField(
|
||||||
max_length=3, default=Statuses.STATUS_PENDING, verbose_name=_("Estado")
|
max_length=3, default=Statuses.STATUS_PENDING, verbose_name=_("estado")
|
||||||
)
|
)
|
||||||
|
|
||||||
base_total = models.DecimalField(
|
base_total = models.DecimalField(
|
||||||
default=Decimal("0"),
|
default=Decimal("0"),
|
||||||
max_digits=13,
|
max_digits=13,
|
||||||
decimal_places=2,
|
decimal_places=2,
|
||||||
verbose_name=_("Base imponible"),
|
verbose_name=_("base imponible"),
|
||||||
)
|
)
|
||||||
total = models.DecimalField(
|
total = models.DecimalField(
|
||||||
default=Decimal("0"), max_digits=13, decimal_places=2, verbose_name=_("Total")
|
default=Decimal("0"), max_digits=13, decimal_places=2, verbose_name=_("total")
|
||||||
)
|
)
|
||||||
|
|
||||||
# Customer reference
|
# Customer reference
|
||||||
customer = models.ForeignKey(
|
customer = models.ForeignKey(
|
||||||
"shop.Customer", on_delete=models.PROTECT, verbose_name=_("Cliente")
|
"shop.Customer", on_delete=models.PROTECT, verbose_name=_("cliente")
|
||||||
)
|
)
|
||||||
|
|
||||||
# Billing information
|
# Billing information
|
||||||
billing_address = models.CharField(
|
billing_address = models.CharField(
|
||||||
max_length=255, blank=False, verbose_name=_("Dirección de facturación")
|
max_length=255, blank=False, verbose_name=_("dirección de facturación")
|
||||||
)
|
)
|
||||||
billing_city = models.CharField(
|
billing_city = models.CharField(
|
||||||
max_length=64, blank=False, verbose_name=_("Ciudad de facturación")
|
max_length=64, blank=False, verbose_name=_("ciudad de facturación")
|
||||||
)
|
)
|
||||||
billing_state = models.CharField(
|
billing_state = models.CharField(
|
||||||
max_length=64, blank=False, verbose_name=_("Región de facturación")
|
max_length=64, blank=False, verbose_name=_("región de facturación")
|
||||||
)
|
)
|
||||||
billing_country = models.CharField(
|
billing_country = models.CharField(
|
||||||
max_length=64, blank=False, verbose_name=_("País de facturación")
|
max_length=64, blank=False, verbose_name=_("país de facturación")
|
||||||
)
|
)
|
||||||
billing_zip = models.CharField(
|
billing_zip = models.CharField(
|
||||||
max_length=32, blank=False, verbose_name=_("Código postal de facturación")
|
max_length=32, blank=False, verbose_name=_("código postal de facturación")
|
||||||
)
|
)
|
||||||
|
|
||||||
# Shipping information
|
# Shipping information
|
||||||
shipping_address = models.CharField(
|
shipping_address = models.CharField(
|
||||||
max_length=255, blank=False, verbose_name=_("Dirección")
|
max_length=255, blank=False, verbose_name=_("dirección")
|
||||||
)
|
)
|
||||||
shipping_city = models.CharField(
|
shipping_city = models.CharField(
|
||||||
max_length=64, blank=False, verbose_name=_("Ciudad")
|
max_length=64, blank=False, verbose_name=_("ciudad")
|
||||||
)
|
)
|
||||||
shipping_state = models.CharField(
|
shipping_state = models.CharField(
|
||||||
max_length=64, blank=False, verbose_name=_("Región")
|
max_length=64, blank=False, verbose_name=_("región")
|
||||||
)
|
)
|
||||||
shipping_country = models.CharField(
|
shipping_country = models.CharField(
|
||||||
max_length=64, blank=False, verbose_name=_("País")
|
max_length=64, blank=False, verbose_name=_("país")
|
||||||
)
|
)
|
||||||
shipping_zip = models.CharField(
|
shipping_zip = models.CharField(
|
||||||
max_length=32, blank=False, verbose_name=_("Código postal")
|
max_length=32, blank=False, verbose_name=_("código postal")
|
||||||
)
|
)
|
||||||
contact_phone = models.CharField(
|
contact_phone = models.CharField(
|
||||||
max_length=32, blank=True, verbose_name=_("Teléfono de contacto")
|
max_length=32, blank=True, verbose_name=_("teléfono de contacto")
|
||||||
)
|
)
|
||||||
|
|
||||||
def calculate_total_from_lines(self):
|
def calculate_total_from_lines(self):
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class TestProductsAPI(APITestCase, TestUserAuthenticationMixin):
|
|||||||
self.tag = Tag.objects.create(name="Alimentos")
|
self.tag = Tag.objects.create(name="Alimentos")
|
||||||
|
|
||||||
def get_random_sku(self):
|
def get_random_sku(self):
|
||||||
return ''.join(random.choices(string.ascii_uppercase, k=16))
|
return "".join(random.choices(string.ascii_uppercase, k=16))
|
||||||
|
|
||||||
def create_products(self):
|
def create_products(self):
|
||||||
self.product = Product.objects.create(
|
self.product = Product.objects.create(
|
||||||
|
|||||||
@@ -14,17 +14,17 @@ class ShopModelsTest(TestCase):
|
|||||||
|
|
||||||
def create_products(self):
|
def create_products(self):
|
||||||
self.potatoes = Product.objects.create(
|
self.potatoes = Product.objects.create(
|
||||||
sku='0000001',
|
sku="0000001",
|
||||||
name="Patatas",
|
name="Patatas",
|
||||||
stock=Decimal("100.00"),
|
stock=Decimal("100.00"),
|
||||||
)
|
)
|
||||||
self.gasoline = Product.objects.create(
|
self.gasoline = Product.objects.create(
|
||||||
sku='0000002',
|
sku="0000002",
|
||||||
name="Gasolina",
|
name="Gasolina",
|
||||||
stock=Decimal("800.00"),
|
stock=Decimal("800.00"),
|
||||||
)
|
)
|
||||||
self.usb_c = Product.objects.create(
|
self.usb_c = Product.objects.create(
|
||||||
sku='0000003',
|
sku="0000003",
|
||||||
name="Cable USB-C",
|
name="Cable USB-C",
|
||||||
stock=Decimal("5.00"),
|
stock=Decimal("5.00"),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user