Skip to content
Snippets Groups Projects
Commit 9261bf74 authored by anhe-odoo's avatar anhe-odoo
Browse files

[FIX] sale_coupon: fix the unexpired_promotions filter


Expected behaviour

When having multiple promotions with, for example, a promotion of X% for the
first order and a promotion of Y% (Y<X), we should apply the first promotion
on the first order and then don't get this promotion into account to choose
the best promotion for a future order, so that we have:
1. A promotion of X% on the first order
2. A promotion of Y% on every other order

Observed behaviour

When trying to apply promotion on other order, nothing seems to happen, as
Odoo take the already-used X% promotion into account, being the most
interesting promotion, select it as the best promotion to apply and then
apply it to finally get a result of a 0% discount as the promotion has
already been used.

Problem Root Cause

As it can be seen in the commit, the error comes from the fact we filtered
the available promotion with a non-strict inequality.

Validation

A test has been added in test_program_numbers.py to validate our fix

Related issue

- opw-2674681

closes odoo/odoo#81308

X-original-commit: d2c58a9d
Signed-off-by: default avatarRomain Derie (rde) <rde@odoo.com>
Signed-off-by: default avatarHendrickx Anthony (anhe) <anhe@odoo.com>
parent f5622acf
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment