Site migration error

Hi ,

I am trying to migrate the database to latest version developer.
getting error as AttributeError: ‘Account’ object has no attribute ‘account_number’
Please help

frappe@erpnext:~/frappe-bench$ bench --site erp migrate
Migrating erp
Executing erpnext.patches.v10_0.setup_vat_for_uae_and_saudi_arabia in erp (44ea05c927d5a624)
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 94, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, 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 716, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, 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 1060, 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 889, 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 534, 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 222, 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/v10_0/setup_vat_for_uae_and_saudi_arabia.py”, line 11, in execute
install_country_fixtures(d.name)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/setup/doctype/company/company.py”, line 324, in install_country_fixtures
.format(frappe.scrub(company_doc.country)))(company_doc)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/saudi_arabia/setup.py”, line 14, in setup
create_sales_tax(company)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/setup/setup_wizard/operations/taxes_setup.py”, line 16, in create_sales_tax
tax_data.get(‘tax_rate’), sales_tax)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/setup/setup_wizard/operations/taxes_setup.py”, line 26, in make_tax_account_and_template
tax_account = make_tax_account(company, account_name[i], tax_rate[i])
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/setup/setup_wizard/operations/taxes_setup.py”, line 50, in make_tax_account
}).insert(ignore_permissions=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 212, in insert
self.set_new_name()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 372, in set_new_name
set_new_name(self)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/naming.py”, line 38, in set_new_name
doc.run_method(“autoname”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 755, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1024, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1007, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 749, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/account/account.py”, line 23, in autoname
self.name = get_account_autoname(self.account_number, self.account_name, self.company)
AttributeError: ‘Account’ object has no attribute ‘account_number’

1 Like

Thanks for reporting the error. I will push a fix right away.

Pushed a fix (https://github.com/frappe/erpnext/commit/c65279b584e86fd8c9cd6caa49e0483c9f026976). Please update again.

Thanks , it is working perfect…

Migrating site1.local
Executing erpnext.patches.v10_0.setup_vat_for_uae_and_saudi_arabia #2017-12-28 in site1.local (1bd3e0294da19198)
Traceback (most recent call last):
File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/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 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 227, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 47, 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/v10_0/setup_vat_for_uae_and_saudi_arabia.py”, line 13, in execute
install_country_fixtures(d.name)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/setup/doctype/company/company.py”, line 400, in install_country_fixtures
.format(frappe.scrub(company_doc.country)))(company_doc, False)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/saudi_arabia/setup.py”, line 14, in setup
create_sales_tax(company)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/setup/setup_wizard/operations/taxes_setup.py”, line 16, in create_sales_tax
tax_data.get(‘tax_rate’), sales_tax)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/setup/setup_wizard/operations/taxes_setup.py”, line 25, in make_tax_account_and_template
tax_account = make_tax_account(company, account_name[i], tax_rate[i])
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/setup/setup_wizard/operations/taxes_setup.py”, line 51, in make_tax_account
}).insert(ignore_permissions=True, ignore_mandatory=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 222, in insert
self.run_before_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 876, in run_before_save_methods
self.run_method(“validate”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 772, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1048, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1031, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 766, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/account/account.py”, line 44, in validate
self.validate_root_company_and_sync_account_to_children()
File “/home/frappe/frappe-bench/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 “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/account/account.py”, line 297, in get_root_company
ancestors = get_ancestors_of(‘Company’, company, “lft asc”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/nestedset.py”, line 261, in get_ancestors_of
lft, rgt = frappe.db.get_value(doctype, name, [“lft”, “rgt”])
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 491, in get_value
order_by, cache=cache)
File “/home/frappe/frappe-bench/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 “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 677, in _get_values_from_table
as_dict=as_dict, debug=debug, update=update)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 199, in sql
self._cursor.execute(query, values)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py”, line 170, in execute
result = self._query(query)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py”, line 328, in _query
conn.query(q)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 732, in _read_query_result
result.read()
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 1075, in read
first_packet = self.connection._read_packet()
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 684, in _read_packet
packet.check_error()
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/protocol.py”, line 220, in check_error
err.raise_mysql_exception(self._data)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/err.py”, line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.InternalError: (1054, “Unknown column ‘lft’ in ‘field list’”)

i have problem

Thanks stay tuned your error reported here https://github.com/frappe/erpnext/issues/18047