From 7a5c367729c4a0a4aeebccb138acceb3aba2afdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roc=C3=ADo=20Vega?= Date: Fri, 17 Jan 2025 16:50:56 -0300 Subject: [PATCH] [FIX] account_interests: Fix when having interval to run interest X-original-commit: d7817f61996a4565607676648e77be29e66035b0 --- account_interests/models/res_company_interest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_interests/models/res_company_interest.py b/account_interests/models/res_company_interest.py index be82eba0d..8a0345364 100644 --- a/account_interests/models/res_company_interest.py +++ b/account_interests/models/res_company_interest.py @@ -178,7 +178,7 @@ 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( @@ -186,7 +186,7 @@ def _calculate_debts(self, from_date, to_date, groupby=['partner_id']): ) 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)