You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We trying to migrate ERPNext and Frappe from v14 to v15, The data is using ERPNext 14.34.0 and not update it to latest version.
When trying to migrate using command bench switch-to-branch version-15 frappe erpnext hrms --upgrade
it failed on this Executing erpnext.patches.v15_0.create_asset_depreciation_schedules_from_assets in development.localhost (_54cc49b9a1aab38b)
with error : pymysql.err.OperationalError: (1054, "Unknown column 'tabAsset Finance Book.shift_based' in 'field list'")
My temporary fix about this is :
Modify manually on table tabAsset Finance Book, add shift_based
Update first to latest version-14 and then migrate it to version-15
My expectation is, when the column is not found, then create or modify the table automatically during migration.
Module
other
Version
Frappe version : 14.59.0
ERPNext : 14.34.0
Installation method
docker
Relevant log output / Stack trace / Full Error Message.
Executing erpnext.patches.v15_0.create_asset_depreciation_schedules_from_assets in development.localhost (_54cc49b9a1aab38b)
Queued rebuilding of search index for development.localhost
Traceback with variables (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
mod_name = 'frappe.utils.bench_helper'
alter_argv = True
mod_spec = ModuleSpec(name='frappe.utils.bench_helper', loader=<_frozen_importlib_external.SourceFileLoader object at 0xffffb2ca0190>, origin='/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py')
code = <code object <module> at 0xaaaae94ec3e0, file "/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 1>
main_globals = {'__name__': '__main__', '__doc__': None, '__package__': 'frappe.utils', '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0xffffb2ca0190>, '__spec__': ModuleSpec(name='frappe.utils.bench_helper', loader=<_frozen_importlib_external.SourceFileLoader object at 0xffffb2ca0190>, origin='/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py'), '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': '/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py', '__cached__': '/workspace/development/frappe-bench/apps/frappe/frappe/utils/__pycache__/bench_helper.cpython-311.pyc', 'importlib': <module 'importlib' from '/home/frappe/.pyenv/versions/3.11.6/lib/python3.11/importlib/__init__.py'>, 'json': <module 'json' from '/home/frappe/.pyenv/versions/3.11.6/lib/python3.11/json/__init__.py'>, 'os': <module 'os' (frozen)>, 'traceback': <module 'traceback' from '/home/frappe/.pyenv/versions/3.11.6/lib/python3.11/...
File "<frozen runpy>", line 88, in _run_code
code = <code object <module> at 0xaaaae94ec3e0, file "/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 1>
run_globals = {'__name__': '__main__', '__doc__': None, '__package__': 'frappe.utils', '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0xffffb2ca0190>, '__spec__': ModuleSpec(name='frappe.utils.bench_helper', loader=<_frozen_importlib_external.SourceFileLoader object at 0xffffb2ca0190>, origin='/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py'), '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': '/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py', '__cached__': '/workspace/development/frappe-bench/apps/frappe/frappe/utils/__pycache__/bench_helper.cpython-311.pyc', 'importlib': <module 'importlib' from '/home/frappe/.pyenv/versions/3.11.6/lib/python3.11/importlib/__init__.py'>, 'json': <module 'json' from '/home/frappe/.pyenv/versions/3.11.6/lib/python3.11/json/__init__.py'>, 'os': <module 'os' (frozen)>, 'traceback': <module 'traceback' from '/home/frappe/.pyenv/versions/3.11.6/lib/python3.11/... init_globals = None mod_name = '__main__' mod_spec = ModuleSpec(name='frappe.utils.bench_helper', loader=<_frozen_importlib_external.SourceFileLoader object at 0xffffb2ca0190>, origin='/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py') pkg_name = 'frappe.utils' script_name = None loader = <_frozen_importlib_external.SourceFileLoader object at 0xffffb2ca0190> fname = '/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py' cached = '/workspace/development/frappe-bench/apps/frappe/frappe/utils/__pycache__/bench_helper.cpython-311.pyc' File "/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module> main() ...skipped... 27 vars File "/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 20, in main click.Group(commands=commands)(prog_name="bench") commands = {'frappe': <Group frappe>, 'get-frappe-commands': <Command get-frappe-commands>, 'get-frappe-help': <Command get-frappe-help>} File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1157, in __call__ return self.main(*args, **kwargs) self = <Group None> args = () kwargs = {'prog_name': 'bench'} File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) self = <Group None> args = ['frappe', '--site', 'development.localhost', 'migrate'] prog_name = 'bench' complete_var = None standalone_mode = True windows_expand_args = True extra = {} ctx = <click.core.Context object at 0xffffb1015b10> File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) self = <Group None> ctx = <click.core.Context object at 0xffffb1015b10> _process_result = <function MultiCommand.invoke.<locals>._process_result at 0xffffb1048fe0> args = ['migrate'] cmd_name = 'frappe' cmd = <Group frappe> sub_ctx = <click.core.Context object at 0xffffb1015c50> __class__ = <class 'click.core.MultiCommand'> File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) self = <Group frappe> ctx = <click.core.Context object at 0xffffb1015c50> _process_result = <function MultiCommand.invoke.<locals>._process_result at 0xffffb0939080> args = [] cmd_name = 'migrate' cmd = <Command migrate> sub_ctx = <click.core.Context object at 0xffffb0947d90> __class__ = <class 'click.core.MultiCommand'> File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) self = <Command migrate> ctx = <click.core.Context object at 0xffffb0947d90> File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) _Context__self = <click.core.Context object at 0xffffb0947d90> _Context__callback = <function migrate at 0xffffb08de480> args = () kwargs = {'skip_failing': False, 'skip_search_index': False} ctx = <click.core.Context object at 0xffffb0947d90> File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func return f(get_current_context(), *args, **kwargs) args = () kwargs = {'skip_failing': False, 'skip_search_index': False} f = <function migrate at 0xffffb08de200> File "/workspace/development/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 29, in _func ret = f(frappe._dict(ctx.obj), *args, **kwargs) ctx = <click.core.Context object at 0xffffb0947d90> args = () kwargs = {'skip_failing': False, 'skip_search_index': False} profile = False f = <function migrate at 0xffffb08de160> File "/workspace/development/frappe-bench/apps/frappe/frappe/commands/site.py", line 599, in migrate ).run(site=site) context = {'sites': ['development.localhost'], 'force': False, 'verbose': False, 'profile': False} skip_failing = False skip_search_index = False activate_by_import = <module 'traceback_with_variables.activate_by_import' from '/workspace/development/frappe-bench/env/lib/python3.11/site-packages/traceback_with_variables/activate_by_import.py'> SiteMigration = <class 'frappe.migrate.SiteMigration'> site = 'development.localhost' File "/workspace/development/frappe-bench/apps/frappe/frappe/migrate.py", line 185, in run self.run_schema_updates() self = <frappe.migrate.SiteMigration object at 0xffffb0e125d0> site = 'development.localhost' filelock = <function filelock at 0xffffae8ae8e0> File "/workspace/development/frappe-bench/apps/frappe/frappe/migrate.py", line 52, in wrapper raise e args = (<frappe.migrate.SiteMigration object at 0xffffb0e125d0>,) kwargs = {} method = <function SiteMigration.run_schema_updates at 0xffffae8ae3e0> File "/workspace/development/frappe-bench/apps/frappe/frappe/migrate.py", line 44, in wrapper ret = method(*args, **kwargs) args = (<frappe.migrate.SiteMigration object at 0xffffb0e125d0>,) kwargs = {} method = <function SiteMigration.run_schema_updates at 0xffffae8ae3e0> File "/workspace/development/frappe-bench/apps/frappe/frappe/migrate.py", line 116, in run_schema_updates frappe.modules.patch_handler.run_all( self = <frappe.migrate.SiteMigration object at 0xffffb0e125d0> File "/workspace/development/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 76, in run_all run_patch(patch) skip_failing = False patch_type = <PatchType.pre_model_sync: 'pre_model_sync'> executed = {'frappe.patches.v13_0.rename_custom_client_script', 'erpnext.patches.v14_0.create_accounting_dimensions_for_closing_balance', 'frappe.patches.v13_0.increase_password_length', 'erpnext.patches.v13_0.set_youtube_video_id', 'erpnext.patches.v13_0.healthcare_lab_module_rename_doctypes', 'frappe.patches.v11_0.make_all_prepared_report_attachments_private frappe/erpnext#2019-11-26', 'erpnext.patches.v9_0.set_uoms_in_variant_field', 'frappe.patches.v6_16.star_to_like', 'erpnext.patches.v12_0.update_healthcare_refactored_changes', 'erpnext.patches.v7_1.update_total_billing_hours', 'erpnext.patches.v12_0.create_accounting_dimensions_in_missing_doctypes frappe/erpnext#2020-05-11', 'execute:frappe.reload_doc("HR", "doctype", "Employee Advance")', 'erpnext.patches.v11_1.set_status_for_material_request_type_manufacture', 'execute:frappe.delete_doc_if_exists("Print Format", "Credit Note - Negative Invoice")', 'erpnext.patches.v12_0.move_bank_account_swift_number_to_bank', "execute:frappe.reload_doc('regional', 'doctype', 'gst_... run_patch = <function run_all.<locals>.run_patch at 0xffffad683c40> patches = ['frappe.patches.v15_0.remove_implicit_primary_key', 'frappe.patches.v12_0.remove_deprecated_fields_from_doctype frappe/erpnext#3', 'execute:frappe.utils.global_search.setup_global_search_table()', "execute:frappe.reload_doc('core', 'doctype', 'doctype_action', force=True) frappe/erpnext#2019-09-23", "execute:frappe.reload_doc('core', 'doctype', 'doctype_link', force=True) frappe/erpnext#2020-10-17", "execute:frappe.reload_doc('core', 'doctype', 'doctype_state', force=True) frappe/erpnext#2021-12-15", "execute:frappe.reload_doc('core', 'doctype', 'doctype', force=True) frappe/erpnext#2017-09-22", "execute:frappe.reload_doc('core', 'doctype', 'docfield', force=True) frappe/erpnext#2018-02-20", 'frappe.patches.v11_0.drop_column_apply_user_permissions', "execute:frappe.reload_doc('core', 'doctype', 'custom_docperm')", "execute:frappe.reload_doc('core', 'doctype', 'docperm') frappe/erpnext#2018-05-29", "execute:frappe.reload_doc('core', 'doctype', 'comment')", "execute:frappe.reload_doc('core', 'doctype', 'document_naming_rule', force=True)", "execute:frappe.reload_doc('core', 'doctype... patch = 'erpnext.patches.v15_0.create_asset_depreciation_schedules_from_assets' File "/workspace/development/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 62, in run_patch if not run_single(patchmodule=patch): patch = 'erpnext.patches.v15_0.create_asset_depreciation_schedules_from_assets' skip_failing = False File "/workspace/development/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 153, in run_single return execute_patch(patchmodule, method, methodargs) patchmodule = 'erpnext.patches.v15_0.create_asset_depreciation_schedules_from_assets' method = None methodargs = None force = False conf = <LocalProxy unbound> File "/workspace/development/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 189, in execute_patch _patch() patchmodule = 'erpnext.patches.v15_0.create_asset_depreciation_schedules_from_assets' method = None methodargs = None has_patch_file = True patch = 'erpnext.patches.v15_0.create_asset_depreciation_schedules_from_assets.execute' docstring = '' _patch = <function execute at 0xffffad560680> start_time = 139729.704658919 File "/workspace/development/frappe-bench/apps/erpnext/erpnext/patches/v15_0/create_asset_depreciation_schedules_from_assets.py", line 9, in execute asset_finance_books_map = get_asset_finance_books_map() assets = [{'name': 'ION-company_code-category_code-000001', 'opening_accumulated_depreciation': 5278541.0, 'gross_purchase_amount': 19490000.0, 'number_of_depreciations_booked': 13, 'docstatus': 1}, {'name': 'ION-company_code-category_code-000002', 'opening_accumulated_depreciation': 5200000.0, 'gross_purchase_amount': 19200000.0, 'number_of_depreciations_booked': 13, 'docstatus': 0}, {'name': 'ION-ID-CE-000001', 'opening_accumulated_depreciation': 3333333.33, 'gross_purchase_amount': 20000000.0, 'number_of_depreciations_booked': 8, 'docstatus': 0}, {'name': 'ION-ID-ME-000001', 'opening_accumulated_depreciation': 0.0, 'gross_purchase_amount': 45000000.0, 'number_of_depreciations_booked': 0, 'docstatus': 1}, {'name': 'ION-ID-ME-000002', 'opening_accumulated_depreciation': 0.0, 'gross_purchase_amount': 45000000.0, 'number_of_depreciations_booked': 0, 'docstatus': 1}, {'name': 'ION-ID-ME-000003', 'opening_accumulated_depreciation': 0.0, 'gross_purchase_amount': 45000000.0, 'number_of_depreciations...
File "/workspace/development/frappe-bench/apps/erpnext/erpnext/patches/v15_0/create_asset_depreciation_schedules_from_assets.py", line 93, in get_asset_finance_books_map
).run(as_dict=True)
afb = Table('tabAsset Finance Book')
asset = Table('tabAsset')
File "/workspace/development/frappe-bench/apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query
result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep
query = 'SELECT `tabAsset`.`name` `asset_name`,`tabAsset Finance Book`.`finance_book`,`tabAsset Finance Book`.`idx`,`tabAsset Finance Book`.`depreciation_method`,`tabAsset Finance Book`.`total_number_of_depreciations`,`tabAsset Finance Book`.`frequency_of_depreciation`,`tabAsset Finance Book`.`rate_of_depreciation`,`tabAsset Finance Book`.`expected_value_after_useful_life`,`tabAsset Finance Book`.`shift_based` FROM `tabAsset Finance Book` JOIN `tabAsset` ON `tabAsset Finance Book`.`parent`=`tabAsset`.`name` WHERE `tabAsset`.`docstatus`<2 ORDER BY `tabAsset Finance Book`.`idx`'
args = ()
kwargs = {'as_dict': True}
child_queries = []
params = {}
execute_child_queries = <function patch_query_execute.<locals>.execute_child_queries at 0xffffade28cc0>
prepare_query = <function patch_query_execute.<locals>.prepare_query at 0xffffade28d60>
File "/workspace/development/frappe-bench/apps/frappe/frappe/database/database.py", line 217, in sql
self._cursor.execute(query, values)
self = <frappe.database.mariadb.database.MariaDBDatabase object at 0xffffaeb7d990>
query = 'SELECT `tabAsset`.`name` `asset_name`,`tabAsset Finance Book`.`finance_book`,`tabAsset Finance Book`.`idx`,`tabAsset Finance Book`.`depreciation_method`,`tabAsset Finance Book`.`total_number_of_depreciations`,`tabAsset Finance Book`.`frequency_of_depreciation`,`tabAsset Finance Book`.`rate_of_depreciation`,`tabAsset Finance Book`.`expected_value_after_useful_life`,`tabAsset Finance Book`.`shift_based` FROM `tabAsset Finance Book` JOIN `tabAsset` ON `tabAsset Finance Book`.`parent`=`tabAsset`.`name` WHERE `tabAsset`.`docstatus`<2 ORDER BY `tabAsset Finance Book`.`idx`'
values = {}
as_dict = True
as_list = 0
debug = False
ignore_ddl = 0
auto_commit = 0
update = None
explain = False
run = True
pluck = False
trace_id = None
File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/pymysql/cursors.py", line 153, in execute
result = self._query(query)
self = <pymysql.cursors.Cursor object at 0xffffaf2b3310>
query = 'SELECT `tabAsset`.`name` `asset_name`,`tabAsset Finance Book`.`finance_book`,`tabAsset Finance Book`.`idx`,`tabAsset Finance Book`.`depreciation_method`,`tabAsset Finance Book`.`total_number_of_depreciations`,`tabAsset Finance Book`.`frequency_of_depreciation`,`tabAsset Finance Book`.`rate_of_depreciation`,`tabAsset Finance Book`.`expected_value_after_useful_life`,`tabAsset Finance Book`.`shift_based` FROM `tabAsset Finance Book` JOIN `tabAsset` ON `tabAsset Finance Book`.`parent`=`tabAsset`.`name` WHERE `tabAsset`.`docstatus`<2 ORDER BY `tabAsset Finance Book`.`idx`'
args = {}
File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/pymysql/cursors.py", line 322, in _query
conn.query(q)
self = <pymysql.cursors.Cursor object at 0xffffaf2b3310>
q = 'SELECT `tabAsset`.`name` `asset_name`,`tabAsset Finance Book`.`finance_book`,`tabAsset Finance Book`.`idx`,`tabAsset Finance Book`.`depreciation_method`,`tabAsset Finance Book`.`total_number_of_depreciations`,`tabAsset Finance Book`.`frequency_of_depreciation`,`tabAsset Finance Book`.`rate_of_depreciation`,`tabAsset Finance Book`.`expected_value_after_useful_life`,`tabAsset Finance Book`.`shift_based` FROM `tabAsset Finance Book` JOIN `tabAsset` ON `tabAsset Finance Book`.`parent`=`tabAsset`.`name` WHERE `tabAsset`.`docstatus`<2 ORDER BY `tabAsset Finance Book`.`idx`'
conn = <pymysql.connections.Connection object at 0xffffaeb85910>
File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/pymysql/connections.py", line 558, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
self = <pymysql.connections.Connection object at 0xffffaeb85910>
sql = b'SELECT `tabAsset`.`name` `asset_name`,`tabAsset Finance Book`.`finance_book`,`tabAsset Finance Book`.`idx`,`tabAsset Finance Book`.`depreciation_method`,`tabAsset Finance Book`.`total_number_of_depreciations`,`tabAsset Finance Book`.`frequency_of_depreciation`,`tabAsset Finance Book`.`rate_of_depreciation`,`tabAsset Finance Book`.`expected_value_after_useful_life`,`tabAsset Finance Book`.`shift_based` FROM `tabAsset Finance Book` JOIN `tabAsset` ON `tabAsset Finance Book`.`parent`=`tabAsset`.`name` WHERE `tabAsset`.`docstatus`<2 ORDER BY `tabAsset Finance Book`.`idx`'
unbuffered = False
File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/pymysql/connections.py", line 822, in _read_query_result
result.read()
self = <pymysql.connections.Connection object at 0xffffaeb85910>
unbuffered = False
result = <pymysql.connections.MySQLResult object at 0xffffadc593d0>
File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/pymysql/connections.py", line 1200, inread
first_packet = self.connection._read_packet()
self = <pymysql.connections.MySQLResult object at 0xffffadc593d0>
File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/pymysql/connections.py", line 772, in _read_packet
packet.raise_for_error()
self = <pymysql.connections.Connection object at 0xffffaeb85910>
packet_type = <class 'pymysql.protocol.MysqlPacket'>
buff = bytearray(b"\xff\x1e\x04#42S22Unknown column \'tabAsset Finance Book.shift_based\' in \'field list\'")
packet_header = b'K\x00\x00\x01'
btrl = 75
btrh = 0
packet_number = 1
bytes_to_read = 75
recv_data = b"\xff\x1e\x04#42S22Unknown column 'tabAsset Finance Book.shift_based' in 'field list'"
packet = <pymysql.protocol.MysqlPacket object at 0xffffad840b20>
File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
self = <pymysql.protocol.MysqlPacket object at 0xffffad840b20>
errno = 1054
File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
data = b"\xff\x1e\x04#42S22Unknown column 'tabAsset Finance Book.shift_based' in 'field list'"
errno = 1054
errval = "Unknown column 'tabAsset Finance Book.shift_based' in 'field list'"
errorclass = <class 'pymysql.err.OperationalError'>
pymysql.err.OperationalError: (1054, "Unknown column 'tabAsset Finance Book.shift_based' in 'field list'")
The text was updated successfully, but these errors were encountered:
Information about bug
We trying to migrate ERPNext and Frappe from v14 to v15, The data is using ERPNext 14.34.0 and not update it to latest version.
When trying to migrate using command
bench switch-to-branch version-15 frappe erpnext hrms --upgrade
it failed on this
Executing erpnext.patches.v15_0.create_asset_depreciation_schedules_from_assets in development.localhost (_54cc49b9a1aab38b)
with error :
pymysql.err.OperationalError: (1054, "Unknown column 'tabAsset Finance Book.shift_based' in 'field list'")
My temporary fix about this is :
My expectation is, when the column is not found, then create or modify the table automatically during migration.
Module
other
Version
Frappe version : 14.59.0
ERPNext : 14.34.0
Installation method
docker
Relevant log output / Stack trace / Full Error Message.
The text was updated successfully, but these errors were encountered: