odoo/odoo#204620

Created by fw-bot
Merged at bd3b0bf3cfdb7d801b10a5bbc076c6b3cf9b85b9

Statuses:

label
odoo-dev:saas-18.1-18.0-opw-4658702-ignore_delivery_lines_for_discounts-sile-424125-fw
head
5ca37a019315c6af58bf63b5e3f5b62d18bb6cb6
merged
7 months ago by Bugfix, Levi Siuzdak
odoo/odoo
18.0 #202519
saas-18.1 #204620
saas-18.2 #204705
saas-18.3
saas-18.4
19.0
master #204711

[FW][FIX] {website_,}sale_loyalty{,_delivery}: don't discount shipping

Versions

  • 18.0+

Steps

  1. Have a promo code that applies a 50% discount;
  2. have a fixed price delivery method;
  3. apply code on an order with said delivery method.

Issue

The 50% discount is applied to the shipping costs.

Cause

When calculating the discountable amount in _discountable_amount, it uses the _get_no_effect_on_threshold_lines method to filter out sale order lines that shouldn't impact the amount discounted. This value gets stored in the lines recordset.

Commit d0e7be7832672 overlooked the existence of this variable when modifying the _discountable_amount method, and instead used self.order_line, using all lines to calculate the discountable amount.

Solution

Use the filtered recordset to calculate the discountable amount.

opw-4658702

Forward-Port-Of: #202519