Migrate from V7 to V8

Hi guys,
Another error

Executing erpnext.patches.v8_0.update_stock_qty_value_in_bom_item in site1.local (1bd3e0294da19198)
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, 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 91, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 17, 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 722, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, 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 1066, 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 895, 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 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 216, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
frappe.modules.patch_handler.run_all()
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v8_0/update_stock_qty_value_in_bom_item.py”, line 13, in execute
frappe.db.sql(“update tabBOM Scrap Item set stock_qty = qty”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 153, in sql
self._cursor.execute(query)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 250, in execute
self.errorhandler(self, exc, value)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 50, in defaulterrorhandler
raise errorvalue
_mysql_exceptions.OperationalError: (1054, “Unknown column ‘qty’ in ‘field list’”)

Any update on this?

@makarand_b, have you had time to look at the new error yet? Is it on my end or need a code fix?

@rohit_w
Hi guys, I’m still stuck on the upgrade path with the above error. Any update if it can be fixed on my end or needs a code fix.

@iadr3805

Are you made personal changes in a Doctype
and put a ‘qty’ column in to it, did not you?

“Unknown column ‘qty’ in ‘field list’”

Hope this helps.

You need to reload doc forcefully

Also check

1 Like

I can’t figure out how to reload doc.
I followed the second link you provided and modified the file but then I get an error which is explained here, and these solution stashed the changes and same error appears.

The changes to the file need to take place after you run bench update and the files get downloaded from github, but before the patch runs. I’ve done this a few times where I have the modified file all ready to go, then after the first part of bench update runs (where the files all download from git), I override the patch with the one that is modified.

It takes a bit of timing, but is normally not too hard to do.

If I understand you correctly. run bench update, then upload the file with the changes during the update process? I’ve done this a few times and but no luck. Still getting the same error as above

mysqlexceptions.OperationalError: (1054, “Unknown column ‘qty’ in ‘field list’”)

this is the file I’m modifying

File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v8_0/update_stock_qty_value_in_bom_item.py”, line 13, in execute
frappe.db.sql(“update tabBOM Scrap Item set stock_qty = qty”)

Go to the console using bench --site <your-site-name> console and run following in console:

frappe.reload_doc('manufacturing', 'doctype', 'bom_item', force=True)
frappe.reload_doc('manufacturing', 'doctype', 'bom_explosion_item', force=True)
frappe.reload_doc('manufacturing', 'doctype', 'bom_scrap_item', force=True)
frappe.db.commit()

Exit from the console and run bench update again.

The commands run successfully

In [1]: frappe.reload_doc(‘manufacturing’, ‘doctype’, ‘bom_item’, force=True)
Out[1]: True

In [2]: frappe.reload_doc(‘manufacturing’, ‘doctype’, ‘bom_explosion_item’, force=True)
…:
Out[2]: True

In [3]: frappe.reload_doc(‘manufacturing’, ‘doctype’, ‘bom_scrap_item’, force=True)
Out[3]: True

In [4]: frappe.db.commit()

But same error still there

Backing up sites…
Patching sites…
Migrating site1.local
Executing finally:erpnext.patches.v7_0.update_timesheet_communications in site1.local (1bd3e0294da19198)
Success
Executing erpnext.patches.v8_0.update_stock_qty_value_in_bom_item in site1.local (1bd3e0294da19198)
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, 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 91, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 17, 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 722, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, 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 1066, 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 895, 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 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 216, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
frappe.modules.patch_handler.run_all()
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v8_0/update_stock_qty_value_in_bom_item.py”, line 13, in execute
frappe.db.sql(“update tabBOM Scrap Item set stock_qty = qty”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 165, in sql
self._cursor.execute(query)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 250, in execute
self.errorhandler(self, exc, value)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 50, in defaulterrorhandler
raise errorvalue
_mysql_exceptions.OperationalError: (1054, “Unknown column ‘qty’ in ‘field list’”)

Ok, I understood the issue, will push a fix soon. The problem is, in your case, “BOM Scrap Item” table is introducing for the first time and thats why there is no existing qty field.

Sent a PR to fix this, will be released soon.

Hi Mak,

Has this been pushed to master yet?

I am migrating from ver 7 to 8 for a client, and I am getting this same problem: frappe.exceptions.DoesNotExistError: DocType Domain not found.

Running bench update is not helping and this instance is on master both on frappe and erpnext.

Thanks

Jay

Hi Jay,

I just a had look and it hasn’t been yet

This is a different problem. Can you please share the full error trace?

Here it is Nabin:

INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
Requirement already satisfied: olefile in ./env/lib/python2.7/site-packages (from Pillow)
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull upstream master
From https://github.com/frappe/frappe

  • branch master -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    INFO:bench.app:pulling erpnext
    INFO:bench.utils:git pull upstream master
    From https://github.com/frappe/erpnext
  • branch master -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    Updating Python libraries…
    INFO:bench.utils:./env/bin/pip install --upgrade pip
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
    INFO:bench.utils:./env/bin/pip install -q -r /home/frappe/.bench/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/erpnext/requirements.txt
    Updating node libraries…
    INFO:bench.utils:npm install
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
    npm WARN frappe@ No description
    Backing up sites…
    Patching sites…
    Migrating site1.local
    Executing erpnext.patches.v7_1.update_portal_roles in site1.local (1bd3e0294da19198)
    Traceback (most recent call last):
    File “/usr/lib/python2.7/runpy.py”, line 174, 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 91, in
    main()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 17, 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 722, in call
    return self.main(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
    rv = self.invoke(ctx)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, 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 1066, 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 895, 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 535, in invoke
    return callback(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 216, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
    frappe.modules.patch_handler.run_all()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
    if not run_single(patchmodule = patch):
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + “.execute”)()
    File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v7_1/update_portal_roles.py”, line 10, in execute
    frappe.get_doc(dict(doctype=‘Role’, role_name=role_name, desk_access=0)).insert()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 182, in insert
    self.set_defaults()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 493, in set_defaults
    new_doc = frappe.new_doc(self.doctype, as_dict=True)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 597, in new_doc
    return get_new_doc(doctype, parent_doc, parentfield, as_dict=as_dict)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 19, in get_new_doc
    frappe.local.new_doc_templates[doctype] = make_new_doc(doctype)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 40, in make_new_doc
    set_user_and_static_default_values(doc)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 55, in set_user_and_static_default_values
    user_default_value = get_user_default_value(df, defaults, user_permissions)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 70, in get_user_default_value
    if (frappe.get_meta(df.options).document_type==“Setup”
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 638, in get_meta
    return frappe.model.meta.get_meta(doctype, cached=cached)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/meta.py”, line 33, in get_meta
    lambda: Meta(doctype))
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 173, in hget
    value = generator()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/meta.py”, line 33, in
    lambda: Meta(doctype))
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/meta.py”, line 69, in init
    super(Meta, self).init(“DocType”, doctype)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 84, in init
    self.load_from_db()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/meta.py”, line 74, in load_from_db
    super(Meta, self).load_from_db()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 115, in load_from_db
    frappe.throw(
    ("{0} {1} not found").format(
    (self.doctype), self.name), frappe.DoesNotExistError)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 319, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
    _raise_exception()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
    raise raise_exception(encode(msg))
    frappe.exceptions.DoesNotExistError: DocType Domain not found

@nabinhait: Did you manage to review the trace? Any suggestions?

Thanks

Jay

Pushed a fix in hotfix branch which will be merge to master by the end of today.

Went through like a charm. Thanks much!

Jay

1 Like