From 4738104006c2b2298315ebcbe26a769219760b30 Mon Sep 17 00:00:00 2001 From: sinergia Date: Tue, 5 Mar 2024 14:42:20 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20Se=20a=C3=B1ade=20total=5Ftip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sale.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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] = (