Skip to content

Commit

Permalink
[FIX] account_interests: Fix when having interval to run interest
Browse files Browse the repository at this point in the history
closes #654

X-original-commit: d7817f6
Related: ingadhoc/odoo-academic#189
Signed-off-by: Ignacio Cainelli <[email protected]>
Signed-off-by: rov-adhoc <[email protected]>
  • Loading branch information
rov-adhoc committed Jan 30, 2025
1 parent 679b1c1 commit d547ba4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions account_interests/models/res_company_interest.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@ def _calculate_debts(self, from_date, to_date, groupby=['partner_id']):
aggregates=['amount_residual:sum'],
)
for x in previous_grouped_lines:
self._update_deuda(deuda, x[0], 'Deuda periodos anteriores', x[1] * self.rate)
self._update_deuda(deuda, x[0], 'Deuda periodos anteriores', x[1] * self.rate * self.interval)

# Intereses por el último período
last_period_lines = self.env['account.move.line'].search(
self._get_move_line_domains() + [('amount_residual', '>', 0), ('date_maturity', '>=', from_date), ('date_maturity', '<', to_date)]
)
for partner, amls in last_period_lines.grouped('partner_id').items():
interest = sum(
move.amount_residual * ((to_date - move.invoice_date_due).days - 1) * (self.rate / interest_rate[self.rule_type])
move.amount_residual * ((to_date - move.invoice_date_due).days) * (self.rate / interest_rate[self.rule_type])
for move, lines in amls.grouped('move_id').items()
)
self._update_deuda(deuda, partner, 'Deuda último periodo', interest)
Expand Down

0 comments on commit d547ba4

Please sign in to comment.