frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.91k stars 7.34k forks source link

Chart of Accounts Importer Error: TypeError: 'NoneType' object is not subscriptable #42775

Closed moizsami closed 3 months ago

moizsami commented 3 months ago

Information about bug

I have created a new company in erpnext, while trying to import the chart of accounts via Chart of Accounts Importer tool, I am constantly receiving this error: TypeError: 'NoneType' object is not subscriptable

Full error log:

App Versions

{
    "erpnext": "15.32.1",
    "frappe": "15.37.0",
    "hrms": "15.25.2",
    "print_designer": "1.4.0",
    "samtech": "0.0.1"
}

Route

Form/Chart of Accounts Importer/Chart of Accounts Importer

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 114, in application
    response = frappe.api.handle(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1768, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py", line 175, in get_coa
    forest = build_forest(data)
             ^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py", line 270, in build_forest
    path = return_parent(data, account_name)[::-1]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
TypeError: 'NoneType' object is not subscriptable

Request Data

{
    "type": "POST",
    "args": {
        "file_name": "/private/files/Chart of Accounts Importer.csv",
        "parent": "All Accounts",
        "doctype": "Chart of Accounts Importer",
        "is_root": true
    },
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/erpnext.accounts.doctype.chart_of_accounts_importer.chart_of_accounts_importer.get_coa",
    "request_id": null
}

Response Data

{
    "exception": "TypeError: 'NoneType' object is not subscriptable",
    "exc_type": "TypeError",
    "_exc_source": "erpnext (app)"
}

Please can someone help in fixing or knowing why this issue is happening. This is for a production environment which is suppose to go live after 4 days.

Module

accounts

Version

App Versions


{
    "erpnext": "15.32.1",
    "frappe": "15.37.0",
    "hrms": "15.25.2",
    "print_designer": "1.4.0",
    "samtech": "0.0.1"
}

### Installation method

manual install

### Relevant log output / Stack trace / Full Error Message.

_No response_
moizsami commented 3 months ago

I tried deleting the values in the Account Number column and then the import was successful.

I checked its a Data field, and I am having text and numbers in the field, not sure why receiving NoneType Object.

Anyways issue is in my data I guess