Skip to content

Conversation

@lvsz
Copy link
Contributor

@lvsz lvsz commented Mar 25, 2025

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

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
@robodoo
Copy link
Contributor

robodoo commented Mar 25, 2025

Pull request status dashboard

@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Mar 25, 2025
@lvsz lvsz marked this pull request as ready for review March 25, 2025 12:28
@C3POdoo C3POdoo requested a review from a team March 25, 2025 12:30
Copy link
Contributor

@Demesmaeker Demesmaeker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @lvsz 🦆

LGTM!

@robodoo r+

robodoo pushed a commit that referenced this pull request Mar 31, 2025
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

closes #203241

Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
@robodoo robodoo closed this Mar 31, 2025
@fw-bot fw-bot deleted the 16.0-opw-4246768-prevent_archiving_products_used_for_discount-sile branch April 7, 2025 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OE the report is linked to a support ticket (opw-...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants