Skip to content

Commit

Permalink
[IMP] academic_account_interest: Allow setting a more severe rate for…
Browse files Browse the repository at this point in the history
… overdue debts

closes #187

Related: ingadhoc/account-financial-tools#647
Signed-off-by: Camila Vives <[email protected]>
  • Loading branch information
rov-adhoc committed Jan 23, 2025
1 parent cdd50af commit 2844c5b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions academic_account_interests/models/res_company_interest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _calculate_debts(self, from_date, to_date, groupby=['student_id', 'partner_i
aggregates=['amount_residual:sum'],
)
for x in previous_grouped_lines:
self._update_deuda(deuda, x[0], 'Deuda periodos anteriores', x[2] * self.rate * self.interval)
self._update_deuda(deuda, x[0], 'Deuda periodos anteriores', x[2] * self.with_context(debt_past_period=True)._calculate_rate() * self.interval)
deuda[x[0]]['partner_id'] = x[1]

# Intereses por el último período
Expand All @@ -45,7 +45,7 @@ def _calculate_debts(self, from_date, to_date, groupby=['student_id', 'partner_i
)
for student, amls in last_period_lines.grouped('student_id').items():
interest = sum(
move.amount_residual * ((to_date - move.invoice_date_due).days) * (self.rate / interest_rate[self.rule_type])
move.amount_residual * ((to_date - move.invoice_date_due).days) * (self._calculate_rate() / interest_rate[self.rule_type])
for move, lines in amls.grouped('move_id').items()
)
self._update_deuda(deuda, student, 'Deuda último periodo', interest)
Expand All @@ -72,7 +72,7 @@ def _calculate_debts(self, from_date, to_date, groupby=['student_id', 'partner_i
due_date = max(from_date, parts.debit_move_id.date_maturity)

days = (parts.credit_move_id.date - due_date).days
interest = parts.amount * days * (self.rate / interest_rate[self.rule_type])
interest = parts.amount * days * (self._calculate_rate() / interest_rate[self.rule_type])
#Se debe actualiza la deuda del partner, por ello se llama al cliente metodo para su actualizacion
self._update_deuda(deuda, move_line.student_id, 'Deuda pagos vencidos', interest)
deuda[move_line.student_id]['partner_id'] = move_line.partner_id
Expand Down

0 comments on commit 2844c5b

Please sign in to comment.