Browse Source

Fix has_owner

Fabs 10 years ago
parent
commit
4dfe4975ec
1 changed files with 5 additions and 5 deletions
  1. 5 5
      coin/billing/models.py

+ 5 - 5
coin/billing/models.py

@@ -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)