Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] sale_product_pack: adjust discount formula for detailed packs #202

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

lef-adhoc
Copy link

This is a backport of version 18 #201

The discount formula for detailed packs has been updated to address inconsistencies when pricelists explicitly display discounts.

The new formula ensures accurate representation of the combined discount by correctly factoring in both the parent pack and component discounts.

Example:

Parent pack discount: 5%
Component A discount: 10%
Component B discount: 20%
The issue occurred when pricelists explicitly displayed discounts. For example, when the pricelist showed the discount percentage but did not properly calculate the combined effect of the pack discount and the component discounts, the displayed total was inconsistent.

With the new formula:

Component A effective discount:
100.0 - ((100.0 - 5.0) * (100.0 - 10.0) / 100.0) = 14.5% Component B effective discount:
100.0 - ((100.0 - 5.0) * (100.0 - 20.0) / 100.0) = 24.0% This ensures that when pricelists explicitly show discounts, the displayed percentage matches the calculated prices.

@OCA-git-bot
Copy link
Contributor

Hi @victoralmau,
some modules you are maintaining are being modified, check this out!

The discount formula for detailed packs has been updated to address inconsistencies when pricelists explicitly display discounts.

The new formula ensures accurate representation of the combined discount by correctly factoring in both the parent pack and component discounts.

Example:

Parent pack discount: 5%
Component A discount: 10%
Component B discount: 20%
The issue occurred when pricelists explicitly displayed discounts. For example, when the pricelist showed the discount percentage but did not properly calculate the combined effect of the pack discount and the component discounts, the displayed total was inconsistent.

With the new formula:

Component A effective discount:
100.0 - ((100.0 - 5.0) * (100.0 - 10.0) / 100.0) = 14.5%
Component B effective discount:
100.0 - ((100.0 - 5.0) * (100.0 - 20.0) / 100.0) = 24.0%
This ensures that when pricelists explicitly show discounts, the displayed percentage matches the calculated prices.
@lef-adhoc
Copy link
Author

@pedrobaeza Hi, can you check this?

@pedrobaeza pedrobaeza added this to the 17.0 milestone Feb 11, 2025
@pedrobaeza
Copy link
Member

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 17.0-ocabot-merge-pr-202-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 6e2fa61. Thanks a lot for contributing to OCA. ❤️

@OCA-git-bot OCA-git-bot merged commit f68d847 into OCA:17.0 Feb 11, 2025
6 checks passed
@lef-adhoc lef-adhoc deleted the 17.0-h-87706-lef branch February 11, 2025 11:29
teamcore-admin pushed a commit to t-core-one/oca-product-pack that referenced this pull request Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants