Upgrade from v9 to v11 issue

Hello,

I have self hosted ERPNext version 9.x.x develop. I would like to switch it to master then upgrade it to v11 master.
How can I achieve this upgrade.? Please advise.

Please not that I tried different methods but no luck.

Regards

In theory, you should be able to do

bench switch-to-master
bench migrate
bench update --reset

Tried that but getting below error after bench migrate:

Traceback (most recent call last):
File “/usr/lib64/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib64/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/opt/bench/erpnext/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/opt/bench/erpnext/apps/frappe/frappe/commands/site.py”, line 227, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/opt/bench/erpnext/apps/frappe/frappe/migrate.py”, line 47, in migrate
frappe.modules.patch_handler.run_all()
File “/opt/bench/erpnext/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/opt/bench/erpnext/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/opt/bench/erpnext/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/opt/bench/erpnext/apps/frappe/frappe/patches/v11_0/sync_stripe_settings_before_migrate.py”, line 18, in execute
settings.save(ignore_permissions=True)
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 260, in save
return self._save(*args, **kwargs)
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 283, in _save
self.insert()
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 249, in insert
self.run_post_save_methods()
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 905, in run_post_save_methods
self.run_method(“on_update”)
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 772, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 1048, in composer
return composed(self, method, *args, **kwargs)
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 1031, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 766, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/opt/bench/erpnext/apps/frappe/frappe/integrations/doctype/stripe_settings/stripe_settings.py”, line 34, in on_update
call_hook_method(‘payment_gateway_enabled’, gateway=‘Stripe-’ + self.gateway_name)
File “/opt/bench/erpnext/apps/frappe/frappe/utils/init.py”, line 364, in call_hook_method
out = out or frappe.get_attr(method_name)(*args, **kwargs)
File “/opt/bench/erpnext/apps/erpnext/erpnext/accounts/utils.py”, line 767, in create_payment_gateway_account
bank_account = create_bank_account({“company_name”: company, “bank_account”: _(gateway)})
File “/opt/bench/erpnext/apps/erpnext/erpnext/setup/setup_wizard/operations/company_setup.py”, line 62, in create_bank_account
return bank_account.insert()
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 222, in insert
self.run_before_save_methods()
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 876, in run_before_save_methods
self.run_method(“validate”)
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 772, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 1048, in composer
return composed(self, method, *args, **kwargs)
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 1031, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 766, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/opt/bench/erpnext/apps/erpnext/erpnext/accounts/doctype/account/account.py”, line 44, in validate
self.validate_root_company_and_sync_account_to_children()
File “/opt/bench/erpnext/apps/erpnext/erpnext/accounts/doctype/account/account.py”, line 99, in validate_root_company_and_sync_account_to_children
ancestors = get_root_company(self.company)
File “/opt/bench/erpnext/apps/erpnext/erpnext/accounts/doctype/account/account.py”, line 297, in get_root_company
ancestors = get_ancestors_of(‘Company’, company, “lft asc”)
File “/opt/bench/erpnext/apps/frappe/frappe/utils/nestedset.py”, line 261, in get_ancestors_of
lft, rgt = frappe.db.get_value(doctype, name, [“lft”, “rgt”])
File “/opt/bench/erpnext/apps/frappe/frappe/database.py”, line 491, in get_value
order_by, cache=cache)
File “/opt/bench/erpnext/apps/frappe/frappe/database.py”, line 535, in get_values
out = self._get_values_from_table(fields, filters, doctype, as_dict, debug, order_by, update)
File “/opt/bench/erpnext/apps/frappe/frappe/database.py”, line 677, in _get_values_from_table
as_dict=as_dict, debug=debug, update=update)
File “/opt/bench/erpnext/apps/frappe/frappe/database.py”, line 199, in sql
self._cursor.execute(query, values)
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/pymysql/cursors.py”, line 165, in execute
result = self._query(query)
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/pymysql/cursors.py”, line 321, in _query
conn.query(q)
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/pymysql/connections.py”, line 860, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/pymysql/connections.py”, line 1061, in _read_query_result
result.read()
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/pymysql/connections.py”, line 1349, in read
first_packet = self.connection._read_packet()
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/pymysql/connections.py”, line 1018, in _read_packet
packet.check_error()
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/pymysql/connections.py”, line 384, in check_error
err.raise_mysql_exception(self._data)
File “/opt/bench/erpnext/env/lib/python2.7/site-packages/pymysql/err.py”, line 107, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.InternalError: (1054, u"Unknown column ‘lft’ in ‘field list’")
[bench@localhost erpnext]$

I think I left out a command after the switch… not 100% sure, but …

bench init

then the migrate

Still getting the same error.

Similar traceback here too Site migration error

But in your case this patch v11_0/sync_stripe_settings_before_migrate

Thanks for your replay. But I couldn’t find the solution in that post.

Yes first define the problem - would you happen to use Stripe?

No I don’t use stripe.

The traceback suggests you have a StripeSettings doctype - if so delete that?

https://erpnext.com/docs/user/manual/en/setting-up/integrations/stripe-integration

Thanks a lot Clarkej. You are right I have done the stripe and paypal setting and added Oman currency as part of the code from the very beginning of the implementation almost a year or more ago. I removed them and things works great.

Highly appreciated your support. Now I’m on V11 master.

2 Likes

Good to hear yup tracebacks have a keen recall