[FW][FIX] pos_loyalty: fix buy X get Y
When activating a loyalty program with a buy X get Y promotion. For example for buy 10 get 3, if you have 10 products in your cart and add 1 more product, it will add a reward for 1 free product. But if you add another product, the reward will stay the same, it will not give 2 free product.
Steps to reproduce:
- Create a buy X get Y loyalty program (10 get 3 free) where X and Y are the same product.
- Add 10 products to the cart.
- Add 1 more product to the cart, it will add a reward for 1 free product.
- Add another product to the cart
Observation: The reward will not change, it will still be 1 free product.
Why the fix:
If possible we will try to maximize the reward quantity. That's why we don't do it in cases where multiple rewards are possible.
opw-4762083
Forward-Port-Of: odoo/odoo#214643 Forward-Port-Of: odoo/odoo#211087
@robinengels @davidmonnom this PR targets master and is the last of the forward-port chain containing:
- odoo/odoo#215276
- odoo/odoo#215253
To merge the full chain, use
@robodoo r+
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
@robodoo r+
@robinengels @davidmonnom 'ci/runbot' failed on this reviewed PR.
