From 06794f0900ea318d1f13408af5c0ef4b398b9648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roc=C3=ADo=20Vega?= Date: Fri, 17 Jan 2025 19:58:07 +0000 Subject: [PATCH] [FIX] account_interests: Fix when having interval to run interest closes ingadhoc/odoo-academic#189 X-original-commit: 04cdd732f725031593642278f0d8d1fe10696953 Related: ingadhoc/account-financial-tools#654 Signed-off-by: Ignacio Cainelli Signed-off-by: rov-adhoc --- academic_account_interests/__manifest__.py | 2 +- academic_account_interests/models/res_company_interest.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/academic_account_interests/__manifest__.py b/academic_account_interests/__manifest__.py index ca893908..79bddc00 100644 --- a/academic_account_interests/__manifest__.py +++ b/academic_account_interests/__manifest__.py @@ -19,7 +19,7 @@ ############################################################################## { 'name': 'Academic Account Interests', - 'version': "18.0.1.0.0", + 'version': "18.0.1.1.0", 'sequence': 14, 'summary': '', 'author': 'ADHOC SA', diff --git a/academic_account_interests/models/res_company_interest.py b/academic_account_interests/models/res_company_interest.py index 39fce7aa..de0f7aae 100644 --- a/academic_account_interests/models/res_company_interest.py +++ b/academic_account_interests/models/res_company_interest.py @@ -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._update_deuda(deuda, x[0], 'Deuda periodos anteriores', x[2] * self.rate * self.interval) deuda[x[0]]['partner_id'] = x[1] # Intereses por el último período @@ -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 - 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, student, 'Deuda último periodo', interest)