-
-
Notifications
You must be signed in to change notification settings - Fork 496
[18.0][FIX] account_payment_term_extension: fix percentage calculation with fixed amount on first line #932
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
base: 18.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,12 +183,13 @@ def _compute_terms( | |
| term_vals["company_amount"] = company_line_amount | ||
| term_vals["foreign_amount"] = line_amount | ||
| else: | ||
| # Percentage amounts | ||
| # Percentage amounts - use remaining_amount for correct calculation | ||
| # when there are fixed amounts on previous lines | ||
| line_amount = line.compute_line_amount( | ||
| total_amount, remaining_amount, precision_digits | ||
| remaining_amount, remaining_amount, precision_digits | ||
| ) | ||
| company_line_amount = line.compute_line_amount( | ||
| total_amount_currency, | ||
| remaining_amount_currency, | ||
| remaining_amount_currency, | ||
| company_precision_digits, | ||
| ) | ||
|
Comment on lines
+186
to
195
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change modifies the core payment-term amount computation logic but there’s no test covering the fixed-first-line + subsequent percent-lines case described in issue #924. Adding a regression test for the 400 + 33% + 33% + 34% example (asserting the resulting
line_idsamounts and that the last line is not negative) would prevent future reintroductions.