odoo/odoo#156170

Created by fw-bot
Merged at 6c92c2981d53c36bdfa7722f9932c9ffc05236e6

Statuses:

label
odoo-dev:saas-17.1-saas-16.3-pos-opw-3721376-pebr-ayf2-fw
head
a422219da65f0304a4aa8bc10e69bd30dee8b3c6
merged
2 years ago by Pedram Bi Ria (pebr)
odoo/odoo
saas-16.3 #155899
saas-16.4 #156044
17.0 #156160
saas-17.1 #156170
18.0
saas-18.2
saas-18.3
saas-18.4
19.0
saas-19.1
master #156182

[FW][FIX] point_of_sale: correct computation of product total with discount

Before this commit, if a product had a discount applied in two different orders, it could lead to incorrect calculations in the report For instance, if a product priced at 14.45 had a 30% discount applied, the discounted value would be 10.115, which rounds to 10.12. However, if there were two orders with the same discount, the report calculation would count the quantity of a product with the same discount and calculate the product total amount in one place. This would result in a discounted value of 10.115 * 2 = 20.23, while in the two different orders we had two 10.12 which sums to 20.24.

With this commit, the calculation method has been changed. Now, the product amount total for each line is calculated first, and then the sum of these amounts is used to calculate the total for all of the orders. This change ensures accurate computation of the product total sum when discounts are applied across multiple orders.

opw-3721376


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #156044
Forward-Port-Of: #155899