This commit is contained in:
oscar alvarez 2022-03-22 14:40:44 -05:00
parent 2e9e5cda87
commit aff63db506
1 changed files with 4 additions and 3 deletions

View File

@ -455,9 +455,10 @@ class Folio(ModelSQL, ModelView):
instead of flat price. Fee is linked to channel management.
"""
res = []
if name == 'total_amount' or not self.invoice_line:
if self.nights_quantity and self.unit_price_w_tax:
res = [self.nights_quantity * self.unit_price_w_tax]
if self.nights_quantity and self.unit_price_w_tax:
amount_nights = [self.nights_quantity * self.unit_price_w_tax]
if name == 'total_amount' or (name == 'total_balance' and not self.invoice_line):
res.append(amount_nights)
for charge in self.charges:
res.append(charge.amount)
res = round(sum(res), Folio.total_amount.digits[1])