Commit 8cb45852 authored by Matthieu Fesselier's avatar Matthieu Fesselier

bugfix: improve htAmount calculation

parent b2b66832
Pipeline #2914 passed with stage
in 27 seconds
......@@ -61,11 +61,11 @@ class CustomerInvoice(Model):
additionalText = models.CharField(max_length=255, blank=True, null=True)
def htAmount(self):
htAmount = Decimal(0)
if self.batches is None:
htAmount = self.batches.aggregate(total=Sum('tasks__htAmount'))['total']
amount = Task.objects.filter(batch__invoice = self).aggregate(total=Sum('htAmount'))['total']
if amount is None:
amount = Decimal(0.0)
return amount
return htAmount
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