Upgrade from v12 to v13 failed

The process of bench switch-to-branch version-13 frappe erpnext --upgrade failed with following error messages.

Executing erpnext.patches.v13_0.update_pos_closing_entry_in_merge_log in erpnext.net-swift.com (_ddbd5adc132c5c7f)
Success: Done in 0.114s
Executing erpnext.patches.v13_0.add_po_to_global_search in erpnext.net-swift.com (_ddbd5adc132c5c7f)
Success: Done in 1.227s
Executing erpnext.patches.v13_0.update_returned_qty_in_pr_dn in erpnext.net-swift.com (_ddbd5adc132c5c7f)
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/adminuser/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 101, in <module>
    main()
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/adminuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/adminuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/adminuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/adminuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/adminuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/adminuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/adminuser/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 27, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/commands/site.py", line 301, in migrate
    skip_search_index=skip_search_index
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/migrate.py", line 67, in migrate
    frappe.modules.patch_handler.run_all(skip_failing)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 41, in run_all
    run_patch(patch)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 30, in run_patch
    if not run_single(patchmodule = patch):
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 71, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 91, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/adminuser/frappe-bench/apps/erpnext/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py", line 27, in execute
    update_from_return_docs(doctype)
  File "/home/adminuser/frappe-bench/apps/erpnext/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py", line 17, in update_from_return_docs
    return_doc.update_prevdoc_status()
  File "/home/adminuser/frappe-bench/apps/erpnext/erpnext/controllers/status_updater.py", line 116, in update_prevdoc_status
    self.validate_qty()
  File "/home/adminuser/frappe-bench/apps/erpnext/erpnext/controllers/status_updater.py", line 192, in validate_qty
    self.check_overflow_with_allowance(item, args)
  File "/home/adminuser/frappe-bench/apps/erpnext/erpnext/controllers/status_updater.py", line 205, in check_overflow_with_allowance
    role_allowed_to_over_deliver_receive = frappe.db.get_single_value('Stock Settings', 'role_allowed_to_over_deliver_receive')
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/database/database.py", line 566, in get_single_value
    frappe.throw(_('Invalid field name: {0}').format(frappe.bold(fieldname)), self.InvalidColumnName)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/__init__.py", line 433, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/__init__.py", line 412, in msgprint
    _raise_exception()
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/__init__.py", line 366, in _raise_exception
    raise raise_exception(msg)
frappe.database.database.InvalidColumnName: Invalid field name: <b>role_allowed_to_over_deliver_receive</b>

Please help.
current verson
frappe: 12.16.3
erpnext: 12.19.0

Thanks.

Are you switching from develop branch of V12?

it is from production version not dev.
And during the upgrade process, I saw those messages.
Installing frappe

$ ./env/bin/python -m pip install -q -U -e ./apps/frappe

ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

frontmatter 3.0.5 requires PyYAML==3.13, but you have pyyaml 5.4.1 which is incompatible.

erpnext 12.19.0 requires braintree==3.57.1, but you have braintree 4.8.0 which is incompatible.

erpnext 12.19.0 requires googlemaps==3.1.1, but you have googlemaps 4.4.5 which is incompatible.

erpnext 12.19.0 requires pycryptodome==3.9.8, but you have pycryptodome 3.10.1 which is incompatible.

Not sure if they have any relation with my problem.

versions of each components
bench: 5.4.0
yarn: 1.22.10
npm: 7.13.0
pip: 21.1.1
nodejs: 10.24.1

Thanks.

Try bench setup requirements

Issue with this patch. Try commenting that patch out.

Or try:
bench migrate --skip-failing
Then bench update --patch

How do we comment out the patch?

Hi All

I can continue with command bench migrate --skip-failing
after that finished, I tried with bench update --patch again, the issue come.

adminuser@tc-erpnext-2:~/frappe-bench$ bench update --patch
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/frappe
 * branch                  version-13 -> FETCH_HEAD
Backing up sites...
Backup Summary for erpnext.net-swift.com at 2021-05-16 06:34:39.659324
Config  : ./erpnext.net-swift.com/private/backups/20210516_063432-erpnext_net-swift_com-site_config_backup.json 352.0B
Database: ./erpnext.net-swift.com/private/backups/20210516_063432-erpnext_net-swift_com-database.sql.gz         36.2MiB
Backup for Site erpnext.net-swift.com has been successfully completed
Patching sites...
Migrating erpnext.net-swift.com
Executing erpnext.patches.v13_0.update_returned_qty_in_pr_dn in erpnext.net-swift.com (_ddbd5adc132c5c7f)
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/adminuser/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 101, in <module>
    main()
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/adminuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/adminuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/adminuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/adminuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/adminuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/adminuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/adminuser/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 27, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/commands/site.py", line 301, in migrate
    skip_search_index=skip_search_index
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/migrate.py", line 67, in migrate
    frappe.modules.patch_handler.run_all(skip_failing)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 41, in run_all
    run_patch(patch)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 30, in run_patch
    if not run_single(patchmodule = patch):
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 71, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 91, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/adminuser/frappe-bench/apps/erpnext/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py", line 27, in execute
    update_from_return_docs(doctype)
  File "/home/adminuser/frappe-bench/apps/erpnext/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py", line 17, in update_from_return_docs
    return_doc.update_prevdoc_status()
  File "/home/adminuser/frappe-bench/apps/erpnext/erpnext/controllers/status_updater.py", line 116, in update_prevdoc_status
    self.validate_qty()
  File "/home/adminuser/frappe-bench/apps/erpnext/erpnext/controllers/status_updater.py", line 192, in validate_qty
    self.check_overflow_with_allowance(item, args)
  File "/home/adminuser/frappe-bench/apps/erpnext/erpnext/controllers/status_updater.py", line 216, in check_overflow_with_allowance
    self.limits_crossed_error(args, item, qty_or_amount)
  File "/home/adminuser/frappe-bench/apps/erpnext/erpnext/controllers/status_updater.py", line 232, in limits_crossed_error
    ) + '<br><br>' + action_msg, OverAllowanceError, title = _('Limit Crossed'))
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/__init__.py", line 433, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/__init__.py", line 412, in msgprint
    _raise_exception()
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/__init__.py", line 366, in _raise_exception
    raise raise_exception(msg)
erpnext.controllers.status_updater.OverAllowanceError: This document is over limit by <b>Qty</b> <b>1.0</b> for item <b>US010004XY</b>. Are you making another <b>Delivery Note</b> against the same <b>Sales Order Item</b>?<br><br>To allow over receipt / delivery, update "Over Receipt/Delivery Allowance" in Stock Settings or the Item.

Maybe can’t execute update_returned_qty_in_pr_dn is because something wrong with my delivery note record ?

Thanks

After increase the allowance for item US01004XY mentioned above, there is no more issue for command bench update --patch after bench migrate --skip-failing.

Meanwhile, I restored with my snapshot and increase the allowance before the bench upgrade again this time.
but unfortunately , still same issue with role_allowed_to_over_deliver_receive
So once again, I did
bench migrate --skip-failing (No Error)
bench setup --patch (No Error)
bench build (No Error)
and finally I did bench update again
(Error say
$ bench build
An Error occurred while downloading assets…) but process can be continued and completed.
After all above, I can login with v13 now.
My question is this a successful upgrade ? since there are too many steps hand-made.
And what is the real issue when upgrade program execute update_returned_qty_in_pr_dn ?

This is my production environment, so I really want to do it again without any issue or any hand-made in order to make sure the upgrade has no issue.

Thanks all.

My analysis when upgrade program was interrupted by issue

frappe.database.database.InvalidColumnName: Invalid field name: <b>role_allowed_to_over_deliver_receive</b>

Since I have another successful upgraded instance as my develop platform, so I compared with 2 machines.

Action taken Result in Good one Result in Bad One
frappe.get_meta(β€˜Stock Sttings’).get_field(β€˜role_allowed_to_over_deliver_receive’) execute in bench console output 0x7f4451acc4a8 which means can be load Nothing output

doctype β€˜Stock Settings’ has several fields. I noticed that if fields in database table tabSingles , then frappe.get_meta(β€˜Stock Settings’).get_field(fieldname) can be execute correctly, but if fields only stored in erpnext/erpnext/stock/doctype/stock_settings/stock_settings.json like role_allowed_to_over_deliver_receive , load will fail.

function get_single_value will use another function get_meta(doctype).get_field(fieldname)
It looks like can’t read fieldname from json file cause get_field function return wrong result and then get_single_value return wrong result as well.
OR
Another assuming, at that moment, the field role_xxx_receive should already be in database table tabSingles , but somehow it not and then cause the issue.
I’m not sure if those information is useful to troubleshooting.

After upgraded with hand-made, --skip-failing, bench update --patch, blah,blah
I did the comparing again with my 2 machines.
Now both of 2 output same result always.

Hello
I did bench update once again, and this time assets can be downloaded

$ bench build
Retrieving assets...

βœ” Downloaded Frappe assets from https://github.com/frappe/frappe/releases/download/v13.2.2/assets.tar.gz

Extracting assets...

βœ” Restored js/frappe-web.min.js
βœ” Restored js/control.min.js
βœ” Restored js/bootstrap-4-web.min.js.map
βœ” Restored js/dialog.min.js
βœ” Restored js/form.min.js
βœ” Restored js/report.min.js
βœ” Restored js/desk.min.js.map
βœ” Restored js/list.min.js.map
βœ” Restored js/barcode_scanner.min.js.map
βœ” Restored js/data_import_tools.min.js.map
βœ” Restored js/data_import_tools.min.js
βœ” Restored js/moment-bundle.min.js
βœ” Restored js/user_profile_controller.min.js
βœ” Restored js/dialog.min.js.map
βœ” Restored js/frappe-recorder.min.js
βœ” Restored js/chat.js
βœ” Restored js/control.min.js.map
βœ” Restored js/checkout.min.js
βœ” Restored js/frappe-recorder.min.js.map
βœ” Restored js/web_form.min.js
βœ” Restored js/desk.min.js
βœ” Restored js/chat.js.map
βœ” Restored js/libs.min.js
βœ” Restored js/user_profile_controller.min.js.map
βœ” Restored js/web_form.min.js.map
βœ” Restored js/bootstrap-4-web.min.js
βœ” Restored js/barcode_scanner.min.js
βœ” Restored js/frappe-web.min.js.map
βœ” Restored js/form.min.js.map
βœ” Restored js/list.min.js
βœ” Restored js/report.min.js.map
βœ” Restored js/checkout.min.js.map
βœ” Restored css/report.min.css
βœ” Restored css/frappe-rtl.css
βœ” Restored css/web_form.css
βœ” Restored css/rollup.manifest.css
βœ” Restored css/email.css
βœ” Restored css/desk.min.css
βœ” Restored css/frappe-chat-web.css
βœ” Restored css/login.css
βœ” Restored css/printview.css
βœ” Restored css/frappe-web-b4.css
yarn run v1.22.10
$ FRAPPE_ENV=production node rollup/build.js --skip_frappe
Production mode
βœ” Built js/moment-bundle.min.js
βœ” Built js/libs.min.js

Building erpnext assets...

βœ” Built js/erpnext-web.min.js
βœ” Built js/bank-reconciliation-tool.min.js
βœ” Built js/item-dashboard.min.js
UNRESOLVED_IMPORT : 'vue/dist/vue.js' is imported by ../erpnext/erpnext/public/js/hub/marketplace.js, but could not be resolved – treating it as an external dependency
Cannot find some dependencies. You may have to run "bench setup requirements" to install them.

UNRESOLVED_IMPORT : 'vue/dist/vue.js' is imported by ../erpnext/erpnext/public/js/hub/vue-plugins.js, but could not be resolved – treating it as an external dependency
Cannot find some dependencies. You may have to run "bench setup requirements" to install them.

MISSING_GLOBAL_NAME : No name was provided for external module 'vue/dist/vue.js' in output.globals – guessing 'Vue'
βœ” Built js/erpnext.min.js
βœ” Built js/point-of-sale.min.js
βœ” Built css/erpnext.css
βœ” Built css/marketplace.css
βœ” Built css/erpnext-web.css
βœ” Built js/marketplace.min.js
✨  Done in 10.383s
Done in 19.61s.
Compiling Python files...

becaused on the information above, sounds like vue.js is not installed?

update
The unresolved_import issue has a workaround in our forum
cd apps/erpnext
npm install vue
rm package-lock.json
cd …/…/
bench update --build --requirements
I just tested and that works.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.