Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

Bench migrate issue during the process of v13 upgrade from v12

During the process of command

bench switch-to-branch version-13 frappe erpnext --upgrade

We got errors when system start to execute migration.

Success: Done in 0.261s
Executing erpnext.patches.v13_0.set_pos_closing_as_failed in tc-erpnext-dev.net-swift.com (_ddbd5adc132c5c7f)
Success: Done in 0.112s



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 73, in migrate
    sync_fixtures()
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/utils/fixtures.py", line 24, in sync_fixtures
    import_doc(frappe.get_app_path(app, "fixtures", fname))
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/core/doctype/data_import/data_import.py", line 191, in import_doc
    reset_permissions=True
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 70, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 143, in import_doc
    doc.insert()
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/model/document.py", line 267, in insert
    self.run_post_save_methods()
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/model/document.py", line 993, in run_post_save_methods
    self.run_method("on_update")
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/model/document.py", line 858, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/model/document.py", line 1147, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/model/document.py", line 1130, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/model/document.py", line 852, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 76, in on_update
    validate_fields_for_doctype(self.dt)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 690, in validate_fields_for_doctype
    validate_fields(meta)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 1001, in validate_fields
    validate_data_field_type(d)
  File "/home/adminuser/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 955, in validate_data_field_type
    frappe.msgprint(text_str + df_options_str, title="Invalid Data Field", raise_exception=True)
  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 368, in _raise_exception
    raise ValidationError(msg)
frappe.exceptions.ValidationError: <b>Legacy Customer ID</b> is an invalid Data field.<br><br>Only Options allowed for Data field are:<br><ul><li>Email</li><li>Name</li><li>Phone</ul>

Customized Filed legacy customer id was created on customer and issue both

Field Name doctype Data Type Option
legacy customer id Customer int
legacy customer id Issue data Customer

We don’t know how to resolve, please help.
Thanks.

Was bench update --patch tried and produced that error or was it bench migrate ?

enter console

bench --site <site.name> console

enter following in console:

f = frappe.get_doc("Custom Field", "Issue-legacy_customer_id")
# Set the options to None, current option Customer is invalid
f.options = None
f.save()
frappe.db.commit()

HI Revant_one

Thanks for the advise.
I followed with your command and did the upgrade from my clean snapshot again.
the issue still there.

Exact same error?

I don’t know what’s wrong then.

try this

1 Like

The wired thing is even i removed my field Legacy Customer ID away before upgrade, I still got the same error exactly.
Any possibility like cache or somewhere else remembered something?

Finally, I was able to upgrade to version-13 successfully by add one more action before real upgrade start, which is bench export-fixtures after modified options by using revant’s command.
My exported fixture json file is stored in my own app, somehow it is read by upgrade script cause the issue.

Thanks all.