Try ERPNext Buy Support Partners Foundation

Custom field adding error

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 61, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1032, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 84, in runserverobj
frappe.desk.form.run_method.runserverobj(method, docs=docs, dt=dt, dn=dn, arg=arg, args=args)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/run_method.py”, line 36, in runserverobj
r = doc.run_method(method)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 772, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1048, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1031, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 766, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/customize_form/customize_form.py”, line 158, in save_customization
self.update_custom_fields()
File “/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/customize_form/customize_form.py”, line 246, in update_custom_fields
self.add_custom_field(df, i)
File “/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/customize_form/customize_form.py”, line 265, in add_custom_field
d.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 249, in insert
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 905, in run_post_save_methods
self.run_method(“on_update”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 772, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1048, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1031, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 766, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py”, line 61, in on_update
validate_fields_for_doctype(self.dt)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 467, in validate_fields_for_doctype
validate_fields(frappe.get_meta(doctype, cached=False))
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 725, in validate_fields
check_link_table_options(meta.get(“name”), d)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 514, in check_link_table_options
frappe.throw(_("{0}: Options {1} must be the same as doctype name {2} for the field {3}", DoctypeLinkError)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 71, in _
return get_full_dict(lang).get(msg) or non_translated_msg
File “/home/frappe/frappe-bench/apps/frappe/frappe/translate.py”, line 190, in get_full_dict
frappe.local.lang_full_dict = load_lang(lang)
File “/home/frappe/frappe-bench/apps/frappe/frappe/translate.py”, line 215, in load_lang
path = os.path.join(frappe.get_pymodule_path(app), “translations”, lang + “.csv”)
TypeError: unsupported operand type(s) for +: ‘type’ and ‘unicode’

If you add a little bit more detail, it would be easier to help you.

  • In which doctype?
  • What exactly are you trying to add
  • Does this page have a webview? (had a similar error once because of that)
  • In which doctype? Sales invoice
  • What exactly are you trying to add - I try to add another doc type as a link type to sales invoice. this enable me to select from the doc list.
  • Does this page have a webview? No

This seems to be a Language setting or language translation lookup issue?

For the example case of Language set to ‘de’ (in System Settings) this (key, value) lookup succeeds, given this key:
“{0}: Options {1} must be the same as doctype name {2} for the field {3}”
the value for that key is this translation:
{0}: Die Optionen {1} müssen mit dem Doctype-Namen {2} für das Feld {3} identisch sein.

Here’s the grep code search for that:

(env) frappe@ubuntu:~/frappe-bench$ find . -name ‘de.csv’ | xargs grep “{0}: Options {1} must be the same as doctype name {2} for the field {3}”
./apps/frappe/frappe/translations/de.csv:apps/frappe/frappe/core/doctype/doctype/doctype.py,{0}: Options {1} must be the same as doctype name {2} for the field {3},{0}: Die Optionen {1} müssen mit dem Doctype-Namen {2} für das Feld {3} identisch sein.

In your System Settings, what is Language set to - say ‘si’ ??

If that’s the case, that lookup has no translation as this shows:

(env) frappe@ubuntu:~/frappe-bench$ find . -name ‘si.csv’ | xargs grep “{0}: Options {1} must be the same as doctype name {2} for the field {3}”
(env) frappe@ubuntu:~/frappe-bench$