ERPNext upgrafe v12 to v13 fails on updating dashboard for erpnext

I get the following failure when upgrading from v12 to v13. The upgrade works fine but fails on the migrate phase for ERPNext dashboard so it is incomplete.

I can run ERPNext v13 but when I enter a Sales Order, I get a failure sound but no error message - don’t know if this is related but it’s worrying that the migrate didn’t complete properly.

I’ve tried reinstalling erpnext previously but it still fails to migrate completely. I assumed it was a problem with a database entry. I noticed there were only a few rows in the tabDashboard* tables, so I delete existing rows except for tabDashboard Settings. When rerunning bench migrate, 4 rows are created in tabDashboard Chart Source and then it fails. Any hints to fix this? :

Updating Dashboard for erpnext
Traceback (most recent call last):
File “/usr/lib/python3.8/runpy.py”, line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/lib/python3.8/runpy.py”, line 87, in _run_code
exec(code, run_globals)
File “/home/kevinm/business/frappe-sys/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 101, in
main()
File “/home/kevinm/business/frappe-sys/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 829, in  **call**
return self.main(*args, **kwargs)
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/click/decorators.py”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/kevinm/business/frappe-sys/frappe-bench/apps/frappe/frappe/commands/ **init** .py”, line 27, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/kevinm/business/frappe-sys/frappe-bench/apps/frappe/frappe/commands/site.py”, line 298, in migrate
migrate(
File “/home/kevinm/business/frappe-sys/frappe-bench/apps/frappe/frappe/migrate.py”, line 74, in migrate
sync_dashboards()
File “/home/kevinm/business/frappe-sys/frappe-bench/apps/frappe/frappe/utils/dashboard.py”, line 97, in sync_dashboards
make_records_in_module(app_name, module_name)
File “/home/kevinm/business/frappe-sys/frappe-bench/apps/frappe/frappe/utils/dashboard.py”, line 107, in make_records_in_module
make_records(path)
File “/home/kevinm/business/frappe-sys/frappe-bench/apps/frappe/frappe/utils/dashboard.py”, line 115, in make_records
import_file_by_path("{path}/{fname}/{fname}.json".format(path=path, fname=fname))
File “/home/kevinm/business/frappe-sys/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 69, in import_file_by_path
import_doc(doc, force=force, data_import=data_import, pre_process=pre_process,
File “/home/kevinm/business/frappe-sys/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 143, in import_doc
doc.insert()
File “/home/kevinm/business/frappe-sys/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in insert
d.db_insert()
File “/home/kevinm/business/frappe-sys/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 357, in db_insert
frappe.db.sql("""INSERT INTO  `tab{doctype}`  ({columns})
File “/home/kevinm/business/frappe-sys/frappe-bench/apps/frappe/frappe/database/database.py”, line 146, in sql
self._cursor.execute(query, values)
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/pymysql/cursors.py”, line 148, in execute
result = self._query(query)
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/pymysql/cursors.py”, line 310, in _query
conn.query(q)
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 775, in _read_query_result
result.read()
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 1156, in read
first_packet = self.connection._read_packet()
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 725, in _read_packet
packet.raise_for_error()
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File “/home/kevinm/business/frappe-sys/frappe-bench/env/lib/python3.8/site-packages/pymysql/err.py”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, “Unknown column ‘name’ in ‘field list’”)

Although the system starts, I am unable to process documents. I can’t create new Sales Orders, for example. I tried switching to the dev branch and back again as that sometimes fixes things. Same error when migrating or bench update --patch. So I tried cancelling one sales order and amending it. When submitting, the error message appears: “pymysql.err.OperationalError: (1054, “Unknown column ‘c.is_billing_contact’ in ‘field list’”)”. So a column that was not added to the DB during migration? But which table?

1 Like

@Kevin_Minshaw i am also facing same problem in sales invoice
ERPNext: v13.4.1 (version-13)
Frappe Framework: v13.4.1 (version-13)

have you fixed this problem?

Apologies for not giving a status update. I kind of fixed it. In my case, ERPNext did start up and I was able to input a Sales Order but when I tried to post it, nothing happened. So I switched from Brave browser back to Chrome. Then when I tried posting, an error popped up about the is_billing_contact column not being found. After some investigation, I guessed it must belong in the Contacts table so I added it manually. That worked and everything seems fine now. But I haven’t tried running the upgrade again in case that breaks something else and I don’t know if is_billing_contact was also the ‘unknown column name’ mentioned in the upgrade error. Seriously, why these things get missed in the upgrade script, I don’t know. But I hope the info proves helpful to you.

1 Like

Thank you @Kevin_Minshaw for your response.

Thanks for the information
I applied the solution and it worked correctly.