frappe / lms

Easy to Use, 100% Open Source Learning Management System
https://frappe.io/learning
GNU Affero General Public License v3.0
914 stars 412 forks source link

Unknown column 'tabLMS Course.grant_certificate_after #938

Open johnwslongland opened 1 month ago

johnwslongland commented 1 month ago

Describe the bug Created Course, Chapter, Lesson, Batch on LMS system When creating New LMS Certificate Evaluation and clicking on "Course" field an exception is thrown.

To Reproduce Steps to reproduce the behavior:

  1. Create Course, chapter, lesson, batch
  2. Create New LMS Certificate Evaluation
  3. Exception thrown
  4. Trace back of exception :

App Versions

{
    "education": "15.5.0",
    "erpnext": "15.30.0",
    "frappe": "15.35.0",
    "lms": "2.0.0"
}

Route

Form/LMS Certificate Evaluation/new-lms-certificate-evaluation-upwnivqrqm

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 114, in application
    response = frappe.api.handle(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1768, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/desk/search.py", line 47, in search_link
    results = search_widget(
              ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/desk/search.py", line 193, in search_widget
    values = frappe.get_list(
             ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 2032, in get_list
    return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/db_query.py", line 191, in execute
    result = self.build_and_run()
             ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/db_query.py", line 232, in build_and_run
    return frappe.db.sql(
           ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/database.py", line 234, in sql
    self._cursor.execute(query, values)
  File "env/lib/python3.12/site-packages/pymysql/cursors.py", line 153, in execute
    result = self._query(query)
             ^^^^^^^^^^^^^^^^^^
  File "env/lib/python3.12/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
  File "env/lib/python3.12/site-packages/pymysql/connections.py", line 563, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "env/lib/python3.12/site-packages/pymysql/connections.py", line 825, in _read_query_result
    result.read()
  File "env/lib/python3.12/site-packages/pymysql/connections.py", line 1199, in read
    first_packet = self.connection._read_packet()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "env/lib/python3.12/site-packages/pymysql/connections.py", line 775, in _read_packet
    packet.raise_for_error()
  File "env/lib/python3.12/site-packages/pymysql/protocol.py", line 219, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "env/lib/python3.12/site-packages/pymysql/err.py", line 150, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, "Unknown column 'tabLMS Course.grant_certificate_after' in 'where clause'")

Request Data

{
    "type": "POST",
    "args": {
        "txt": "",
        "doctype": "LMS Course",
        "ignore_user_permissions": 0,
        "reference_doctype": "LMS Certificate Evaluation",
        "page_length": 10,
        "filters": "{\"enable_certification\":true,\"grant_certificate_after\":\"Evaluation\"}"
    },
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe.desk.search.search_link",
    "request_id": null
}

Response Data

{
    "exception": "pymysql.err.OperationalError: (1054, \"Unknown column 'tabLMS Course.grant_certificate_after' in 'where clause'\")",
    "exc_type": "OperationalError"
}

Expected behavior No exception

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information): Ubuntu 23.10 Broswer Firefoz

Smartphone (please complete the following information): None

Additional context None

pateljannat commented 1 month ago

@johnwslongland please try updating and migrating your site

maksimvelbaum commented 1 week ago

@pateljannat Hi , I can confirm that error exists , I have same problem

Frappe Framework: v15.x.x-develop () (develop)

Frappe LMS: v2.3.0 (develop)

image

`### App Versions

{
    "frappe": "16.0.0-dev",
    "lms": "2.3.0"
}

Route

Form/LMS Certificate Evaluation/new-lms-certificate-evaluation-nbnrualiva

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 114, in application
    response = frappe.api.handle(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1818, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 32, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/desk/search.py", line 47, in search_link
    results = search_widget(
              ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 32, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/desk/search.py", line 193, in search_widget
    values = frappe.get_list(
             ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 2082, in get_list
    return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/db_query.py", line 193, in execute
    result = self.build_and_run()
             ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/db_query.py", line 234, in build_and_run
    return frappe.db.sql(
           ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/database.py", line 236, in sql
    self._cursor.execute(query, values)
  File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 153, in execute
    result = self._query(query)
             ^^^^^^^^^^^^^^^^^^
  File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
  File "env/lib/python3.11/site-packages/pymysql/connections.py", line 563, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "env/lib/python3.11/site-packages/pymysql/connections.py", line 825, in _read_query_result
    result.read()
  File "env/lib/python3.11/site-packages/pymysql/connections.py", line 1199, in read
    first_packet = self.connection._read_packet()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "env/lib/python3.11/site-packages/pymysql/connections.py", line 775, in _read_packet
    packet.raise_for_error()
  File "env/lib/python3.11/site-packages/pymysql/protocol.py", line 219, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "env/lib/python3.11/site-packages/pymysql/err.py", line 150, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, "Unknown column 'tabLMS Course.grant_certificate_after' in 'where clause'")

Request Data

{
    "type": "POST",
    "args": {
        "txt": "",
        "doctype": "LMS Course",
        "ignore_user_permissions": 0,
        "reference_doctype": "LMS Certificate Evaluation",
        "page_length": 10,
        "filters": "{\"enable_certification\":true,\"grant_certificate_after\":\"Evaluation\"}"
    },
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe.desk.search.search_link",
    "request_id": null
}

Response Data

{
    "exception": "pymysql.err.OperationalError: (1054, \"Unknown column 'tabLMS Course.grant_certificate_after' in 'where clause'\")",
    "exc_type": "OperationalError"
}
Mutantpenguin commented 1 week ago

Same problem on frappe cloud with these versions: