2020-02-16 18:37:16 +01:00
|
|
|
from django.db import models
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
|
|
|
|
PAYMENTS_CHOICES = (
|
2020-02-17 11:40:58 +01:00
|
|
|
("Espèces", _("Espèces")),
|
|
|
|
("CB", _("CB")),
|
|
|
|
("Chèque", _("Chèque")),
|
2020-02-16 18:37:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
class JournalEntry(models.Model):
|
2020-02-18 18:25:54 +01:00
|
|
|
entry_text = models.CharField("Détail entrée", max_length=500)
|
2020-02-16 18:37:16 +01:00
|
|
|
entry_date = models.DateTimeField('Date')
|
|
|
|
cofeux_id = models.CharField("Trigramme", max_length=8)
|
2020-02-18 18:25:54 +01:00
|
|
|
entry_amount = models.FloatField("Montant")
|
2020-02-16 18:37:16 +01:00
|
|
|
payment_type = models.CharField(
|
|
|
|
_("Moyen de paiement"), choices=PAYMENTS_CHOICES, max_length=20
|
|
|
|
)
|
|
|
|
def __str__(self):
|
|
|
|
return self.entry_text
|
|
|
|
|
2020-02-18 18:25:54 +01:00
|
|
|
class Meta:
|
|
|
|
verbose_name = 'Entrée du JDC'
|
|
|
|
verbose_name_plural = 'Entrées du JDC'
|
2020-02-16 18:37:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 18:25:54 +01:00
|
|
|
|
|
|
|
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):
|
2020-02-19 18:43:42 +01:00
|
|
|
name = str(self.Produit) + " " + self.option_1_value + " " + self.option_2_value + " " + self.option_3_value + " " + self.option_4_value + " " + self.option_5_value
|
2020-02-18 18:25:54 +01:00
|
|
|
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)
|
|
|
|
|
|
|
|
|