ERPNext - Trying to duplicate a Doctype

Good evening, I’m having trouble when attempting to duplicate a DocType in Stock to use it in another section of the site i’m currently working, and wanted to ask what causes this and what can i do to solve this issue.

This is what’s happening:
I enter the site, head to the DocType list and check a doctype in particular (Delivery Note for example), go for the option of Duplicate and it shows a error message where it says:
DocType new-doctype-1 not found
The resource you are looking for is not available

It shows the fields of the Delivery Note, but presents this error message, i continue with writing the name for the new doctype, and as soon as i try to save the duplicated doctype it shows the following message

DocType Surtir Receta not found
The resource you are looking for is not available

And i cant duplicate the doctype, so i wanted to ask what causes this, i even checked the logs from the server to see what’s happening and saw this:

0|bench start | 04:25:56 web.1 | Traceback (most recent call last):
0|bench start | 04:25:56 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/app.py”, line 66, in application
0|bench start | 04:25:56 web.1 | response = frappe.api.handle()
0|bench start | 04:25:56 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/api.py”, line 54, in handle
0|bench start | 04:25:56 web.1 | return frappe.handler.handle()
0|bench start | 04:25:56 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/handler.py”, line 29, in handle
0|bench start | 04:25:56 web.1 | data = execute_cmd(cmd)
0|bench start | 04:25:56 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/handler.py”, line 65, in execute_cmd
0|bench start | 04:25:56 web.1 | return frappe.call(method, **frappe.form_dict)
0|bench start | 04:25:56 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 1174, in call
0|bench start | 04:25:56 web.1 | return fn(*args, **newargs)
0|bench start | 04:25:56 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 611, in wrapper_fn
0|bench start | 04:25:56 web.1 | retval = fn(*args, **get_newargs(fn, kwargs))
0|bench start | 04:25:56 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/desk/notifications.py”, line 232, in get_open_count
0|bench start | 04:25:56 web.1 | frappe.has_permission(doc=frappe.get_doc(doctype, name), throw=True)
0|bench start | 04:25:56 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 852, in get_doc
0|bench start | 04:25:56 web.1 | doc = frappe.model.document.get_doc(*args, **kwargs)
0|bench start | 04:25:56 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 72, in get_doc
0|bench start | 04:25:56 web.1 | return controller(*args, **kwargs)
0|bench start | 04:25:56 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 110, in init
0|bench start | 04:25:56 web.1 | self.load_from_db()
0|bench start | 04:25:56 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 153, in load_from_db
0|bench start | 04:25:56 web.1 | frappe.throw((“{0} {1} not found”).format((self.doctype), self.name), frappe.DoesNotExistError)
0|bench start | 04:25:56 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 430, in throw
0|bench start | 04:25:56 web.1 | msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable, wide=wide, as_list=as_list)
0|bench start | 04:25:56 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 409, in msgprint
0|bench start | 04:25:56 web.1 | _raise_exception()
0|bench start | 04:25:56 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 363, in _raise_exception
0|bench start | 04:25:56 web.1 | raise raise_exception(msg)
0|bench start | 04:25:56 web.1 | frappe.exceptions.DoesNotExistError: DocType new-doctype-1 not found

0|bench start | 04:23:16 web.1 | Traceback (most recent call last):
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/app.py”, line 66, in application
0|bench start | 04:23:16 web.1 | response = frappe.api.handle()
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/api.py”, line 54, in handle
0|bench start | 04:23:16 web.1 | return frappe.handler.handle()
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/handler.py”, line 29, in handle
0|bench start | 04:23:16 web.1 | data = execute_cmd(cmd)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/handler.py”, line 65, in execute_cmd
0|bench start | 04:23:16 web.1 | return frappe.call(method, **frappe.form_dict)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 1174, in call
0|bench start | 04:23:16 web.1 | return fn(*args, **newargs)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/desk/form/save.py”, line 20, in savedocs
0|bench start | 04:23:16 web.1 | doc.save()
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 282, in save
0|bench start | 04:23:16 web.1 | return self.save(*args, **kwargs)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 304, in save
0|bench start | 04:23:16 web.1 | self.insert()
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 235, in insert
0|bench start | 04:23:16 web.1 | self.run_before_save_methods()
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 961, in run_before_save_methods
0|bench start | 04:23:16 web.1 | self.run_method(“validate”)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 855, in run_method
0|bench start | 04:23:16 web.1 | out = Document.hook(fn)(self, *args, **kwargs)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 1148, in composer
0|bench start | 04:23:16 web.1 | return composed(self, method, *args, **kwargs)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 1131, in runner
0|bench start | 04:23:16 web.1 | add_to_return_value(self, fn(self, *args, **kwargs))
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 849, in
0|bench start | 04:23:16 web.1 | fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 74, in validate
0|bench start | 04:23:16 web.1 | self.make_repeatable()
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 591, in make_repeatable
0|bench start | 04:23:16 web.1 | create_custom_field(self.name, df)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py”, line 141, in create_custom_field
0|bench start | 04:23:16 web.1 | custom_field.insert()
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 228, in insert
0|bench start | 04:23:16 web.1 | self.run_method(“before_insert”)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 855, in run_method
0|bench start | 04:23:16 web.1 | out = Document.hook(fn)(self, *args, **kwargs)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 1148, in composer
0|bench start | 04:23:16 web.1 | return composed(self, method, *args, **kwargs)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 1131, in runner
0|bench start | 04:23:16 web.1 | add_to_return_value(self, fn(self, *args, **kwargs))
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 849, in
0|bench start | 04:23:16 web.1 | fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py”, line 35, in before_insert
0|bench start | 04:23:16 web.1 | meta = frappe.get_meta(self.dt, cached=False)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 883, in get_meta
0|bench start | 04:23:16 web.1 | return frappe.model.meta.get_meta(doctype, cached=cached)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/meta.py”, line 40, in get_meta
0|bench start | 04:23:16 web.1 | return load_meta(doctype)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/meta.py”, line 43, in load_meta
0|bench start | 04:23:16 web.1 | return Meta(doctype)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/meta.py”, line 80, in init
0|bench start | 04:23:16 web.1 | super(Meta, self).init(“DocType”, doctype)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 110, in init
0|bench start | 04:23:16 web.1 | self.load_from_db()
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/meta.py”, line 85, in load_from_db
0|bench start | 04:23:16 web.1 | super(Meta, self).load_from_db()
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 153, in load_from_db
0|bench start | 04:23:16 web.1 | frappe.throw(
(“{0} {1} not found”).format(
(self.doctype), self.name), frappe.DoesNotExistError)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 430, in throw
0|bench start | 04:23:16 web.1 | msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable, wide=wide, as_list=as_list)
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 409, in msgprint
0|bench start | 04:23:16 web.1 | _raise_exception()
0|bench start | 04:23:16 web.1 | File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 363, in _raise_exception
0|bench start | 04:23:16 web.1 | raise raise_exception(msg)
0|bench start | 04:23:16 web.1 | frappe.exceptions.DoesNotExistError: DocType Surtir Receta not found
0|bench start | 04:23:16 web.1 |
0|bench start | 04:23:16 web.1 | 127.0.0.1 - - [13/Sep/2021 04:23:16] “POST /api/method/frappe.desk.form.save.savedocs HTTP/1.1” 404 -

That’s what happened, good evening!

i have the same problem did you fine a solution

I also had the same problem with Duplicating a Doctype, I unchecked the Allow Auto Repeat under the Form Settings then it could be duplicate.

2 Likes

Hi, Good Morning!
I’m sorry if was late to reply, i’ve tested the unchecked allow auto repeat for a doctype. I was trying to duplicate a Delivery Note to use it in another module.
I came to notify that it worked, perfectly. It was what i was looking for!
Thank you so much!

2 Likes