Demesmaeker 64937078cd [FIX] sale_loyalty: wrong discount amount computation with negative amount product
Currently, when using a promotion with a reward available only on specific products and having a
maximum amount allowed, when adding another product with a negative amount, the discount could go
above the maximum discount allowed.

This was caused by the calculated discount amount that was overridden by the total amount of the
order. This new amount was then used to calculate the discounted factor. So, instead of having:
discount_amount = product_price * min(1, (max_discount / discountable))
When the total_amount of the order was under this discountable, we had:
discount_amount = product_price * min(1, (max_discount / total_amount))

Instead, we should calculate the discount amount normally but limit it to the amount_total.

opw-3217369

closes odoo/odoo#123361

X-original-commit: 977f726b67f48d4b858b1a5fe1d558a64186d332
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
2023-06-02 17:00:18 +02:00
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%