frappe / hrms

Open Source HR and Payroll Software
https://frappe.io/hr
GNU General Public License v3.0
1.39k stars 729 forks source link

1054, "Unknown column 'tabSalary Slip.total_loan_repayment' in 'field list'" #2323

Closed oleynikd closed 3 weeks ago

oleynikd commented 3 weeks ago

Information about bug

After updating to hrms v15.32.2 when I try to create a "Bank Entry" from "Payroll Entry" I get tthe exception listed below. Seems like it is because of this commit. I checked tabSalary Slip table, there is no column with name total_loan_repayment.

Module

HR, Payroll

Version

{
    "erpnext": "15.38.4",
    "frappe": "15.45.0",
    "hrms": "15.32.2",
    "print_designer": "1.4.3"
}

Installation method

docker

Relevant log output / Stack trace / Full Error Message.

### App Versions

{
    "erpnext": "15.38.4",
    "frappe": "15.45.0",
    "hrms": "15.32.2",
    "print_designer": "1.4.3"
}

Route

Form/Payroll Entry/HR-PRUN-2024-00007

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 1778, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 336, in run_doc_method
    response = doc.run_method(method, **args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/hrms/hrms/payroll/doctype/payroll_entry/payroll_entry.py", line 874, in make_bank_entry
    salary_slips = self.get_salary_slip_details(for_withheld_salaries)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/hrms/hrms/payroll/doctype/payroll_entry/payroll_entry.py", line 968, in get_salary_slip_details
    return query.run(as_dict=True)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query
    result = frappe.db.sql(query, params, *args, **kwargs)  # nosemgrep
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/database.py", line 227, 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 'tabSalary Slip.total_loan_repayment' in 'field list'")

Request Data

{
    "type": "POST",
    "args": {
        "method": "make_bank_entry",
        "dt": "Payroll Entry",
        "dn": "HR-PRUN-2024-00007",
        "args": "{\"for_withheld_salaries\":0}"
    },
    "freeze": true,
    "freeze_message": "Creating Payment Entries......",
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/run_doc_method",
    "request_id": null
}

Response Data

{
    "exception": "pymysql.err.OperationalError: (1054, \"Unknown column 'tabSalary Slip.total_loan_repayment' in 'field list'\")",
    "exc_type": "OperationalError",
    "_exc_source": "hrms (app)"
}


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
frappe-pr-bot commented 3 weeks ago

:tada: This issue has been resolved in version 15.33.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: