mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 20:09:25 +00:00
remove parent_product
column in the Product table
This commit is contained in:
@ -143,7 +143,6 @@ class ProductEditForm(forms.ModelForm):
|
||||
"description",
|
||||
"product_type",
|
||||
"code",
|
||||
"parent_product",
|
||||
"buying_groups",
|
||||
"purchase_price",
|
||||
"selling_price",
|
||||
@ -155,7 +154,6 @@ class ProductEditForm(forms.ModelForm):
|
||||
"archived",
|
||||
]
|
||||
widgets = {
|
||||
"parent_product": AutoCompleteSelectMultipleProduct,
|
||||
"product_type": AutoCompleteSelect,
|
||||
"buying_groups": AutoCompleteSelectMultipleGroup,
|
||||
"club": AutoCompleteSelectClub,
|
||||
|
@ -0,0 +1,38 @@
|
||||
# Generated by Django 4.2.17 on 2024-12-09 11:07
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
import accounting.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [("counter", "0024_accountdump_accountdump_unique_ongoing_dump")]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(model_name="product", name="parent_product"),
|
||||
migrations.AlterField(
|
||||
model_name="product",
|
||||
name="description",
|
||||
field=models.TextField(default="", verbose_name="description"),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="product",
|
||||
name="purchase_price",
|
||||
field=accounting.models.CurrencyField(
|
||||
decimal_places=2,
|
||||
help_text="Initial cost of purchasing the product",
|
||||
max_digits=12,
|
||||
verbose_name="purchase price",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="product",
|
||||
name="special_selling_price",
|
||||
field=accounting.models.CurrencyField(
|
||||
decimal_places=2,
|
||||
help_text="Price for barmen during their permanence",
|
||||
max_digits=12,
|
||||
verbose_name="special selling price",
|
||||
),
|
||||
),
|
||||
]
|
@ -326,7 +326,7 @@ class Product(models.Model):
|
||||
"""A product, with all its related information."""
|
||||
|
||||
name = models.CharField(_("name"), max_length=64)
|
||||
description = models.TextField(_("description"), blank=True)
|
||||
description = models.TextField(_("description"), default="")
|
||||
product_type = models.ForeignKey(
|
||||
ProductType,
|
||||
related_name="products",
|
||||
@ -336,9 +336,15 @@ class Product(models.Model):
|
||||
on_delete=models.SET_NULL,
|
||||
)
|
||||
code = models.CharField(_("code"), max_length=16, blank=True)
|
||||
purchase_price = CurrencyField(_("purchase price"))
|
||||
purchase_price = CurrencyField(
|
||||
_("purchase price"),
|
||||
help_text=_("Initial cost of purchasing the product"),
|
||||
)
|
||||
selling_price = CurrencyField(_("selling price"))
|
||||
special_selling_price = CurrencyField(_("special selling price"))
|
||||
special_selling_price = CurrencyField(
|
||||
_("special selling price"),
|
||||
help_text=_("Price for barmen during their permanence"),
|
||||
)
|
||||
icon = ResizedImageField(
|
||||
height=70,
|
||||
force_format="WEBP",
|
||||
@ -352,14 +358,6 @@ class Product(models.Model):
|
||||
)
|
||||
limit_age = models.IntegerField(_("limit age"), default=0)
|
||||
tray = models.BooleanField(_("tray price"), default=False)
|
||||
parent_product = models.ForeignKey(
|
||||
"self",
|
||||
related_name="children_products",
|
||||
verbose_name=_("parent product"),
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
)
|
||||
buying_groups = models.ManyToManyField(
|
||||
Group, related_name="products", verbose_name=_("buying groups"), blank=True
|
||||
)
|
||||
@ -369,7 +367,7 @@ class Product(models.Model):
|
||||
verbose_name = _("product")
|
||||
|
||||
def __str__(self):
|
||||
return "%s (%s)" % (self.name, self.code)
|
||||
return f"{self.name} ({self.code})"
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("counter:product_list")
|
||||
|
Reference in New Issue
Block a user