Upgrade v12 to V13 error: Invalid Method

After upgrading V12 to V13 (with a variety of smaller issues), now the system hangs at

grafik

Full Trace reads

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 56, in execute_cmd
    method = get_attr(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 189, in get_attr
    method = frappe.get_attr(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1160, in get_attr
    return getattr(get_module(modulename), methodname)
AttributeError: module 'erpnext.accounts.doctype.accounting_dimension.accounting_dimension' has no attribute 'get_dimension_filters'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 68, in application
    response = frappe.api.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 31, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 58, in execute_cmd
    frappe.throw(_('Invalid Method'))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 427, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 406, in msgprint
    _raise_exception()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 360, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: Invalid Method

The function seems to be indeed missing:

$ bench execute erpnext.accounts.doctype.accounting_dimension.accounting_dimension.get_dimension_filters
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py", line 200, in execute
    ret = frappe.get_attr(method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1160, in get_attr
    return getattr(get_module(modulename), methodname)
AttributeError: module 'erpnext.accounts.doctype.accounting_dimension.accounting_dimension' has no attribute 'get_dimension_filters'

Version is ERPNext 13.3

This has been the case in other tickets as well (unfortunately all of them auto-closed): 12 to 13 Upgrade: Account Dimension Error, Release v13.0.0-beta.12 - Accounting Dimension has issue

Anyone has this resolved?

This is only a workaround that got me into the system:

$ sudo nano apps/erpnext/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py

Then, redirected the last function

@frappe.whitelist()
def get_dimension_filters(with_cost_center_and_project=False):
    return get_dimensions(with_cost_center_and_project)

As this was wrongly mapped in

  • sites/assets/js/erpnext.min.js:
  • sites/assets/js/erpnext.min.js.map

Both are built assets, so, later I realised that merely

$ bench build
$ bench restart

Would have done the trick, without having to fork it :wink:

Hope this helps someone…

2 Likes

@lasalesi thanks a lot… it helped me to solve the same problem

thank you for sharing, it solved my problem, cheers!