While importing data for a doctype with Auto Name defined its not taking field data
Doc Type has a field “reading date” as type date and same is given in auto name as we want it to be unique for the day.
When we import the data date doesn’t come in the name automatically and get an error of duplicate entry
Traceback (most recent call last):
File “/srv/bench/erp12/apps/frappe/frappe/model/base_document.py”, line 324, in db_insert
), list(d.values()))
File “/srv/bench/erp12/apps/frappe/frappe/database/database.py”, line 156, in sql
self._cursor.execute(query, values)
File “/srv/bench/erp12/env/lib/python3.6/site-packages/pymysql/cursors.py”, line 170, in execute
result = self._query(query)
File “/srv/bench/erp12/env/lib/python3.6/site-packages/pymysql/cursors.py”, line 328, in _query
conn.query(q)
File “/srv/bench/erp12/env/lib/python3.6/site-packages/pymysql/connections.py”, line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/srv/bench/erp12/env/lib/python3.6/site-packages/pymysql/connections.py”, line 732, in _read_query_result
result.read()
File “/srv/bench/erp12/env/lib/python3.6/site-packages/pymysql/connections.py”, line 1075, in read
first_packet = self.connection._read_packet()
File “/srv/bench/erp12/env/lib/python3.6/site-packages/pymysql/connections.py”, line 684, in _read_packet
packet.check_error()
File “/srv/bench/erp12/env/lib/python3.6/site-packages/pymysql/protocol.py”, line 220, in check_error
err.raise_mysql_exception(self._data)
File “/srv/bench/erp12/env/lib/python3.6/site-packages/pymysql/err.py”, line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1062, “Duplicate entry ‘MBC-’ for key ‘PRIMARY’”)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/srv/bench/erp12/apps/frappe/frappe/core/doctype/data_import/importer.py”, line 410, in upload
doc.insert()
File “/srv/bench/erp12/apps/frappe/frappe/model/document.py”, line 247, in insert
raise e
File “/srv/bench/erp12/apps/frappe/frappe/model/document.py”, line 244, in insert
self.db_insert()
File “/srv/bench/erp12/apps/frappe/frappe/model/base_document.py”, line 334, in db_insert
raise frappe.DuplicateEntryError(self.doctype, self.name, e)
frappe.exceptions.DuplicateEntryError: (‘BlockUtilityData’, ‘MBC-’, IntegrityError(1062, “Duplicate entry ‘MBC-’ for key ‘PRIMARY’”))