ERPNext version 4 to 5 migration error

Hello

Here are the steps I have followed to install ERPNext 5 to my digital ocean server .

Step 1 : Fresh installation of ERPNext 4

wget https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh
sudo bash setup_frappe.sh --setup-production

Step 2 : After successful installation now to migrate to version 5 . 3 different commands are

bench switch-to-master

bench switch-to-develop

bench update --upgrade

Previously it worked perfect for me and I could use ERPNext version 5 . Except PDF generation . Because it doesn’t installed or worked for me and I couldn’t generate any PDF .

But Now using the same command I,m getting error on fresh installation . Here is the error

root@inventoerp:~# bench retry-upgrade

remote: Counting objects: 14, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 14 (delta 11), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (14/14), done.
From https://github.com/frappe/frappe

  • branch develop -> FETCH_HEAD
    dde3a3f…0c261a7 develop -> upstream/develop
    Updating dde3a3f…0c261a7
    Fast-forward
    frappe/templates/includes/blog/blog.html | 2 ±
    frappe/templates/includes/list/list.js | 5 +++++
    2 files changed, 6 insertions(+), 1 deletion(-)
    From https://github.com/frappe/shopping-cart

  • branch develop -> FETCH_HEAD
    Already up-to-date.
    From https://github.com/frappe/erpnext

  • branch develop -> FETCH_HEAD
    Already up-to-date.
    Migrating site1.local
    Executing erpnext.patches.v5_0.rename_total_fields in site1.local (1bd3e0294d)
    Traceback (most recent call last):
    File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
    main”, fname, loader, pkg_name)
    File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
    exec code in run_globals
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 77, in
    main()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 14, in main
    click.Group(commands=commands)(prog_name=‘bench’)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 664, in call
    return self.main(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 644, in main
    rv = self.invoke(ctx)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 464, in invoke
    return callback(*args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands.py”, line 28, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands.py”, line 202, in migrate
    frappe.modules.patch_handler.run_all()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 25, in run_all
    if not run_single(patchmodule = patch):
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 52, in run_single
    return execute_patch(patchmodule, method, methodargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 68, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + “.execute”)()
    File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v5_0/rename_total_fields.py”, line 46, in execute
    base_net_total = frappe.db.sql("select sum(ifnull({0}, 0)) from tab{1}".format(fields[0][1], dt))[0][0]
    File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 143, in sql
    self._cursor.execute(query)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
    self.errorhandler(self, exc, value)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
    raise errorclass, errorvalue
    _mysql_exceptions.OperationalError: (1054, “Unknown column ‘base_net_total’ in ‘field list’”)
    Traceback (most recent call last):
    File “/usr/local/bin/bench”, line 9, in
    load_entry_point(‘bench==0.1’, ‘console_scripts’, ‘bench’)()
    File “/home/frappe/bench-repo/bench/cli.py”, line 55, in cli
    bench()
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 664, in call
    return self.main(*args, **kwargs)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 644, in main
    rv = self.invoke(ctx)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 464, in invoke
    return callback(*args, **kwargs)
    File “/home/frappe/bench-repo/bench/cli.py”, line 263, in retry_upgrade
    patch_sites()
    File “/home/frappe/bench-repo/bench/utils.py”, line 118, in patch_sites
    run_frappe_cmd(’–site’, ‘all’, ‘migrate’, bench=bench)
    File “/home/frappe/bench-repo/bench/utils.py”, line 427, in run_frappe_cmd
    subprocess.check_call((f, ‘-m’, ‘frappe.utils.bench_helper’, ‘frappe’) + args, cwd=sites_dir)
    File “/usr/lib/python2.7/subprocess.py”, line 540, in check_call
    raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command ‘(’/home/frappe/frappe-bench/env/bin/python’, ‘-m’, ‘frappe.utils.bench_helper’, ‘frappe’, ‘–site’, ‘all’, ‘migrate’)’ returned non-zero exit status 1

    bench retry-upgrade
    doesnt worked for me . Please help

I think switch-to-develop should upgrade from v4 to v5.

Fixed the push, please run bench retry-upgrade again.