Skip to content

Commit 40ecbe4

Browse files
committed
[FIX] account_interest: Correct interest calculation for late payments with multiple associated payments per invoice
X-original-commit: 8559324
1 parent a6ec33e commit 40ecbe4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

academic_account_interests/models/res_company_interest.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,13 @@ def _calculate_debts(self, from_date, to_date, groupby=None):
9494
)
9595

9696
for move_line, parts in partials.items():
97-
due_date = max(from_date, parts.debit_move_id.date_maturity)
97+
for part in parts:
98+
due_date = max(from_date, part.debit_move_id.date_maturity)
9899

99-
days = (parts.credit_move_id.date - due_date).days
100-
interest = parts.amount * days * (self._calculate_rate() / interest_rate[self.rule_type])
101-
# Se debe actualiza la deuda del partner, por ello se llama al cliente metodo para su actualizacion
102-
self._update_deuda(deuda, move_line.student_id, "Deuda pagos vencidos", interest)
100+
days = (part.credit_move_id.date - due_date).days
101+
interest = part.amount * days * (self._calculate_rate() / interest_rate[self.rule_type])
102+
# Se debe actualiza la deuda del partner, por ello se llama al cliente metodo para su actualizacion
103+
self._update_deuda(deuda, move_line.student_id, "Deuda pagos vencidos", interest)
103104
deuda[move_line.student_id]["partner_id"] = move_line.partner_id
104105

105106
return deuda

0 commit comments

Comments
 (0)