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_triple_discount: apply rounding #3061

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

ajaniszewska-dev
Copy link

@ajaniszewska-dev ajaniszewska-dev commented Apr 9, 2024

sometimes in case of multiplicative discount, subtotal on the line is not same as untaxed amount. Seems due to rounding as so far result returned by method could be something like: 284.64151515

before:
Screenshot from 2024-04-09 13-11-50

after:
image

@ajaniszewska-dev ajaniszewska-dev marked this pull request as ready for review April 9, 2024 11:16
@@ -58,7 +58,8 @@ def _multiplicative_discount(self):
final_discount = 1
for discount in discounts:
final_discount *= discount
return 100 - final_discount * 100
result = 100 - final_discount * 100
return round(result, 3)
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

@ajaniszewska-dev Why 3 (and not another number ...)?

Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

IMHO, you should (at least) use the configuration one:

image

Copy link
Author

Choose a reason for hiding this comment

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

@rousseldenis thank you for remark, corrected code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants