Try ERPNext Buy Support Partners Foundation

HELP! Cannot access site after v11 update from v10

I get this error running bench update --patch. can anyone help solve this? I also used bench update --reset to upgrade.

erpnext@erpnext-VirtualBox:/home/frappe/frappe-bench$ sudo bench update --patch
[sudo] password for erpnext: 
Backing up sites...
Patching sites...
Migrating site1.local
Executing erpnext.patches.v10_0.repost_gle_for_purchase_receipts_with_rejected_items in site1.local (1bd3e0294da19198)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in 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/local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/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 38, 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 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v10_0/repost_gle_for_purchase_receipts_with_rejected_items.py", line 27, in execute
    doc.make_gl_entries_on_cancel(repost_future_gle=False)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py", line 278, in make_gl_entries_on_cancel
    self.make_gl_entries(repost_future_gle=repost_future_gle)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py", line 26, in make_gl_entries
    delete_gl_entries(voucher_type=self.doctype, voucher_no=self.name)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/general_ledger.py", line 208, in delete_gl_entries
    validate_expense_against_budget(entry)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/budget/budget.py", line 137, in validate_expense_against_budget
    (args.fiscal_year, args.account), as_dict=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 199, in sql
    self._cursor.execute(query, values)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py", line 170, in execute
    result = self._query(query)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py", line 328, in _query
    conn.query(q)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 516, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 727, in _read_query_result
    result.read()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 1066, in read
    first_packet = self.connection._read_packet()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 683, in _read_packet
    packet.check_error()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/protocol.py", line 220, in check_error
    err.raise_mysql_exception(self._data)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.InternalError: (1054, u"Unknown column 'b.applicable_on_material_request' in 'field list'")

Try this:

bench execute frappe.reload_doc --args "['accounts','doctype','budget',1]"
1 Like

If the reload doesn’t work, you can try to exclude that patch temporarily and get the DB in sync like so…

sed -i “s/repost_gle_for_purchase_receipts_with_rejected_items/#repost_gle_for_purchase_receipts_with_rejected_items/” /home/frappe/frappe-bench/apps/erpnext/erpnext/patches.txt
bench --site site1.local migrate

and then you can try the update again

bench update

Tried it. Same issue.

There’s no reason why that should fail. Least you’d get is a different error.
Basically, reload_doc updates the database as per budget.json.
So unless your budget.json is modified, you must have that missing column in your DB now.

Latest bench update since trying solutions.

 yarn install v1.10.1
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "rollup-plugin-vue > @vue/component-compiler@3.4.4" has unmet peer dependency "postcss@>=6.0".
[4/4] Building fresh packages...
Done in 9.66s.
Backing up sites...
Patching sites...
Migrating site1.local
Executing erpnext.patches.v10_0.repost_gle_for_purchase_receipts_with_rejected_items in site1.local (1bd3e0294da19198)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in 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/local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/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 38, 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 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v10_0/repost_gle_for_purchase_receipts_with_rejected_items.py", line 32, in execute
    doc.make_gl_entries(repost_future_gle=False)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py", line 33, in make_gl_entries
    gl_entries = self.get_gl_entries(warehouse_account)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py", line 261, in get_gl_entries
    self.get_asset_gl_entry(gl_entries)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py", line 317, in get_asset_gl_entry
    if d.is_fixed_asset:
AttributeError: 'PurchaseReceiptItem' object has no attribute 'is_fixed_asset'

You can follow the similar pattern as above:

bench execute frappe.reload_doc --args "['stock','doctype','purchase_receipt_item',1]"

Can you also post the output of current version (bench version) here?

the output from that line of code is True.
bench version out:
erpnext 11.1.3
foundation 0.0.1
frappe 11.1.3

Were you able to solve this problem? @airzoink I’m facing the same issue and the solutions given here are not helping…

What i did in the end was installed a fresh V11 then restored backup from my V10.