frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
22.07k stars 7.39k forks source link

Please Help! Issue when upgrade from ver 7 to Ver 8 #9146

Closed yaochang007 closed 7 years ago

yaochang007 commented 7 years ago

Hi All,

I have an issue when I upgrade from V7 to V8, It will be really appreciated if anyone can help to solve it:

Backing up sites... Patching sites... Migrating site1.local Executing frappe.patches.v8_0.rename_page_role_to_has_role #2017-03-16 in site1.local (1bd3e0294da19198) Traceback (most recent call last): File "/usr/lib64/python2.7/runpy.py", line 162, in runmodule_as_main "main", fname, loader, pkg_name) File "/usr/lib64/python2.7/runpy.py", line 72, in runcode exec code in run_globals File "/home/john/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in main() File "/home/john/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main click.Group(commands=commands)(prog_name='bench') File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 716, in call return self.main(args, kwargs) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke return processresult(sub_ctx.command.invoke(sub_ctx)) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke return processresult(sub_ctx.command.invoke(sub_ctx)) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 534, in invoke return callback(args, kwargs) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), *args, *kwargs) File "/home/john/frappe-bench/apps/frappe/frappe/commands/init.py", line 24, in _func ret = f(frappe._dict(ctx.obj), args, kwargs) File "/home/john/frappe-bench/apps/frappe/frappe/commands/site.py", line 214, in migrate migrate(context.verbose, rebuild_website=rebuild_website) File "/home/john/frappe-bench/apps/frappe/frappe/migrate.py", line 31, in migrate frappe.modules.patch_handler.run_all() File "/home/john/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all if not run_single(patchmodule = patch): File "/home/john/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single return execute_patch(patchmodule, method, methodargs) File "/home/john/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 83, in execute_patch frappe.get_attr(patchmodule.split()[0] + ".execute")() File "/home/john/frappe-bench/apps/frappe/frappe/patches/v8_0/rename_page_role_to_has_role.py", line 9, in execute frappe.rename_doc('DocType', 'Page Role', 'Has Role') File "/home/john/frappe-bench/apps/frappe/frappe/init.py", line 668, in rename_doc return rename_doc(*args, **kwargs) File "/home/john/frappe-bench/apps/frappe/frappe/model/rename_doc.py", line 46, in rename_doc update_link_field_values(link_fields, old, new, doctype) File "/home/john/frappe-bench/apps/frappe/frappe/model/rename_doc.py", line 160, in update_link_field_values single_doc = frappe.get_doc(field['parent']) File "/home/john/frappe-bench/apps/frappe/frappe/init.py", line 606, in get_doc return frappe.model.document.get_doc(arg1, arg2) File "/home/john/frappe-bench/apps/frappe/frappe/model/document.py", line 49, in get_doc controller = get_controller(doctype) File "/home/john/frappe-bench/apps/frappe/frappe/model/base_document.py", line 35, in get_controller module = load_doctype_module(doctype, module_name) File "/home/john/frappe-bench/apps/frappe/frappe/modules/utils.py", line 174, in load_doctype_module app = get_module_app(module) File "/home/john/frappe-bench/apps/frappe/frappe/modules/utils.py", line 197, in get_module_app return frappe.local.module_app[scrub(module)] KeyError: u'accounts'

manassolanki commented 7 years ago

Hi @yaochang007, If you want help or have some queries, please post that to https://discuss.erpnext.com/

yaochang007 commented 7 years ago

Hi manassolanki,

I also posted on the forum, but I believe this is an issue, I update from ERPNext: v7.2.25, Frappe Framework: v7.2.20, My system has no customization, and all the git repository has been reset previously.

manassolanki commented 7 years ago

Hi, Could you please comment the output of below from frappe bench console? To open the frappe bench console bench --site sitename console Run this for command print(frappe.local.module_app)

yaochang007 commented 7 years ago

Hi, Below is the output:

[john@Full-20170605-1gb-sgp1-01 frappe-bench]$ bench --site site1.local console Python 2.7.5 (default, Nov 6 2016, 00:28:07) Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details.

In [1]: print(frappe.local.module_app) {u'website': u'frappe', u'core': u'frappe', u'workflow': u'frappe', u'integrations': u'frappe', u'custom': u'frappe', u'printing': u'frappe', u'desk': u'frappe', u'geo': u'frappe', u'email': u'frappe'}

yaochang007 commented 7 years ago

Hi manassolanki,

does it mean I don't have u'Accounts' App? How should I fix?

manassolanki commented 7 years ago

Somehow, your module def isn't created properly while you are installing the erpnext. Do you reinstall erpnext or haven't completed setup wizard properly?

manassolanki commented 7 years ago

Hi @yaochang007 , Any lead over this?

yaochang007 commented 7 years ago

Hi manassolanki,

I use the simple installation method on github, all the setup is through the install.py script, and for configuration of the system, I just setup with minimum input.

manassolanki commented 7 years ago

@yaochang007 , Have you installed ERPNext on your site?

yaochang007 commented 7 years ago

Hi @manassolanki ,

Yes, I have installed. The IP Address is 188.166.227.10

manassolanki commented 7 years ago

Could you please cross check once whether "Module Def" doctype has all the ERPNext module?

yaochang007 commented 7 years ago

Hi @manassolanki

I have checked the module def, it got modules listed below:

image

yaochang007 commented 7 years ago

Hi @manassolanki ,

Sorry, the last message didn't show them all.

image

manassolanki commented 7 years ago

@yaochang007 , Could you comment the output from this command in the console print (frappe.get_all_apps(True)) print (frappe.get_module_list('erpnext'))

If you didn't get the module list as you have commented above then, please clear the cache using frappe.clear_cache() and then retry again it will work.

yaochang007 commented 7 years ago

@manassolanki ,

The result is as following:

In [1]: print (frappe.get_all_apps(True)) [u'frappe']

In [2]: print (frappe.get_module_list('erpnext')) [u'Accounts', u'CRM', u'Buying', u'Projects', u'Selling', u'Setup', u'HR', u'Manufacturing', u'Stock', u'Support', u'Utilities', u'Shopping Cart', u'Hub Node', u'Portal', u'Maintenance', u'Schools']

manassolanki commented 7 years ago

@yaochang007, The system is showing, you have installed only frappe app in your site. You must have deleted erpnext from apps.txt from your site manually or done some changes other changes manually which is causing this problem, please add erpnext in the app.txt or reinstall erpnext again. This will work fine then.

yaochang007 commented 7 years ago

@manassolanki ,

Great, now it works.

But now it got another problem: Executing frappe.patches.v8_0.set_currency_field_precision # 2017-05-09 in site1.local (1bd3e0294da19198) 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 "/home/john/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in main() File "/home/john/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main click.Group(commands=commands)(prog_name='bench') File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 716, in call return self.main(args, kwargs) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 534, in invoke return callback(args, kwargs) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), *args, *kwargs) File "/home/john/frappe-bench/apps/frappe/frappe/commands/init.py", line 24, in _func ret = f(frappe._dict(ctx.obj), args, kwargs) File "/home/john/frappe-bench/apps/frappe/frappe/commands/site.py", line 214, in migrate migrate(context.verbose, rebuild_website=rebuild_website) File "/home/john/frappe-bench/apps/frappe/frappe/migrate.py", line 31, in migrate frappe.modules.patch_handler.run_all() File "/home/john/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all if not run_single(patchmodule = patch): File "/home/john/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single return execute_patch(patchmodule, method, methodargs) File "/home/john/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 83, in execute_patch frappe.get_attr(patchmodule.split()[0] + ".execute")() File "/home/john/frappe-bench/apps/frappe/frappe/patches/v8_0/set_currency_field_precision.py", line 22, in execute ss.save() File "/home/john/frappe-bench/apps/frappe/frappe/model/document.py", line 230, in save return self._save(*args, kwargs) File "/home/john/frappe-bench/apps/frappe/frappe/model/document.py", line 263, in _save self.run_before_save_methods() File "/home/john/frappe-bench/apps/frappe/frappe/model/document.py", line 771, in run_before_save_methods self.run_method("validate") File "/home/john/frappe-bench/apps/frappe/frappe/model/document.py", line 666, in run_method out = Document.hook(fn)(self, *args, *kwargs) File "/home/john/frappe-bench/apps/frappe/frappe/model/document.py", line 891, in composer return composed(self, method, args, kwargs) File "/home/john/frappe-bench/apps/frappe/frappe/model/document.py", line 874, in runner add_to_return_value(self, fn(self, *args, kwargs)) File "/home/john/frappe-bench/apps/frappe/frappe/model/document.py", line 660, in fn = lambda self, *args, *kwargs: getattr(self, method)(args, kwargs) File "/home/john/frappe-bench/apps/frappe/frappe/core/doctype/system_settings/system_settings.py", line 16, in validate minimum_password_score = cint(self.minimum_password_score) or 0 AttributeError: 'SystemSettings' object has no attribute 'minimum_password_score'

How to fix this?

manassolanki commented 7 years ago

Please update frappe and erpnext and then run bench migrate For further resolution, you can create a discuss thread and we can continue there.

yaochang007 commented 7 years ago

@manassolanki ,

Just now I tried to do migrate, but it got another problem..

[john@Full-20170605-1gb-sgp1-01 frappe-bench]$ bench migrate Migrating site1.local Executing frappe.patches.v8_0.set_currency_field_precision # 2017-05-09 in site1.local (1bd3e0294da19198) Success Executing frappe.patches.v8_0.rename_print_to_printing in site1.local (1bd3e0294da19198) Success Executing frappe.patches.v8_0.update_desktop_icons in site1.local (1bd3e0294da19198) Success Executing erpnext.patches.v8_0.move_perpetual_inventory_setting in site1.local (1bd3e0294da19198) 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 "/home/john/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in main() File "/home/john/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main click.Group(commands=commands)(prog_name='bench') File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 716, in call return self.main(args, kwargs) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 534, in invoke return callback(args, kwargs) File "/home/john/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), *args, *kwargs) File "/home/john/frappe-bench/apps/frappe/frappe/commands/init.py", line 24, in _func ret = f(frappe._dict(ctx.obj), args, kwargs) File "/home/john/frappe-bench/apps/frappe/frappe/commands/site.py", line 214, in migrate migrate(context.verbose, rebuild_website=rebuild_website) File "/home/john/frappe-bench/apps/frappe/frappe/migrate.py", line 31, in migrate frappe.modules.patch_handler.run_all() File "/home/john/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all if not run_single(patchmodule = patch): File "/home/john/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single return execute_patch(patchmodule, method, methodargs) File "/home/john/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 83, in execute_patch frappe.get_attr(patchmodule.split()[0] + ".execute")() File "/home/john/frappe-bench/apps/erpnext/erpnext/patches/v8_0/move_perpetual_inventory_setting.py", line 8, in execute frappe.reload_doctype('Company') File "/home/john/frappe-bench/apps/frappe/frappe/init.py", line 651, in reload_doctype force=force, reset_permissions=reset_permissions) File "/home/john/frappe-bench/apps/frappe/frappe/init.py", line 663, in reload_doc return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions) File "/home/john/frappe-bench/apps/frappe/frappe/modules/utils.py", line 152, in reload_doc return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions) File "/home/john/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 19, in import_files reset_permissions=reset_permissions) File "/home/john/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 24, in import_file ret = import_file_by_path(path, force, pre_process=pre_process, reset_permissions=reset_permissions) File "/home/john/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 58, in import_file_by_path ignore_version=ignore_version, reset_permissions=reset_permissions) File "/home/john/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 129, in import_doc doc.insert() File "/home/john/frappe-bench/apps/frappe/frappe/model/document.py", line 219, in insert self.run_post_save_methods() File "/home/john/frappe-bench/apps/frappe/frappe/model/document.py", line 789, in run_post_save_methods self.run_method("on_update") File "/home/john/frappe-bench/apps/frappe/frappe/model/document.py", line 666, in run_method out = Document.hook(fn)(self, *args, kwargs) File "/home/john/frappe-bench/apps/frappe/frappe/model/document.py", line 891, in composer return composed(self, method, *args, *kwargs) File "/home/john/frappe-bench/apps/frappe/frappe/model/document.py", line 874, in runner add_to_return_value(self, fn(self, args, kwargs)) File "/home/john/frappe-bench/apps/frappe/frappe/model/document.py", line 660, in fn = lambda self, *args, *kwargs: getattr(self, method)(args, **kwargs) File "/home/john/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 208, in on_update self.run_module_method("on_doctype_update") File "/home/john/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 257, in run_module_method module = load_doctype_module(self.name, self.module) File "/home/john/frappe-bench/apps/frappe/frappe/modules/utils.py", line 184, in load_doctype_module raise ImportError, 'Module import failed for {0} ({1})'.format(doctype, module_name) ImportError: Module import failed for Company (erpnext.setup.doctype.company.company)

yaochang007 commented 7 years ago

@manassolanki .

I have created a new thread here.