Issue with Custom Doctype Migration from ERPNext 14 to 15

Hi Team,

I’m encountering an issue while migrating a custom app from ERPNext version 14 to version 15. Here’s a breakdown of the steps I’ve followed:

On ERPNext Version 14 Server (192.168.2.30):

  1. Installed a custom app in the apps directory.
  2. Created a custom doctype within the newly installed custom app.
  3. Utilized fixtures in the custom app’s hooks.py file.
  4. Executed bench --site site-name export-fixtures.
  5. Committed changes to Git (git status, git add ., git commit).

On ERPNext Version 15 Server (192.168.2.45):

  1. Used bench get-app to install the custom app from the ERPNext version 14 server.
  2. Executed bench --site site-name migrate.

While following the same migration process from version 15 to 15, I successfully observed the custom doctype in the migrated server. However, in the migration from ERPNext 14 to 15, the custom app installed but the doctype isn’t listed in the UI.

Here’s the error encountered during the migrate command:

vijay@frappe-virtual-machine:~/frappe-bench/apps$ bench --site update.aalam.com migrate
Migrating update.aalam.com
Updating DocTypes for frappe : [========================================] 100%
Updating DocTypes for erpnext : [========================================] 100%
Updating DocTypes for support_app : [========================================] 100%
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/vijay/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 114, in
main()
File “/home/vijay/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 20, in main
click.Group(commands=commands)(prog_name=“bench”)
File “/home/vijay/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1157, in call
return self.main(*args, **kwargs)
File “/home/vijay/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1078, in main
rv = self.invoke(ctx)
File “/home/vijay/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/vijay/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/vijay/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/vijay/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 783, in invoke
return __callback(*args, **kwargs)
File “/home/vijay/frappe-bench/env/lib/python3.10/site-packages/click/decorators.py”, line 33, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/vijay/frappe-bench/apps/frappe/frappe/commands/init.py”, line 29, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/vijay/frappe-bench/apps/frappe/frappe/commands/site.py”, line 709, in migrate
SiteMigration(
File “/home/vijay/frappe-bench/apps/frappe/frappe/migrate.py”, line 187, in run
self.post_schema_updates()
File “/home/vijay/frappe-bench/apps/frappe/frappe/migrate.py”, line 44, in wrapper
ret = method(*args, **kwargs)
File “/home/vijay/frappe-bench/apps/frappe/frappe/migrate.py”, line 140, in post_schema_updates
sync_fixtures()
File “/home/vijay/frappe-bench/apps/frappe/frappe/utils/fixtures.py”, line 22, in sync_fixtures
import_fixtures(app)
File “/home/vijay/frappe-bench/apps/frappe/frappe/utils/fixtures.py”, line 41, in import_fixtures
import_doc(file_path)
File “/home/vijay/frappe-bench/apps/frappe/frappe/core/doctype/data_import/data_import.py”, line 250, in import_doc
import_file_by_path(
File “/home/vijay/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 125, in import_file_by_path
db_modified_timestamp = frappe.db.get_value(doc[“doctype”], doc[“name”], “modified”)
File “/home/vijay/frappe-bench/apps/frappe/frappe/database/database.py”, line 519, in get_value
result = self.get_values(
File “/home/vijay/frappe-bench/apps/frappe/frappe/database/database.py”, line 623, in get_values
out = self._get_values_from_table(
File “/home/vijay/frappe-bench/apps/frappe/frappe/database/database.py”, line 896, in _get_values_from_table
return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
File “/home/vijay/frappe-bench/apps/frappe/frappe/query_builder/utils.py”, line 87, in execute_query
result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep
File “/home/vijay/frappe-bench/apps/frappe/frappe/database/database.py”, line 262, in sql
traceback.print_stack()
“Error in query:\n(‘SELECT modified FROM tabCustom-Doctype-From-Version-14 WHERE name=%(param1)s ORDER BY modified DESC LIMIT 1’, {‘param1’: ‘c29468492b’})”
Skipping fixture syncing from the file custom_doctype_from_version_14.json. Reason: Module import failed for Custom-Doctype-From-Version-14, the DocType you’re trying to open might be deleted.
Error: No module named ‘frappe.core.doctype.custom_doctype_from_version_14’
Updating Dashboard for frappe
Updating Dashboard for erpnext
Updating Dashboard for app_management
Updating Dashboard for support_app
Updating customizations for Address
Updating customizations for Contact
Queued rebuilding of search index for update.aalam.com

Skipping fixture syncing from the file custom_doctype_from_version_14.json. Reason: Module import failed for Custom-Doctype-From-Version-14, the DocType you’re trying to open might be deleted.
Error: No module named ‘frappe.core.doctype.custom_doctype_from_version_14’

I’d appreciate any insights or suggestions on resolving this issue. Thank you in advance!

Vijay Perumalsamy,
Aalam Info Solutions LLP