Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] avoid error in aged partner balance report #1217

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions account_financial_report/report/aged_partner_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,25 @@
else:
ag_pb_data[acc_id]["older"] += residual
ag_pb_data[acc_id][prt_id]["older"] += residual
days_difference = abs((today - due_date).days)
for index, line in enumerate(interval_lines):
lower_limit = 0 if not index else interval_lines[index - 1].inferior_limit
next_line = interval_lines[index] if index < len(interval_lines) else None
interval_range = self._get_values_for_range_intervals(
lower_limit, next_line.inferior_limit
)
if (
days_difference in interval_range
or days_difference == line.inferior_limit
):
ag_pb_data[acc_id][line] += residual
ag_pb_data[acc_id][prt_id][line] += residual
break
if due_date:

Check warning on line 74 in account_financial_report/report/aged_partner_balance.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report/report/aged_partner_balance.py#L74

Added line #L74 was not covered by tests
days_difference = abs((today - due_date).days)
for index, line in enumerate(interval_lines):
lower_limit = (
0 if not index else interval_lines[index - 1].inferior_limit
)
next_line = (
interval_lines[index] if index < len(interval_lines) else None
)
interval_range = self._get_values_for_range_intervals(
lower_limit, next_line.inferior_limit
)
if (
days_difference in interval_range
or days_difference == line.inferior_limit
):
ag_pb_data[acc_id][line] += residual
ag_pb_data[acc_id][prt_id][line] += residual
break
return ag_pb_data

def _get_values_for_range_intervals(self, num1, num2):
Expand Down
Loading