question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrade to v13.39.1 frappe and erpnext throws error `frappe.exceptions.ValidationError: A field with the name 'total_taxes_and_charges' already exists in doctype Expense Claim.`

See original GitHub issue

Description of the issue

When upgrading from frappe 13.17.1 to v13.39.1 together with upgrading erpnext from v13.17.0 to v13.39.1 the following error is thrown: frappe.exceptions.ValidationError: A field with the name 'total_taxes_and_charges' already exists in doctype Expense Claim.

Context information (for bug reports)

Output of bench version

5.7.2
INFO: A newer version of bench is available: 5.7.2 → 5.14.3

After upgrading to 5.14.3 the error remains the same.

Steps to reproduce the issue

  1. cd ~/frappe-bench/apps/frappe/
  2. git checkout v13.39.1
  3. cd ~/frappe-bench/apps/erpnext
  4. git checkout v13.39.1
  5. cd ~/frappe-benache
  6. bench setup requirements
  7. bench build
  8. bench --site erpnext.example.com migrate

Observed result

Error is shown, migration stops

Expected result

Migration should finish without errors.

Stacktrace / full error message

Updating DocTypes for frappe        : [========================================] 100%
Updating DocTypes for erpnext       : [========================================] 100%
Updating DocTypes for erpnextswiss  : [========================================] 100%

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 110, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 31, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 407, in migrate
    migrate(context.verbose, skip_failing=skip_failing, skip_search_index=skip_search_index)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 79, in migrate
    sync_fixtures()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/fixtures.py", line 22, in sync_fixtures
    import_doc(fixtures_path)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/data_import/data_import.py", line 181, in import_doc
    import_file_by_path(
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 146, in import_file_by_path
    import_doc(
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 275, in import_doc
    doc.insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 254, in insert
    self.run_method("before_insert")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 941, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1261, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1243, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 938, in fn
    return method_object(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 44, in before_insert
    frappe.throw(
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 504, in throw
    msgprint(
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 479, in msgprint
    _raise_exception()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 434, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: A field with the name 'total_taxes_and_charges' already exists in doctype Expense Claim.

Additional information

OS version / distribution, Frappe install method, etc.

Ubuntu 20.04, native installation We have customized doctype in ERPNEXT / Non Profit / Member The table tabExpenseClaims is empty

Maybe this is related to that bug: https://github.com/frappe/erpnext/issues/23981

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dasistwascommented, Sep 26, 2022

OK, I found this in /apps/erpnextswiss/erpnextswiss/fixtures/custom_field.json

 {

  "allow_on_submit": 0,
  "bold": 0,
  "collapsible": 0,
  "collapsible_depends_on": null,
  "columns": 0,
  "default": null,
  "depends_on": null,
  "description": null,
  "docstatus": 0,
  "doctype": "Custom Field",
  "dt": "Expense Claim",
  "fieldname": "total_taxes_and_charges",
  "fieldtype": "Currency",
  "hidden": 0,
  "ignore_user_permissions": 0,
  "ignore_xss_filter": 0,
  "in_global_search": 0,
  "in_list_view": 0,
  "in_standard_filter": 0,
  "insert_after": "taxes_and_charges",
  "label": "Total Taxes and Charges",
  "modified": "2018-03-15 13:06:29.675381",
  "name": "Expense Claim-total_taxes_and_charges",
  "no_copy": 0,
  "options": null,
  "permlevel": 0,
  "precision": "",
  "print_hide": 0,
  "print_hide_if_no_value": 0,
  "print_width": null,
  "read_only": 0,
  "report_hide": 0,
  "reqd": 0,
  "search_index": 0,
  "unique": 0,
  "width": null
 },

So next step would be to check on the app side and close this issue?

0reactions
ankushcommented, Sep 26, 2022

yes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

frappe.exceptions.ValidationError: A field with the name ...
ValidationError : A field with the name 'customer_group' already exists in doctype Sales Order. when i try to restore the db from v12...
Read more >
Update Error: frappe.exceptions.ValidationError: Options must ...
Hi, we get this when trying to update, our current version are: erpnext 10.1.42 frappe 10.1.39 This problem is similar to this one...
Read more >
frappe.exceptions.ValidationError: Fieldtype cannot be ...
ValidationError : Fieldtype cannot be changed from Data to Currency - ERPNext Forum.
Read more >
Error Migrating from v12 to v13 - ERPNext Forum
Hi, I am trying to migrate from v12 to v13 but i am getting error as frappe.exceptions.
Read more >
frappe.exceptions.ValidationError: item_code field cannot be ...
Got this error when i ran bench update frappe.exceptions.ValidationError: item_code field cannot be set as unique in tabItem, as there are ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found