Commit 78ebbbfd authored by Matthieu Fesselier's avatar Matthieu Fesselier

bugfix: fix htamount when no batches

parent 26ccca87
Pipeline #2486 passed with stage
in 27 seconds
......@@ -57,7 +57,9 @@ class CustomerInvoice(models.Model):
invoicingDate = models.DateField(default = datetime.date.today)
def htAmount(self):
return self.batches.aggregate(total=Sum('tasks__htAmount'))['total']
if self.batches is None:
return self.batches.aggregate(total=Sum('tasks__htAmount'))['total']
return 0
def tvaAmount(self):
return Decimal(self.tvaRate * self.htAmount() / Decimal(100))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment