[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) <trj@odoo.com>
This commit is contained in:
Walid HANNICHE (waha)
2022-10-18 13:17:16 +02:00
parent f9e7a34ef7
commit 6c903ddf53
+11 -4
View File
@@ -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