fix: Se añade total_tip

This commit is contained in:
sinergia 2024-03-05 14:42:20 -05:00
parent 1ad532c033
commit 4738104006

View File

@ -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] = (