Skip to content

Commit 31aa2f5

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 31aa2f5

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

academic_account_interests/models/res_company_interest.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,15 @@ 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)
99+
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)
104+
deuda[move_line.student_id]['partner_id'] = move_line.partner_id
98105

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)
103-
deuda[move_line.student_id]["partner_id"] = move_line.partner_id
104106

105107
return deuda
106108

0 commit comments

Comments
 (0)