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 2 commits into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion account_payment_term_discount/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _compute_discount_amt(self):
)
)
if discount_information[0] > 0.0:
invoice.discount_amt = abs(round(discount_information[0], 2))
invoice.discount_amt = abs(discount_information[0])
# If discount taken make disc amt to 0 as disc is no more valid
if invoice.discount_taken != 0:
invoice.discount_amt = 0
Expand Down
4 changes: 2 additions & 2 deletions account_payment_term_discount/models/account_payment_term.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
)

if line.discount and payment_date <= till_discount_date:
payment_discount = round((amount * line.discount) / 100.0, 2)
payment_discount = (amount * line.discount) / 100.0
if invoice.move_type in ("out_invoice", "in_refund"):
discount_account_id = line.discount_expense_account_id.id
else:
Expand Down Expand Up @@ -99,4 +99,4 @@
def OnchangeDiscount(self):
if not self.discount:
return {}
self.value_amount = round(1 - (self.discount / 100.0), 2)
self.value_amount = 1 - (self.discount / 100.0)

Check warning on line 102 in account_payment_term_discount/models/account_payment_term.py

View check run for this annotation

Codecov / codecov/patch

account_payment_term_discount/models/account_payment_term.py#L102

Added line #L102 was not covered by tests
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ 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
self.payment_difference = 0.0

Expand Down
Loading