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

[16.0][REF] purchase_triple_discount: Consolidate discount in std field #2599

Merged
merged 2 commits into from
Mar 9, 2025

Conversation

pedrobaeza
Copy link
Member

Continuation of #2317 and following OCA/account-invoicing#1840

Try to fix the current red CI state.


Until now, the triple discount feature did use the standard Odoo field as the first discount field, adding only extra fields for the second and the third discount. This implied we had to override any function using discount to consider the other discounts properly.

By adding an extra field discount1 to store the first discount, it allows to redefine the standard discount field to a computed field that will consolidate the triple discount from the other fields, and avoid the need to redefine anything relying on the discount field as it will already consider the triple discounts.

@Tecnativa

@pedrobaeza pedrobaeza added this to the 16.0 milestone Mar 9, 2025
Until now, the triple discount feature did use the standard Odoo field
as the first discount field, adding only extra fields for the second
and the third discount. This implied we had to override any function
using discount to consider the other discounts properly.

By adding an extra field discount1 to store the first discount, it allows
to redefine the standard discount field to a computed field that will
consolidate the triple discount from the other fields, and avoid the
need to redefine anything relying on the discount field as it will
already consider the triple discounts.
@pedrobaeza pedrobaeza force-pushed the 16.0-ref-purchase_triple_discount branch from 98c7e43 to c679e18 Compare March 9, 2025 12:27
Having conversions with currency rate, leads to a situation where what
we want to test is correct, but with a rounding error, so let's use
assertAlmostEqual to compensate it.
@pedrobaeza
Copy link
Member Author

As suspected, both sets of changes are needed, so let's merge this for fixing the CI that is blocking other PRs. @legalsylvain please check later if you see any problem due to your initial reluctance. I have put a TODO to move the mixin to the upper module.

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 16.0-ocabot-merge-pr-2599-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 9075af5 into OCA:16.0 Mar 9, 2025
8 of 9 checks passed
@OCA-git-bot
Copy link
Contributor

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

@pedrobaeza pedrobaeza deleted the 16.0-ref-purchase_triple_discount branch March 9, 2025 13:06
@legalsylvain
Copy link
Contributor

legalsylvain commented Mar 9, 2025

merge this for fixing the CI that is blocking other PRs. @legalsylvain please check later if you see any problem due to your initial reluctance

Do you talk about mixin refactoring ?
It's a Nice to have indeed. The most important is to have green CI in all repos.

Thanks for your work.

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