|
@@ -18,14 +18,14 @@ from coin.utils import private_files_storage, start_of_month, end_of_month
|
|
|
|
|
|
|
|
|
def next_invoice_number():
|
|
|
- "Détermine un numéro de facture aléatoire"
|
|
|
+ """Détermine un numéro de facture aléatoire"""
|
|
|
return '%s%02i-%i-%i' % (datetime.date.today().year,
|
|
|
datetime.date.today().month,
|
|
|
random.randrange(100, 999),
|
|
|
random.randrange(100, 999))
|
|
|
|
|
|
def invoice_pdf_filename(instance, filename):
|
|
|
- "Nom du fichier pdf à stocker pour les factures"
|
|
|
+ """Nom du fichier pdf à stocker pour les factures"""
|
|
|
return 'invoices/%d_%s_%s.pdf' % (getattr(instance,'member.id',0), instance.number, uuid.uuid4())
|
|
|
|
|
|
class Invoice(models.Model):
|
|
@@ -58,7 +58,7 @@ class Invoice(models.Model):
|
|
|
verbose_name='PDF')
|
|
|
|
|
|
def amount(self):
|
|
|
- "Calcul le montant de la facture en fonction des éléments de détails"
|
|
|
+ """Calcul le montant de la facture en fonction des éléments de détails"""
|
|
|
total = Decimal('0.0')
|
|
|
for detail in self.details.all():
|
|
|
total += detail.total()
|
|
@@ -144,7 +144,7 @@ class InvoiceDetail(models.Model):
|
|
|
return self.label
|
|
|
|
|
|
def total(self):
|
|
|
- "Calcul le total"
|
|
|
+ """Calcul le total"""
|
|
|
return (self.amount * (self.tax / Decimal('100.0') +
|
|
|
Decimal('1.0')) * self.quantity).quantize(Decimal('0.01'))
|
|
|
|