erpnext icon indicating copy to clipboard operation
erpnext copied to clipboard

ERPNext 14 not working after bench update reset TypeError: 'str' object does not support item assignment

Open DmitryGreenLeaf opened this issue 2 years ago • 3 comments

Information about bug

ERPNext 14 not working after bench update reset TypeError: 'str' object does not support item assignment

Module

other

Version

Frappe version - 14.7.0 Erpnext version - 14.1.2

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

ubuntu@vps-f5abad2:~$ cd /home/ubuntu/frappe-bench/apps/frappe/
ubuntu@vps-f5abad2:~/frappe-bench/apps/frappe$ bench update --reset --no-backup
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/frappe
 * branch                  version-14 -> FETCH_HEAD
Updating apps source...
$ git fetch --depth=1 --no-tags upstream version-14
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/frappe
 * branch                  version-14 -> FETCH_HEAD
$ git reset --hard upstream/version-14
HEAD is now at 6fe86b467c chore(release): Bumped to Version 14.7.0
$ git reflog expire --all
$ git gc --prune=all
Enumerating objects: 325904, done.
Counting objects: 100% (325904/325904), done.
Delta compression using up to 2 threads
Compressing objects: 100% (70737/70737), done.
Writing objects: 100% (325904/325904), done.
Total 325904 (delta 253564), reused 325904 (delta 253564), pack-reused 0
Checking connectivity: 325904, done.
$ find . -name "*.pyc" -delete
$ git fetch --depth=1 --no-tags upstream version-14
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/erpnext
 * branch            version-14 -> FETCH_HEAD
$ git reset --hard upstream/version-14
HEAD is now at 14e5f23 chore(release): Bumped to Version 14.1.2
$ git reflog expire --all
$ git gc --prune=all
Enumerating objects: 5061, done.
Counting objects: 100% (5061/5061), done.
Delta compression using up to 2 threads
Compressing objects: 100% (3680/3680), done.
Writing objects: 100% (5061/5061), done.
Total 5061 (delta 1150), reused 5061 (delta 1150), pack-reused 0
$ find . -name "*.pyc" -delete
$ git fetch --depth=1 --no-tags upstream develop
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/payments
 * branch            develop    -> FETCH_HEAD
$ git reset --hard upstream/develop
HEAD is now at 8637be4 Merge pull request #3 from phot0n/add-linter
$ git reflog expire --all
$ git gc --prune=all
Enumerating objects: 84, done.
Counting objects: 100% (84/84), done.
Delta compression using up to 2 threads
Compressing objects: 100% (66/66), done.
Writing objects: 100% (84/84), done.
Total 84 (delta 12), reused 84 (delta 12), pack-reused 0
$ find . -name "*.pyc" -delete
Setting up requirements...
$ /home/ubuntu/frappe-bench/env/bin/python -m pip install --quiet --upgrade pip
Installing 3 applications...
Installing frappe
$ /home/ubuntu/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/ubuntu/frappe-bench/apps/frappe
$ yarn install
yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 0.48s.
Installing erpnext
$ /home/ubuntu/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/ubuntu/frappe-bench/apps/erpnext
$ yarn install
yarn install v1.22.19
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.11s.
Installing payments
$ /home/ubuntu/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/ubuntu/frappe-bench/apps/payments
Patching sites...
Migrating erp.greenleafpacific.com
Updating DocTypes for frappe        : [========================================] 100%
Updating DocTypes for erpnext       : [========================================] 100%
Executing erpnext.patches.v14_0.migrate_existing_lead_notes_as_per_the_new_format in erp.greenlafpacific.com (_03f9d53928a8e321)
Updating Dashboard for frappe
Updating Dashboard for erpnext
Updating customizations for Address
Updating customizations for Contact
Building search index for erp.greenlafpacific.com
Retrieving Routes                   : [========================================] 100%
Building Index                      : [========================================] 100%
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 109, in <module>
    main()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/site.py", line 549, in migrate
    SiteMigration(
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py", line 172, in run
    self.run_schema_updates()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py", line 40, in wrapper
    ret = method(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py", line 113, in run_schema_updates
    frappe.modules.patch_handler.run_all(
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 75, in run_all
    run_patch(patch)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 62, in run_patch
    if not run_single(patchmodule=patch):
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 150, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 185, in execute_patch
    _patch()
  File "/home/ubuntu/frappe-bench/apps/erpnext/erpnext/patches/v14_0/migrate_existing_lead_notes_as_per_the_new_format.py", line 19, in execute
    doc = frappe.get_doc(doctype, d.name)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 1190, in get_doc
    doc = frappe.model.document.get_doc(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 74, in get_doc
    return controller(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py", line 80, in __init__
    super(AccountsController, self).__init__(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 106, in __init__
    self.load_from_db()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 152, in load_from_db
    super().__init__(d)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 109, in __init__
    self.update(d)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 156, in update
    self.set(key, value)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 208, in set
    self.extend(key, value)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 249, in extend
    self.append(key, v)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 234, in append
    value = self._init_child(value, key)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 262, in _init_child
    value["doctype"] = doctype
TypeError: 'str' object does not support item assignment
ubuntu@vps-f5abad2:~/frappe-bench/apps/frappe$

DmitryGreenLeaf avatar Sep 18 '22 22:09 DmitryGreenLeaf

#32243

ossplus avatar Sep 19 '22 11:09 ossplus

#32163

littlebunyip avatar Sep 19 '22 19:09 littlebunyip

You can edit the following file: nano /home/ubuntu/frappe-bench/apps/erpnext/erpnext/patches/v14_0/migrate_existing_lead_notes_as_per_the_new_format.py Change line 19 to : doc = frappe.get_doc({"doctype":doctype, "name":d.name})

Then do bench merge step. bench --site yoursitename migrate

ossplus avatar Sep 21 '22 14:09 ossplus

fixed with https://github.com/frappe/frappe/pull/18032

ankush avatar Oct 06 '22 13:10 ankush