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

fix: index error on Receivable report based on payment terms #36963

Merged

Conversation

ruthra-kumar
Copy link
Member

Cr Notes don't have payment terms. Skip term based allocation for them.

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 83, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 53, in handle
    return _RESTAPIHandler(call, doctype, name).get_response()
  File "apps/frappe/frappe/api.py", line 69, in get_response
    return self.handle_method()
  File "apps/frappe/frappe/api.py", line 79, in handle_method
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 48, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 86, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1671, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/frappe/frappe/__init__.py", line 836, in wrapper_fn
    retval = fn(*args, **get_newargs(fn, kwargs))
  File "apps/frappe/frappe/desk/query_report.py", line 214, in run
    result = generate_report_result(report, filters, user, custom_columns, is_tree, parent_field)
  File "apps/frappe/frappe/__init__.py", line 836, in wrapper_fn
    retval = fn(*args, **get_newargs(fn, kwargs))
  File "apps/frappe/frappe/desk/query_report.py", line 82, in generate_report_result
    res = get_report_result(report, filters) or []
  File "apps/frappe/frappe/desk/query_report.py", line 63, in get_report_result
    res = report.execute_script_report(filters)
  File "apps/frappe/frappe/core/doctype/report/report.py", line 164, in execute_script_report
    res = self.execute_module(filters)
  File "apps/frappe/frappe/core/doctype/report/report.py", line 181, in execute_module
    return frappe.get_attr(method_name)(frappe._dict(filters))
  File "apps/erpnext/erpnext/accounts/report/accounts_receivable/accounts_receivable.py", line 40, in execute
    return ReceivablePayableReport(filters).run(args)
  File "apps/erpnext/erpnext/accounts/report/accounts_receivable/accounts_receivable.py", line 62, in run
    self.get_data()
  File "apps/erpnext/erpnext/accounts/report/accounts_receivable/accounts_receivable.py", line 113, in get_data
    self.build_data()
  File "apps/erpnext/erpnext/accounts/report/accounts_receivable/accounts_receivable.py", line 280, in build_data
    self.allocate_outstanding_based_on_payment_terms(row)
  File "apps/erpnext/erpnext/accounts/report/accounts_receivable/accounts_receivable.py", line 435, in allocate_outstanding_based_on_payment_terms
    self.get_payment_terms(row)
  File "apps/erpnext/erpnext/accounts/report/accounts_receivable/accounts_receivable.py", line 472, in get_payment_terms
    row.paid -= flt(payment_terms_details[0].total_advance)
IndexError: list index out of range

cr note's don't have payment terms. So, skip for them.
@ruthra-kumar ruthra-kumar added the backport version-14-hotfix backport to version 14 label Sep 5, 2023
@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Sep 5, 2023
@codecov
Copy link

codecov bot commented Sep 5, 2023

Codecov Report

Merging #36963 (b9c556c) into develop (f7865da) will increase coverage by 0.00%.
Report is 2 commits behind head on develop.
The diff coverage is 50.00%.

@@           Coverage Diff            @@
##           develop   #36963   +/-   ##
========================================
  Coverage    65.55%   65.55%           
========================================
  Files          796      796           
  Lines        62718    62721    +3     
========================================
+ Hits         41114    41117    +3     
  Misses       21604    21604           
Files Changed Coverage
.../report/accounts_receivable/accounts_receivable.py 50.00%

@ruthra-kumar ruthra-kumar merged commit ccd2e2b into frappe:develop Sep 5, 2023
14 checks passed
deepeshgarg007 pushed a commit that referenced this pull request Sep 5, 2023
fix: index error on Receivable report based on payment terms

cr note's don't have payment terms. So, skip for them.

(cherry picked from commit b9c556c)

Co-authored-by: ruthra kumar <ruthra@erpnext.com>
frappe-pr-bot pushed a commit that referenced this pull request Sep 6, 2023
# [14.38.0](v14.37.1...v14.38.0) (2023-09-06)

### Bug Fixes

* account payable currency and value ([#36859](#36859)) ([98c2640](98c2640))
* added ignore_user_permissions to parent field of tree doctypes ([451cc7b](451cc7b))
* added validation for unique serial numbers in pos invoice ([#36302](#36302)) ([1192736](1192736))
* allow payment_account of loan repayment to be edited ([#36948](#36948)) ([09e2f24](09e2f24))
* ask for asset related accounts only when needed (backport [#36960](#36960)) ([#36971](#36971)) ([58163d5](58163d5))
* calcuate received/paid amount on rate change in PE ([0a63266](0a63266))
* deduplicate gain/loss JE creation for journals as payment ([9168b3b](9168b3b))
* difference amount in UI should not be calculated ([9bc2b41](9bc2b41))
* fetch discount amount for gle in base currency ([a8b5880](a8b5880))
* ignore mandatory fields while saving WO (backport [#36954](#36954)) ([#36970](#36970)) ([c125dea](c125dea))
* index error on Receivable report based on payment terms ([#36963](#36963)) ([e3d64fc](e3d64fc))
* invalid gain/loss JE created on base currency Expense Claim ([068f1b5](068f1b5))
* only show "Unreconcile" if reconciled ([61752ac](61752ac))
* prorate factor for subscription plan ([#36953](#36953)) ([fc79af5](fc79af5))
* reduce threshold for bg job fn ([5a226a8](5a226a8))
* remove withholding category from common fields ([18f8f7f](18f8f7f))
* Set the default filter in All Trends Report ([132957f](132957f))
* Set the default filter in All Trends Report ([420536c](420536c))
* when create doc from item dashboard default uom (buying or selling) is not correctly selected (backport [#36892](#36892)) ([#36928](#36928)) ([5c8bee0](5c8bee0))

### Features

* **RFQ:** optionally send document print ([#36363](#36363)) ([345c608](345c608))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-14-hotfix backport to version 14 needs-tests This PR needs automated unit-tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant