Very interesting, thanks for the hint!
Indeed, trying to open a private file, I got this error:
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 324, in db_insert
), list(d.values()))
File "/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py", line 156, in sql
self._cursor.execute(query, values)
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py", line 170, in execute
result = self._query(query)
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py", line 328, in _query
conn.query(q)
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 732, in _read_query_result
result.read()
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 1075, in read
first_packet = self.connection._read_packet()
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 684, in _read_packet
packet.check_error()
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "/home/frappe/frappe-bench/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 'AL-00302' for key 'PRIMARY'")
- The most recent Access Log had the name AL-00810.
- Autoname for Access Log was defined as “format:AL-{#####}”.
- There was no row
like "AL%"
in tabSeries
.
I wanted to correct the Naming Series but it didn’t show up in the Naming Series Tool.
The following two SQL statements fixed the problem for me:
UPDATE `tabDocType` SET autoname = 'AL-.#####' WHERE name = "Access Log";
INSERT INTO tabSeries VALUES ('AL-', 810);
COMMIT;
After this, I did a bench clear-cache && bench restart
.
I can show very clearly that when I change Access Log’s autoname to format:AL-{#####}
the error comes back again.