[FIX] website_sale_coupon: correctly update free shipping on cart

Promotion programs can be added in 3 ways, no_code_promo_program_ids,
code_promo_program_id, and through applied_coupon_ids.
So free delivery obtained by the two latter would not correctly update
the cart page, because the result of _get_free_shipping_lines would be
empty.

closes odoo/odoo#40317

Forward-port-of: https://github.com/odoo/enterprise/pull/6663
X-original-commit: bfde75dd72d1e529bfb93d2b83b22b8c2f0fcea1
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
This commit is contained in:
Nans Lefebvre
2019-11-15 10:12:07 +00:00
committed by fw-bot
parent 00521bc998
commit bf87b4a758
@@ -71,7 +71,7 @@ class SaleOrder(models.Model):
def _get_free_shipping_lines(self):
self.ensure_one()
free_shipping_prgs_ids = self.no_code_promo_program_ids.filtered(lambda p: p.reward_type == 'free_shipping')
free_shipping_prgs_ids = self._get_applied_programs_with_rewards_on_current_order().filtered(lambda p: p.reward_type == 'free_shipping')
if not free_shipping_prgs_ids:
return self.env['sale.order.line']
free_shipping_product_ids = free_shipping_prgs_ids.mapped('discount_line_product_id')