Feat: importando productos desde csv.

This commit is contained in:
2024-06-29 14:29:22 -05:00
parent 2039a19b16
commit ef0c0c52db
10 changed files with 160 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
from django.db import models
from django.utils.translation import gettext_lazy as _
class Sale(models.Model):
@@ -16,3 +16,25 @@ class SaleLine(models.Model):
quantity = models.IntegerField(null=True)
unit_price = models.DecimalField(max_digits=9, decimal_places=2)
description = models.CharField(max_length=255, null=True, blank=True)
class MeasuringUnits(models.TextChoices):
UNIT = 'UNIT', _('Unit')
class ProductCategory(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
class Product(models.Model):
name = models.CharField(max_length=100)
price = models.DecimalField(max_digits=9, decimal_places=2)
measuring_unit = models.CharField(
max_length=20,
choices=MeasuringUnits.choices,
default=MeasuringUnits.UNIT
)
categories = models.ManyToManyField(ProductCategory)
def __str__(self):
return self.name