|
@@ -20,6 +20,7 @@ def next_invoice_number():
|
|
|
class Invoice(models.Model):
|
|
|
|
|
|
INVOICES_STATUS_CHOICES = (
|
|
|
+ ('draft', u'Brouillon'),
|
|
|
('open', u'A payer'),
|
|
|
('closed', u'Reglée'),
|
|
|
('trouble', u'Litige')
|
|
@@ -30,7 +31,7 @@ class Invoice(models.Model):
|
|
|
unique=True,
|
|
|
verbose_name='Numéro')
|
|
|
status = models.CharField(max_length=50, choices=INVOICES_STATUS_CHOICES,
|
|
|
- default='open',
|
|
|
+ default='draft',
|
|
|
verbose_name='Statut')
|
|
|
date = models.DateField(default=datetime.date.today, null=True)
|
|
|
date_due = models.DateField(
|
|
@@ -70,10 +71,9 @@ class Invoice(models.Model):
|
|
|
return self.amount() - self.amount_paid()
|
|
|
amount_remaining_to_pay.short_description = 'Reste à payer'
|
|
|
|
|
|
- def has_owner(self, uid):
|
|
|
- "Check if passed uid (ex gmajax) is owner of the invoice"
|
|
|
- return (self.member and self.member.username and
|
|
|
- self.member.username == uid)
|
|
|
+ def has_owner(self, username):
|
|
|
+ "Check if passed username (ex gmajax) is owner of the invoice"
|
|
|
+ return (self.username == username)
|
|
|
|
|
|
def __unicode__(self):
|
|
|
return u'#%s %0.2f€ %s' % (self.number, self.amount(), self.date_due)
|