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

[14.0] [FIX] account_payment_term_discount: Difference in rounding #724

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

Conversation

majouda
Copy link

@majouda majouda commented Apr 19, 2024

In the context of this module's application, we encountered a specific issue involving:

  • Discount Amount: 229.95
  • Payment Difference: 229.95000000000002

Although there is no rounding in _compute_payment_difference() of account module and this module performs rounding in _compute_discount_amt().

This discrepancy in rounding can lead to different comparison results.

This commit aims to rectify the inconsistency in rounding between these two fields, ensuring accurate comparisons.

@OCA-git-bot
Copy link
Contributor

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

@bodedra
Copy link
Member

bodedra commented Apr 19, 2024

@majouda Thanks for your contribution. Would you add screenshot or example before and after this PR changes, please?

@@ -45,7 +45,7 @@ def onchange_payment_amount(self):
payment_date = fields.Date.from_string(self.payment_date)
discount_amt = self.invoice_id.discount_amt

payment_difference = self.payment_difference
payment_difference = abs(round(self.payment_difference, 2))
Copy link
Member

Choose a reason for hiding this comment

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

it would be better to use float_round with the invoice_id.currency_id's precision, ultimately the same result for most but it would save headaches for any currency that doesn't use 2 decimal places

Copy link
Author

Choose a reason for hiding this comment

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

Hello @hildickethan-S73 I made some changes according to your comment.

Can you please check again?

@majouda
Copy link
Author

majouda commented May 31, 2024

@majouda Thanks for your contribution. Would you add screenshot or example before and after this PR changes, please?

Hello @bodedra I added a description to this PR, can you check plz if it's clear now?

Copy link
Member

@bodedra bodedra left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

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.

None yet

4 participants