diff --git a/sale.py b/sale.py index 0bf9ff4..613cdbb 100644 --- a/sale.py +++ b/sale.py @@ -69,6 +69,7 @@ class Sale(metaclass=PoolMeta): sale.tax_amount_cache = sale.tax_amount sale.total_amount_cache = sale.total_amount sale.total_discount_cache = sale.total_discount + sale.total_tip_cache = sale.total_tip cls.save(sales) @classmethod @@ -104,7 +105,9 @@ class Sale(metaclass=PoolMeta): total_discount[sale.id] = round(sum( (line.discount_amount * Decimal(line.quantity) for line in sale.lines if line.discount_amount and line.type == 'line'), Decimal(0)), 2) - total_tip[sale.id] = round(sum((line.amount for line in sale.lines if line.product and line.product.tip and line.type == 'line'), Decimal(0)), 2) + total_tip[sale.id] = round(sum( + (line.amount for line in sale.lines if line.product and line.product.tip and line.type == 'line'), + Decimal(0)), 2) if compute_taxes: tax_amount[sale.id] = sale.get_tax_amount() total_amount[sale.id] = (