Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

[V13] Update to version 13 crashes on migrating custom fields

I have installed ERPNext V12 with some custom fields exported as a fixtures to the custom app.

After switching to V13 I ran bench update as suggested and got this error saying that custom field already exists.

frappe.exceptions.ValidationError: A field with the name 'valuation_rate' already exists in doctype Quotation Item

Full error log:

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/martin/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 101, in <module>
    main()
  File "/home/martin/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/martin/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/martin/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/martin/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/martin/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/martin/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/martin/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/martin/frappe-bench/env/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/martin/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 27, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/martin/frappe-bench/apps/frappe/frappe/commands/site.py", line 300, in migrate
    skip_search_index=skip_search_index
  File "/home/martin/frappe-bench/apps/frappe/frappe/migrate.py", line 73, in migrate
    sync_fixtures()
  File "/home/martin/frappe-bench/apps/frappe/frappe/utils/fixtures.py", line 24, in sync_fixtures
    import_doc(frappe.get_app_path(app, "fixtures", fname))
  File "/home/martin/frappe-bench/apps/frappe/frappe/core/doctype/data_import/data_import.py", line 190, in import_doc
    reset_permissions=True
  File "/home/martin/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/martin/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 143, in import_doc
    doc.insert()
  File "/home/martin/frappe-bench/apps/frappe/frappe/model/document.py", line 230, in insert
    self.run_method("before_insert")
  File "/home/martin/frappe-bench/apps/frappe/frappe/model/document.py", line 847, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/martin/frappe-bench/apps/frappe/frappe/model/document.py", line 1136, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/martin/frappe-bench/apps/frappe/frappe/model/document.py", line 1119, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/martin/frappe-bench/apps/frappe/frappe/model/document.py", line 841, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/martin/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 40, in before_insert
    frappe.throw(_("A field with the name '{}' already exists in doctype {}.").format(self.fieldname, self.dt))
  File "/home/martin/frappe-bench/apps/frappe/frappe/__init__.py", line 424, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
  File "/home/martin/frappe-bench/apps/frappe/frappe/__init__.py", line 403, in msgprint
    _raise_exception()
  File "/home/martin/frappe-bench/apps/frappe/frappe/__init__.py", line 357, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: A field with the name 'valuation_rate' already exists in doctype Quotation Item