odoo/odoo#204154

Created by fw-bot
Merged at eca08439d508b6528bbffd7461346bacca3b17ae

Statuses:

label
odoo-dev:17.0-16.0-opw-4246768-prevent_archiving_products_used_for_discount-sile-425222-fw
head
c3a1ac6313bfd7ee9617519509a40a482da1ab75
merged
7 months ago by Bugfix, Levi Siuzdak
odoo/odoo
16.0 #203241
17.0 #204154
saas-17.4 #204175
18.0 #204275
saas-18.1 #204300
saas-18.2 #204327
saas-18.3
saas-18.4
19.0
master #204351

[FW][FIX] loyalty: prevent archiving product used for specific discounts

Versions

  • 16.0+

Steps

  1. Create a promotion program;
  2. add a reward that offers a discount on a specific product;
  3. specify a specific product;
  4. archive the specified specific product;
  5. create a sales order with a random product;
  6. apply applicable rewards.

Issue

The reward's specific discount has become applicable to all products.

Cause

After archiving a product, the reward's discount_product_ids becomes empty unless active_test=False is added to the context.

With this field empty, and no otherwise specified product domain, the discount can be applied to any product.

Solution

Prevent archiving products that have an active program applying a specific discount to them.

opw-4246768

Forward-Port-Of: #203241