58 lines
2.3 KiB
Python
58 lines
2.3 KiB
Python
from django.db import models
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
PAYMENTS_CHOICES = (
|
|
("Espèces", _("Espèces")),
|
|
("CB", _("CB")),
|
|
("Chèque", _("Chèque")),
|
|
)
|
|
|
|
class JournalEntry(models.Model):
|
|
entry_text = models.CharField("Détail entrée", max_length=500)
|
|
entry_date = models.DateTimeField('Date')
|
|
cofeux_id = models.CharField("Trigramme", max_length=8)
|
|
entry_amount = models.FloatField("Montant")
|
|
payment_type = models.CharField(
|
|
_("Moyen de paiement"), choices=PAYMENTS_CHOICES, max_length=20
|
|
)
|
|
def __str__(self):
|
|
return self.entry_text
|
|
|
|
class Meta:
|
|
verbose_name = 'Entrée du JDC'
|
|
verbose_name_plural = 'Entrées du JDC'
|
|
|
|
|
|
|
|
|
|
class Option(models.Model):
|
|
name = models.CharField("Nom", max_length=100)
|
|
def __str__(self):
|
|
return self.name
|
|
|
|
class Produit(models.Model):
|
|
Produit = models.CharField("Nom", max_length=100)
|
|
option_1 = models.ForeignKey(Option, on_delete=models.CASCADE, related_name="option_1")
|
|
option_1_value = models.CharField("Option 1 Valeur", max_length=100, blank=True)
|
|
option_2 = models.ForeignKey(Option, on_delete=models.CASCADE, related_name="option_2")
|
|
option_2_value = models.CharField("Option 2 Valeur", max_length=100, blank=True)
|
|
option_3 = models.ForeignKey(Option, on_delete=models.CASCADE, related_name="option_3")
|
|
option_3_value = models.CharField("Option 3 Valeur", max_length=100, blank=True)
|
|
option_4 = models.ForeignKey(Option, on_delete=models.CASCADE, related_name="option_4")
|
|
option_4_value = models.CharField("Option 4 Valeur", max_length=100, blank=True)
|
|
option_5 = models.ForeignKey(Option, on_delete=models.CASCADE, related_name="option_5")
|
|
option_5_value = models.CharField("Option 5 Valeur", max_length=100, blank=True)
|
|
price = models.FloatField("Prix")
|
|
|
|
def __str__(self):
|
|
name = str(self.Produit) + " " + self.option_1_value + " " + self.option_2_value + " " + self.option_3_value + " " + self.option_4_value + " " + self.option_5_value
|
|
return name
|
|
|
|
|
|
class ProduitStock(models.Model):
|
|
ProduitTaille = models.ForeignKey(Produit, on_delete=models.CASCADE)
|
|
Amount = models.IntegerField("Nombre en Stock")
|
|
def __str__(self):
|
|
return str(self.ProduitTaille) + " : " + str(self.Amount)
|
|
|
|
|