From 6c903ddf536b35a29e5800903bd0488a0ccaa5fc Mon Sep 17 00:00:00 2001 From: "Walid HANNICHE (waha)" Date: Wed, 12 Oct 2022 17:54:20 +0000 Subject: [PATCH] [FIX] point_of_sale: group split taxes on product info Steps to reproduce; Create a tax with two accounts that take 50% each. Bug: In the info tab on the pos of a product with the tax the tax will show as two lines. Fix: group taxes with the same id opw-3006360 closes odoo/odoo#103365 X-original-commit: 860103130fd5de880d9b179f5e1218107f4be0de Signed-off-by: Trinh Jacky (trj) --- addons/point_of_sale/models/product.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/addons/point_of_sale/models/product.py b/addons/point_of_sale/models/product.py index f7471edde22..2ab5f867424 100644 --- a/addons/point_of_sale/models/product.py +++ b/addons/point_of_sale/models/product.py @@ -45,13 +45,20 @@ class ProductProduct(models.Model): # Tax related taxes = self.taxes_id.compute_all(price, config.currency_id, quantity, self) + grouped_taxes = {} + for tax in taxes['taxes']: + if tax['id'] in grouped_taxes: + grouped_taxes[tax['id']]['amount'] += tax['amount']/quantity if quantity else 0 + else: + grouped_taxes[tax['id']] = { + 'name': tax['name'], + 'amount': tax['amount']/quantity if quantity else 0 + } + all_prices = { 'price_without_tax': taxes['total_excluded']/quantity if quantity else 0, 'price_with_tax': taxes['total_included']/quantity if quantity else 0, - 'tax_details': [{ - 'name': tax['name'], - 'amount': tax['amount']/quantity if quantity else 0 - } for tax in taxes['taxes']], + 'tax_details': list(grouped_taxes.values()), } # Pricelists