From 43cb6001d7c6b3ee1545f7cb369c75796179de86 Mon Sep 17 00:00:00 2001 From: "Pedram (pebr)" Date: Tue, 6 Feb 2024 10:17:54 +0000 Subject: [PATCH] [FIX] point_of_sale: prevent double calculation of base amount Before this commit, if a tax had multiple distribution lines, the base amount was calculated for each line. This resulted in the base amount being multiplied by the number of distribution lines. This issue has been resolved by ensuring the base amount is counted only once for each tax and line. opw-3696800 closes odoo/odoo#155690 X-original-commit: f8842269cee1df62ff4378473dc59da6fca7eec5 Signed-off-by: Joseph Caburnay (jcb) Signed-off-by: Pedram Bi Ria (pebr) --- addons/point_of_sale/models/report_sale_details.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/report_sale_details.py b/addons/point_of_sale/models/report_sale_details.py index 9024c16205e..c6b93242a38 100644 --- a/addons/point_of_sale/models/report_sale_details.py +++ b/addons/point_of_sale/models/report_sale_details.py @@ -292,10 +292,14 @@ class ReportSaleDetails(models.AbstractModel): if line.tax_ids_after_fiscal_position: line_taxes = line.tax_ids_after_fiscal_position.sudo().compute_all(line.price_unit * (1-(line.discount or 0.0)/100.0), currency, line.qty, product=line.product_id, partner=line.order_id.partner_id or False) + base_amounts = {} for tax in line_taxes['taxes']: taxes.setdefault(tax['id'], {'name': tax['name'], 'tax_amount':0.0, 'base_amount':0.0}) taxes[tax['id']]['tax_amount'] += tax['amount'] - taxes[tax['id']]['base_amount'] += tax['base'] + base_amounts[tax['id']] = tax['base'] + + for tax_id, base_amount in base_amounts.items(): + taxes[tax_id]['base_amount'] += base_amount else: taxes.setdefault(0, {'name': _('No Taxes'), 'tax_amount':0.0, 'base_amount':0.0}) taxes[0]['base_amount'] += line.price_subtotal_incl