models.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. from django.db import models
  2. # Create your models here.
  3. class Invoces_Detail(models.Model):
  4. label= models.CharField(max_length=100)
  5. amount = models.DecimalField( max_digits=5, decimal_places=2)
  6. quantity = models.IntegerField(null=True)
  7. tax = models.IntegerField( null=True)
  8. def __unicode__(self):
  9. return self.label
  10. class Invoces(models.Model):
  11. INVOICES_STATUS_CHOICES = (
  12. ('open', 'A payer'),
  13. ('Closed', 'regler'),
  14. ('trouble', "litige"),
  15. )
  16. status= models.CharField(max_length=50, choices=INVOICES_STATUS_CHOICES,default='open')
  17. detail = models.ForeignKey(Invoces_Detail)
  18. amount = models.DecimalField( max_digits=5, decimal_places=2)
  19. date = models.DateField (auto_now_add=True, null=True)
  20. period_from=models.DateField (auto_now_add=False, null=True)
  21. period_to=models.DateField (auto_now_add=False, null=True)
  22. date_due=models.DateField (auto_now_add=False, null=True)
  23. class Payments(models.Model):
  24. payment_means =models.CharField(max_length=100, null=True)
  25. amount= models.DecimalField( max_digits=7, decimal_places=2, null=True)
  26. date=models.DateField(auto_now_add=True)
  27. invoce =models.ForeignKey(Invoces)