Is possible to import old database of erpnext v10 into newest erpnext version?

Hello everyone, I tried to import old database of erpnext v10 into newest erpnext version but no success. I follow 2 commands following to do that:

bench --force --site sitename restore /path/to/old/database
bench --force --site sitename migrate

Everything was ok when i have completed the first command. But after doing the second, error has ocurred:

Executing frappe.patches.v12_0.remove_deprecated_fields_from_doctype #3 in (_831804db5b8606b0)
Success: Done in 0.566s
Executing execute:frappe.reload_doc('core', 'doctype', 'comment') in (_831804db5b8606b0)
Success: Done in 0.172s
Executing execute:frappe.reload_doc('email', 'doctype', 'document_follow') in (_831804db5b8606b0)
Success: Done in 0.121s
Executing execute:frappe.reload_doc('core', 'doctype', 'communication_link') in (_831804db5b8606b0)
Success: Done in 0.125s
Executing execute:frappe.reload_doc('core', 'doctype', 'communication') in (_831804db5b8606b0)
Success: Done in 0.51s
Executing frappe.patches.v11_0.reload_and_rename_view_log #2019-01-03 in (_831804db5b8606b0)
Success: Done in 0.319s
Executing frappe.patches.v11_0.change_email_signature_fieldtype in (_831804db5b8606b0)
Success: Done in 0.577s
Executing frappe.patches.v11_0.rename_google_maps_doctype in (_831804db5b8606b0)
Success: Done in 1.565s
Executing frappe.patches.v10_0.modify_smallest_currency_fraction in (_831804db5b8606b0)
Success: Done in 0.024s
Executing frappe.patches.v10_0.modify_naming_series_table in (_831804db5b8606b0)
Success: Done in 0.036s
Executing frappe.patches.v10_0.enhance_security in (_831804db5b8606b0)
Traceback (most recent call last):
  File "/usr/lib/python2.7/", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/", line 72, in _run_code
    exec code in run_globals
  File "/opt/frappe-erpnext/apps/frappe/frappe/utils/", line 97, in <module>
  File "/opt/frappe-erpnext/apps/frappe/frappe/utils/", line 18, in main
  File "/opt/frappe-erpnext/.local/lib/python2.7/site-packages/click/", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/opt/frappe-erpnext/.local/lib/python2.7/site-packages/click/", line 717, in main
    rv = self.invoke(ctx)
  File "/opt/frappe-erpnext/.local/lib/python2.7/site-packages/click/", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/frappe-erpnext/.local/lib/python2.7/site-packages/click/", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/frappe-erpnext/.local/lib/python2.7/site-packages/click/", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/frappe-erpnext/.local/lib/python2.7/site-packages/click/", line 555, in invoke
    return callback(*args, **kwargs)
  File "/opt/frappe-erpnext/.local/lib/python2.7/site-packages/click/", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/opt/frappe-erpnext/apps/frappe/frappe/commands/", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/opt/frappe-erpnext/apps/frappe/frappe/commands/", line 229, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/opt/frappe-erpnext/apps/frappe/frappe/", line 48, in migrate
  File "/opt/frappe-erpnext/apps/frappe/frappe/modules/", line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/opt/frappe-erpnext/apps/frappe/frappe/modules/", line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/opt/frappe-erpnext/apps/frappe/frappe/modules/", line 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/opt/frappe-erpnext/apps/frappe/frappe/patches/v10_0/", line 34, in execute
  File "/opt/frappe-erpnext/apps/frappe/frappe/model/", line 271, in save
    return self._save(*args, **kwargs)
  File "/opt/frappe-erpnext/apps/frappe/frappe/model/", line 307, in _save
  File "/opt/frappe-erpnext/apps/frappe/frappe/model/", line 886, in run_before_save_methods
  File "/opt/frappe-erpnext/apps/frappe/frappe/model/", line 786, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/opt/frappe-erpnext/apps/frappe/frappe/model/", line 1055, in composer
    return composed(self, method, *args, **kwargs)
  File "/opt/frappe-erpnext/apps/frappe/frappe/model/", line 1038, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/opt/frappe-erpnext/apps/frappe/frappe/model/", line 780, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/opt/frappe-erpnext/apps/frappe/frappe/core/doctype/system_settings/", line 39, in validate
    if (self.force_user_to_reset_password and
AttributeError: 'SystemSettings' object has no attribute 'force_user_to_reset_password'

Please tell me the solution to resolve that. Thank you.

1. reload the doctype system settings
bench  --site sitename console
frappe.reload_doc('core', 'doctype', 'system_settings')

2. run migrate again
bench  --site sitename migrate

1 Like

I did the first command, but it had the following error:

In [1]: frappe.reload_doc('core', 'doctype', 'system_settings')
ImportError                               Traceback (most recent call last)
/opt/frappe-erpnext/apps/frappe/frappe/commands/utils.pyc in <module>()
----> 1 frappe.reload_doc('core', 'doctype', 'system_settings')

/opt/frappe-erpnext/apps/frappe/frappe/__init__.pyc in reload_doc(module, dt, dn, force, reset_permissions)
    794         import frappe.modules
--> 795         return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
    797 def rename_doc(*args, **kwargs):

/opt/frappe-erpnext/apps/frappe/frappe/modules/utils.pyc in reload_doc(module, dt, dn, force, reset_permissions)
    172 def reload_doc(module, dt=None, dn=None, force=False, reset_permissions=False):
    173         from frappe.modules.import_file import import_files
--> 174         return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
    176 def export_doc(doctype, name, module=None):

/opt/frappe-erpnext/apps/frappe/frappe/modules/import_file.pyc in import_files(module, dt, dn, force, pre_process, reset_permissions)
     25         else:
     26 		return import_file(module, dt, dn, force=force, pre_process=pre_process,
---> 27 			reset_permissions=reset_permissions)
     29 def import_file(module, dt, dn, force=False, pre_process=None, reset_permissions=False):

/opt/frappe-erpnext/apps/frappe/frappe/modules/import_file.pyc in import_file(module, dt, dn, force, pre_process, reset_permissions)
     30         """Sync a file from txt if modifed, return false if not updated"""
     31         path = get_file_path(module, dt, dn)
---> 32         ret = import_file_by_path(path, force, pre_process=pre_process, reset_permissions=reset_permissions)
     33         return ret

/opt/frappe-erpnext/apps/frappe/frappe/modules/import_file.pyc in import_file_by_path(path, force, data_import, pre_process, ignore_version, reset_permissions, for_sync)
     64                         frappe.flags.in_import = True
     65 			import_doc(doc, force=force, data_import=data_import, pre_process=pre_process,
---> 66 				ignore_version=ignore_version, reset_permissions=reset_permissions)
     67                         frappe.flags.in_import = False

/opt/frappe-erpnext/apps/frappe/frappe/modules/import_file.pyc in import_doc(docdict, force, data_import, pre_process, ignore_version, reset_permissions)
    139                 doc.flags.ignore_mandatory = True
--> 141         doc.insert()
    143         frappe.flags.in_import = False

/opt/frappe-erpnext/apps/frappe/frappe/model/document.pyc in insert(self, ignore_permissions, ignore_links, ignore_if_duplicate, ignore_mandatory)
    256                         self.copy_attachments_from_amended_from()
--> 258                 self.run_post_save_methods()
    259                 self.flags.in_insert = False

/opt/frappe-erpnext/apps/frappe/frappe/model/document.pyc in run_post_save_methods(self)
    925                         self.run_method("on_update_after_submit")
--> 927                 self.run_method('on_change')
    929                 self.clear_cache()

/opt/frappe-erpnext/apps/frappe/frappe/model/document.pyc in run_method(self, method, *args, **kwargs)
    785                 fn.__name__ = str(method)
--> 786                 out = Document.hook(fn)(self, *args, **kwargs)
    788                 self.run_notifications(method)

/opt/frappe-erpnext/apps/frappe/frappe/model/document.pyc in composer(self, *args, **kwargs)
   1054                         composed = compose(f, *hooks)
-> 1055                         return composed(self, method, *args, **kwargs)
   1057                 return composer

/opt/frappe-erpnext/apps/frappe/frappe/model/document.pyc in runner(self, method, *args, **kwargs)
   1038                                 add_to_return_value(self, fn(self, *args, **kwargs))
   1039                                 for f in hooks:
-> 1040                                         add_to_return_value(self, f(self, method, *args, **kwargs))
   1042                                 return self._return_value

/opt/frappe-erpnext/apps/frappe/frappe/social/doctype/energy_point_rule/energy_point_rule.pyc in process_energy_points(doc, state)
     49 	if (frappe.flags.in_patch
     50                 or frappe.flags.in_install
---> 51 		or not is_energy_point_enabled()):
     52                 return

/opt/frappe-erpnext/apps/frappe/frappe/social/doctype/energy_point_settings/energy_point_settings.pyc in is_energy_point_enabled()
     14 def is_energy_point_enabled():
---> 15         return frappe.get_cached_value('Energy Point Settings', None, 'enabled')
     17 def allocate_review_points():

/opt/frappe-erpnext/apps/frappe/frappe/__init__.pyc in get_cached_value(doctype, name, fieldname, as_dict)
    701 def get_cached_value(doctype, name, fieldname, as_dict=False):
--> 702         doc = get_cached_doc(doctype, name)
    703         if isinstance(fieldname, string_types):
    704                 if as_dict:

/opt/frappe-erpnext/apps/frappe/frappe/__init__.pyc in get_cached_doc(*args, **kwargs)
    686         # database
--> 687         doc = get_doc(*args, **kwargs)
    689         return doc

/opt/frappe-erpnext/apps/frappe/frappe/__init__.pyc in get_doc(*args, **kwargs)
    728 	"""
    729         import frappe.model.document
--> 730         doc = frappe.model.document.get_doc(*args, **kwargs)
    732         # set in cache

/opt/frappe-erpnext/apps/frappe/frappe/model/document.pyc in get_doc(*args, **kwargs)
     65                         raise ValueError('"doctype" is a required key')
---> 67         controller = get_controller(doctype)
     68         if controller:
     69                 return controller(*args, **kwargs)

/opt/frappe-erpnext/apps/frappe/frappe/model/base_document.pyc in get_controller(doctype)
     40                         _class = Document
     41                 else:
---> 42                         module = load_doctype_module(doctype, module_name)
     43                         classname = doctype.replace(" ", "").replace("-", "")
     44                         if hasattr(module, classname):

/opt/frappe-erpnext/apps/frappe/frappe/modules/utils.pyc in load_doctype_module(doctype, module, prefix, suffix)
    204                         doctype_python_modules[key] = frappe.get_module(module_name)
    205         except ImportError as e:
--> 206                 raise ImportError('Module import failed for {0} ({1})'.format(doctype, module_name + ' Error: ' + str(e)))
    208         return doctype_python_modules[key]

ImportError: Module import failed for Energy Point Settings (frappe.core.doctype.energy_point_settings.energy_point_settings Error: No module named energy_point_settings.energy_point_settings)

In [2]:

Thank you for your reply

Why not install a v10 setup, import the data, and then upgrade/migrate?

Ya, I thought it before and i tried to do it. But no success. I couldn’t install certain erpnext version i want and there some errors during installation. have you do it? Can you please tell me the instruction about this? Thank you.

You can specify erpnext v10.x.x in the easy install script, or you can modify your existing install by using the v10.x.x in the bench update lines.
See this post

1 Like

after doing

sudo python --production --user frappe --frappe-branch v11.x.x-develop --erpnext-branch v10.x.x

i had issuer below

TASK [bench : Create a new site] *****************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["bench", "new-site", "site1.local", "--admin-password", "fiisoft", "--mariadb-root-password", "lengoccan"], "delta": "0:00:00.273003", "end": "2019-06-17 12:10:55.433119", "msg": "non-zero return code", "rc": 2, "start": "2019-06-17 12:10:55.160116", "stderr": "Usage: bench [OPTIONS] COMMAND [ARGS]...\nTry \"bench --help\" for help.\n\nError: No such command \"new-site\".", "stderr_lines": ["Usage: bench [OPTIONS] COMMAND [ARGS]...", "Try \"bench --help\" for help.", "", "Error: No such command \"new-site\"."], "stdout": "", "stdout_lines": []}

PLAY RECAP ***************************************************************************************
localhost                  : ok=50   changed=9    unreachable=0    failed=1    skipped=71   rescued=0    ignored=0

Traceback (most recent call last):
  File "", line 432, in <module>
  File "", line 128, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "", line 344, in run_playbook
    success = subprocess.check_call(args, cwd=os.path.join(cwd, 'playbooks'))
  File "/usr/lib/python2.7/", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-e', '@/tmp/extra_vars.json', '--become', '--become-user=frappe']' returned non-zero exit status 2

Why have you chosen v10 for erpnext and v11-dev for frappe?
It would be better to use v10-production for both in your initial setup to import the data, and then consider migrating to v11 once you have it working with your old data/restore

Ya. I tried both, but it has same issue above

Does anyone can help me resolve? I tried to fix this error so much, But there was no progress. Thank you.