libracore / erpnextswiss

ERPNext application for Switzerland-specific use cases
GNU Affero General Public License v3.0
74 stars 63 forks source link

Error occurred while installing ERPNextSwiss #121

Closed Jonidohc16v closed 8 months ago

Jonidohc16v commented 1 year ago

Expected behvauour

Install ERPNextSwiss on Frappe/ERPNext version13

Actual behaviour

Gives an error even before installation starts. Error message:

An error occurred while installing erpnextswiss: ('Module Def', 'ERPNextSwiss', IntegrityError(1062, "Duplicate entry 'ERPNextSwiss' for key 'PRIMARY'"))
Traceback (most recent call last):
  File "apps/frappe/frappe/model/base_document.py", line 504, in db_insert
    frappe.db.sql(
  File "apps/frappe/frappe/database/database.py", line 220, in sql
    self._cursor.execute(query, values)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
    result = self._query(query)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
    conn.query(q)
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
    result.read()
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
    first_packet = self.connection._read_packet()
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
    packet.raise_for_error()
  File "env/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "env/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1062, "Duplicate entry 'ERPNextSwiss' for key 'PRIMARY'")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/frappe/frappe/commands/site.py", line 415, in install_app
    _install_app(app, verbose=context.verbose, force=force)
  File "apps/frappe/frappe/installer.py", line 292, in install_app
    add_module_defs(name, ignore_if_duplicate=force)
  File "apps/frappe/frappe/installer.py", line 623, in add_module_defs
    d.insert(ignore_permissions=True, ignore_if_duplicate=ignore_if_duplicate)
  File "apps/frappe/frappe/model/document.py", line 270, in insert
    self.db_insert(ignore_if_duplicate=ignore_if_duplicate)
  File "apps/frappe/frappe/model/base_document.py", line 531, in db_insert
    raise frappe.DuplicateEntryError(self.doctype, self.name, e)
frappe.exceptions.DuplicateEntryError: ('Module Def', 'ERPNextSwiss', IntegrityError(1062, "Duplicate entry 'ERPNextSwiss' for key 'PRIMARY'"))

Observed in (version)

frappe/erpnext version 13 bench version 5.16.4

What could be the problem?

Thank you. Best regards, Jonathan

lasalesi commented 11 months ago
"Duplicate entry 'ERPNextSwiss' for key 'PRIMARY'")

This indicates that there is already an ERPNextSwiss installed. Please make sure to uninstall it, assert that the "Module Def" is clean and then reinstall it.

konradbr commented 10 months ago

CAUTION: Manual DB operations — have necessary backups & use at your own risk.

SQL:

use {{your_db_name}};
delete from `tabModule Def` where `app_name` = 'erpnextswiss';