[FIX] sale_loyalty: use global rounding for discount calculation
Steps To Reproduce Ensure the currency rounding is set on 2 decimals Ensure the company tax is round per line and Promotions, Loyalty & Gift Card option is activated in the Settings app
- Go to Discount & Loyalty:
- Create a new "Promotions" program with no conditional rules and a 100% discount on order reward.
- Go to Sales app:
- Create a SO for any customer;
- Add a product to create and edit on the fly:
- Change the Sales Price for $9.99;
- Change the Sales Taxes for a 19.99% one (created on the fly if required).
- Add the same product on a second order line;
- Click the "Reward" button and select the 100% discount promotion;
- See the total amount of the order at 1ct.
Issue
Order total is 0.01 instead of 0.00.
Cause
Odoo prematurely rounds tax values when company setting is "Round per Line".
This causes sale_loyalty to calculate discounts using rounded inputs (e.g., 224.114 vs 224.1135), creating a precision mismatch with the final Reward Line (calculated globally).
Solution For 100% discounts, calculate the reward price by back-calculating from the total order amount (Tax Included) using the tax engine. This ensures the reward line exactly offsets the order total, regardless of rounding differences in the order lines.
opw-5097907
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
