Try ERPNext Buy Support Partners Foundation

Fresh erpnext v12 server, Restore Backup from V10

Dear Members,

Please can some guide if its possible to restore backup from v10 to v12?

if yes, please share the steps?

TIA
Hitesh

You can restore the database to your new v12 site and run bench migrate. It’ll run all patches and update your doctypes.

1 Like

Thank you @scmmishra. I will try it to move my V10 production server to V12.

Thanks @scmmishra

I tried to migrate but this is what i got.

Success: Done in 0.339s
Executing erpnext.patches.v11_0.add_permissions_in_gst_settings #2020-04-04 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 239, in migrate
migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 48, in migrate
frappe.modules.patch_handler.run_all(skip_failing)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 41, in run_all
run_patch(patch)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 30, in run_patch
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 71, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 91, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v11_0/add_permissions_in_gst_settings.py”, line 9, in execute
add_permissions()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/india/setup.py”, line 81, in add_permissions
add_permission(doctype, ‘All’, 0)
File “/home/frappe/frappe-bench/apps/frappe/frappe/permissions.py”, line 494, in add_permission
validate_permissions_for_doctype(doctype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 988, in validate_permissions_for_doctype
doctype = frappe.get_doc(“DocType”, doctype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 753, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 71, in get_doc
return controller(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 106, in init
self.load_from_db()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 149, 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 377, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 356, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 316, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.DoesNotExistError: DocType GSTR 3B Report not found

Any pointers are appreciated.

Thanks
Hitesh

You cannot skip the specific patch add_permissions_in_gst_settings you can just add a return statement in the function. It, only applies permission. It can be run later.

P.S. Don’t forget to remove the changes after you are done

Hello @scmmishra,

Thanks for your tip.

Its possible for you to provide low level steps desired here.

TIA
Hitesh

@scmmishra if i skip the patch it works fine.

Could you please guide on where to add a return function?

more add_permissions_in_gst_settings.py
import frappe
from erpnext.regional.india.setup import add_permissions

def execute():
    company = frappe.get_all('Company', filters = {'country': 'India'})
    if not company:
            return

    add_permissions()

Please advise.

TIA
Hitesh

Skipped the patch and did the bench migrate and found no issues.

Later uncommented the patch and rerun migrate no issues faced.

frappe@ip-172-26-3-140:~/frappe-bench$ bench migrate
Migrating site1.local
Executing erpnext.patches.v11_0.add_permissions_in_gst_settings #2020-04-04 in site1.local (_1bd3e0294da19198)
Success: Done in 1.299s
Updating DocTypes for frappe        : [========================================]
Updating DocTypes for erpnext       : [========================================]
Updating customizations for Address
Generating Website Theme Files...
Compiling Python Files...
frappe@ip-172-26-3-140:~/frappe-bench$
frappe@ip-172-26-3-140:~/frappe-bench$

frappe@ip-172-26-3-140:~/frappe-bench$ bench update --patch
Backing up sites...
Patching sites...
Migrating site1.local
Updating DocTypes for frappe        : [========================================]
Updating DocTypes for erpnext       : [========================================]
Updating customizations for Address
Generating Website Theme Files...
Compiling Python Files...
$ sudo supervisorctl restart frappe-bench-workers: frappe-bench-web:
frappe-bench-workers:frappe-bench-frappe-schedule: stopped
frappe-bench-workers:frappe-bench-frappe-default-worker-0: stopped
frappe-bench-workers:frappe-bench-frappe-long-worker-0: stopped
frappe-bench-workers:frappe-bench-frappe-short-worker-0: stopped
frappe-bench-web:frappe-bench-node-socketio: stopped
frappe-bench-web:frappe-bench-frappe-web: stopped
frappe-bench-workers:frappe-bench-frappe-schedule: started
frappe-bench-workers:frappe-bench-frappe-default-worker-0: started
frappe-bench-workers:frappe-bench-frappe-long-worker-0: started
frappe-bench-workers:frappe-bench-frappe-short-worker-0: started
frappe-bench-web:frappe-bench-frappe-web: started
frappe-bench-web:frappe-bench-node-socketio: started
________________________________________________________________________________
Bench: Deployment tool for Frappe and Frappe Applications (https://frappe.io/bench).
Open source depends on your contributions, so please contribute bug reports, patches, fixes or cash and be a part of the community

Can we deem that the Backup restore from V10 to v12 is successful?

TIA
Hitesh