[FIX] point_of_sale: fix expected singleton in pos sales details

If applied, this commit will solve the expected singleton error when the product
has multiple taxes, and the user tries to print sales details in point of sale.

To reproduce this error, follow the steps:
- Open point of sale.
- Products > Open any product > Add multiple customer taxes
- Open Session > make the order for that product with discount > Validate
  > Close Session
- Reporting > Sales details > Print

sentry - 4148645094

closes odoo/odoo#122182

X-original-commit: 2d58de7adcae9b035607ff6a2ca59fc46ce32506
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Renilkumar Kajavadra (reka) <reka@odoo.com>
This commit is contained in:
Renilkumar Kajavadra
2023-05-29 11:32:02 +02:00
parent df77914d27
commit 8d8478b49a
+2 -3
View File
@@ -2030,9 +2030,8 @@ class PosSession(models.Model):
def get_total_discount(self):
amount = 0
for line in self.env['pos.order.line'].search([('order_id', 'in', self.order_ids.ids), ('discount', '>', 0)]):
normal_price = line.qty * line.price_unit
normal_price = normal_price + (normal_price / 100 * line.tax_ids.amount)
amount += normal_price - line.price_subtotal_incl
original_price = line.price_subtotal_incl / (1 - line.discount / 100)
amount += original_price * line.discount / 100
return amount