Getting error while customize form field

Getting below error while customize a field . From last 3 days i am getting this error while customize any form.

Traceback (most recent call last):
  File "/home/sjain/erpnext/forever_erp/apps/frappe/frappe/app.py", line 61, in application
    response = frappe.handler.handle()
  File "/home/sjain/erpnext/forever_erp/apps/frappe/frappe/handler.py", line 21, in handle
    data = execute_cmd(cmd)
  File "/home/sjain/erpnext/forever_erp/apps/frappe/frappe/handler.py", line 56, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/sjain/erpnext/forever_erp/apps/frappe/frappe/__init__.py", line 1036, in call
    return fn(*args, **newargs)
  File "/home/sjain/erpnext/forever_erp/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/sjain/erpnext/forever_erp/apps/frappe/frappe/desk/form/run_method.py", line 36, in runserverobj
    r = doc.run_method(method)
  File "/home/sjain/erpnext/forever_erp/apps/frappe/frappe/model/document.py", line 772, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/sjain/erpnext/forever_erp/apps/frappe/frappe/model/document.py", line 1048, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/sjain/erpnext/forever_erp/apps/frappe/frappe/model/document.py", line 1031, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/sjain/erpnext/forever_erp/apps/frappe/frappe/model/document.py", line 766, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/sjain/erpnext/forever_erp/apps/frappe/frappe/custom/doctype/customize_form/customize_form.py", line 160, in save_customization
    validate_fields_for_doctype(self.doc_type)
  File "/home/sjain/erpnext/forever_erp/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 466, in validate_fields_for_doctype
    doc.delete_duplicate_custom_fields()
AttributeError: 'Document' object has no attribute 'delete_duplicate_custom_fields'

Any help will be appreciated.
Thank you

By curiosity, are you modifying the doc from ‘Doctype List’ or ‘Customize Form’?
I recall getting an error when I first try to modify something when I passed by ‘Doctype List’ instead of ‘Customize Form’ for Core document.

I think their is no

just review your code maybe you miss it

Hello @mel_erp and @kkulloters,
I have tried to customize “Doctype list” . After adding custom field in “Doctype list” i had above error , but i have solved it . Using bench command “Bench migrate” in source code.
Why this thing happend after customized Doctype Document?

because the db is not updated

as @kkulloters says it’s not updated. This is why we use Customize From instead. You’ll be able to see the changes when you click on ‘Update’. Also, you’ll be able to export the changes from one environment to another, so you won’t have to do this manually each time you want to export your changes.
Basically, it’s not a good idea to pass by ‘Doctype List’. Customize Form is your friend :wink:

2 Likes