Try ERPNext Buy Support Partners Foundation

Update of ERPNEXT version 11 to Version 12

Hi,

Currently am running this version:

ERPNext: v11.1.44 (master)

Frappe Framework: v11.1.39 (master)

When i run this command (“bench switch-to-branch v12 erpnext”) to update my erpnext instance form v11 to v12, it finishes and gives me this output:

Branch v12 does not exist in Upstream for erpnext
Switched to v12
Please run bench update --patch to be safe from any differences in database schema

After running the “bench update --patch” i get this output:

Backing up sites…
Patching sites…
Migrating site1.local
Updating DocTypes for frappe : [========================================]
Updating DocTypes for erpnext : [========================================]
INFO:bench.utils: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 ERPNext (https://erpnext.org).
Open source depends on your contributions, so please contribute bug reports, patches, fixes or cash and be a part of the community

I am not sure if the update from v11 to v12 is sucessfull as there are no errors.Also if i log in to the site on my browser i can see the version is still as follows and not v12:

ERPNext: v11.1.44 (master)

Frappe Framework: v11.1.39 (master)

Am i missing a step or something? Kindly assist.Am running ERP NEXT on production.

In the message below lies the secret. Your current system has no knowledge of version 12.

Read the various experiences here, especially around the git update of your local system to sync with the git repository.

Since the v11/v12 changes, ERPNext upgrades quite weirdly - gives a bunch of messages which loop on themselves

   #To fix... (thanks to @lasalesi who posted about this on the ERPNext forum)
      #The default .git "config" file has a section...
      [remote "upstream"]
              fetch = +refs/heads/master:refs/remotes/upstream/master
      #"master" needs to become "*" #all occurrences, NB!: without the quotes
      [remote "upstream"]
              fetch = +refs/heads/*:refs/remotes/upstream/*
#Edit the file: apps > erpnext> .git > config :
   `nano ~/frappe-bench/apps/erpnext/.git/config`
      [remote "upstream"]
          url = https://github.com/frappe/erpnext
          fetch = +refs/heads/*:refs/remotes/upstream/*
#   OR   #
sed -i.bak 's/\/master/\/*/g' ~/frappe-bench/apps/erpnext/.git/config   #replace /master with /* (copy the original file to *.bak)
#IF you want v12, then run....
bench switch-to-branch version-12 frappe erpnext --upgrade    #make sure you switch BOTH! (frappe erpnext)
bench update --patch #not generally a requirement, but I prefer to run it anyway
1 Like

Let me try edit the git config file and i rerun the upgrade i see

@trentmu This worked great am now on version 12.Thanks alot.Is that how the updates will be rolled out on the other higher versions to come?

ERPNext: v12.1.6 (version-12)

Frappe Framework: v12.0.16 (version-12)

I am not sure about the future options, but this method should work

I tried this but doesn’t work…

Installed Apps

ERPNext: v11.1.49 (master)

Frappe Framework: v12.0.16 (version-12)

If you ran either this…
bench switch-to-branch version-12 frappe --upgrade without the “erpnext” included,
or
if you have quotes in the .git/config file
"fetch = +refs/heads/*:refs/remotes/upstream/*"
then it is likely to cause the mismatch

Hello… I tried

bench switch-to-branch version-12 frappe --upgrade without the “erpnext” included

But still no luck…

This is the response on the above command:

fatal: Invalid refspec '+refs/heads/:refs/remotes/upstream/'
Switching for frappe
INFO:bench.utils:git config --unset-all remote.upstream.fetch
INFO:bench.utils:git config --add remote.upstream.fetch '+refs/heads/*:refs/remo                             tes/upstream/*'
INFO:bench.utils:git fetch upstream
remote: Enumerating objects: 58, done.
remote: Counting objects: 100% (58/58), done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 60 (delta 36), reused 41 (delta 26), pack-reused 2
Unpacking objects: 100% (60/60), done.
From https://github.com/frappe/frappe
   5bed56b15..c7a04add3  develop    -> upstream/develop
INFO:bench.utils:git checkout version-12
Switched to branch 'version-12'
Your branch is up to date with 'upstream/version-12'.
INFO:bench.utils:git merge upstream/version-12
Already up to date.
Successfully switched branches for:
frappe
Switched to version-12
Please run `bench update --patch` to be safe from any differences in database sc                             hema

Below is my config file:

[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
	[remote "upstream"]
	          url = https://github.com/frappe/erpnext
	          fetch = +refs/heads/*:refs/remotes/upstream/*
[branch "master"]
	remote = upstream
	merge = refs/heads/master

The installed apps still showing:

Installed Apps

ERPNext: v11.1.67 (version-11)

Frappe Framework: v12.0.16 (version-12)

When i tried bench update

resulting the below:

INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up to date.
INFO:bench.utils:./env/bin/pip install Pillow
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages (6.1.0)


Cannot proceed with update: You have local changes in app "erpnext" that are not committed.

Here are your choices:

1. Merge the erpnext app manually with "git pull" / "git pull --rebase" and fix conflicts.
1. Temporarily remove your changes with "git stash" or discard them completely
        with "bench update --reset" or for individual repositries "git reset --hard"
2. If your changes are helpful for others, send in a pull request via GitHub and
        wait for them to be merged in the core.
root@spg-erp-v1:/home/frappe/frappe-bench#

Is this related with my pyhthon version which is Python 2.7.15+?

This one… I could not understand how to do it…

@cyberdee Hi the steps are easy.Do the following:

Step 1. Locate your .git/config file then edit this line from

[remote “upstream”]
fetch = +refs/heads/master:refs/remotes/upstream/master

             to become:

 
  [remote "upstream"]
          fetch = +refs/heads/*:refs/remotes/upstream/*

Step 2. Also locate this config file : /frappe-bench/apps/erpnext/.git/config then edit the following line to be as follows

  [remote "upstream"]
      url = https://github.com/frappe/erpnext
      fetch = +refs/heads/*:refs/remotes/upstream/*

Step 3: then run this command as non root user, preferably frappe user on this directory (…/frappe-bench):

bench switch-to-branch version-12 frappe erpnext --upgrade

Step 4: run this command (But not necessary):

bench update --patch

5 Likes

Hi after doing this got the following error. Pls clarify.
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote “upstream”]
url = https://github.com/frappe/erpnext
fetch = +refs/heads/:refs/remotes/upstream/
[branch “version-12”]
remote = upstream
merge = refs/heads/version-12

frappe@ubuntu1604:~/frappe-bench$ bench update --patch
Backing up sites...
Patching sites...
Migrating site1.local
Executing execute:frappe.reload_doc("HR", "doctype", "HR Settings") #2020-01-16 in site1.local (1bd3e0294da19198)
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/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 <module>
    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.5/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python3.5/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.5/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.5/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.5/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 81, in execute_patch
    exec(patchmodule.split("execute:")[1],globals())
  File "<string>", line 1, in <module>
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 799, in reload_doc
    return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/utils.py", line 160, in reload_doc
    return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 26, in import_files
    reset_permissions=reset_permissions)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 31, in import_file
    ret = import_file_by_path(path, force, pre_process=pre_process, reset_permissions=reset_permissions)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 65, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 100, in import_doc
    doc = frappe.get_doc(docdict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 734, in get_doc
    doc = frappe.model.document.get_doc(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 69, in get_doc
    return controller(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 113, in __init__
    super(Document, self).__init__(kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 54, in __init__
    self.update(d)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 77, in update
    self.set(key, value)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 124, in set
    self.extend(key, value)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 161, in extend
    self.append(key, v)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 155, in append
    self.name, str(type(value))[1:-1], value)
ValueError: Document for field "field_order" attached to child table of "HR Settings" must be a dict or BaseDocument, not class 'str' (employee_settings)
frappe@ubuntu1604:~/frappe-bench$