1234567891011121314151617181920212223242526272829303132333435363738 |
- # -*- coding: utf-8 -*-
- from django.db import models
- class Invoice(models.Model):
- INVOICES_STATUS_CHOICES = (
- ('open', 'A payer'),
- ('closed', 'Reglée'),
- ('trouble', 'Litige')
- )
- status = models.CharField(max_length=50, choices=INVOICES_STATUS_CHOICES,
- default='open')
- amount = models.DecimalField(max_digits=5, decimal_places=2)
- date = models.DateField(auto_now_add=True, null=True)
- period_from = models.DateField(auto_now_add=False, null=True)
- period_to = models.DateField(auto_now_add=False, null=True)
- date_due = models.DateField(auto_now_add=False, null=True)
- class InvoiceDetail(models.Model):
- label = models.CharField(max_length=100)
- amount = models.DecimalField(max_digits=5, decimal_places=2)
- quantity = models.IntegerField(null=True)
- tax = models.IntegerField(null=True)
- invoice = models.ForeignKey(Invoice)
- def __unicode__(self):
- return self.label
- class Payment(models.Model):
- payment_means = models.CharField(max_length=100, null=True)
- amount = models.DecimalField(max_digits=7, decimal_places=2, null=True)
- date = models.DateField(auto_now_add=True)
- invoce = models.ForeignKey(Invoice)
|