hrms icon indicating copy to clipboard operation
hrms copied to clipboard

Salary Slip creation failed for Payroll Entry

Open nguyenth1810 opened this issue 1 year ago • 2 comments

Information about bug

Failed to create Salary Slip for Payroll Entry

Module

Payroll

Version

ERPNext: v14.36.0 (version-14) Frappe Framework: v14.46.0 (version-14) Frappe HR: v14.10.3 (version-14)

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

App Versions

{
	"erpnext": "14.36.0",
	"frappe": "14.46.0",
	"hrms": "14.10.3"
}

Route

Form/Salary Slip/new-salary-slip-1

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 94, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 47, 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 1622, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/handler.py", line 306, in run_doc_method
    response = doc.run_method(method)
  File "apps/frappe/frappe/model/document.py", line 915, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1277, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1259, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 912, in fn
    return method_object(*args, **kwargs)
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip.py", line 259, in get_emp_and_working_day_details
    self.pull_sal_struct()
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip.py", line 339, in pull_sal_struct
    make_salary_slip(self._salary_structure_doc.name, self)
  File "apps/hrms/hrms/payroll/doctype/salary_structure/salary_structure.py", line 325, in make_salary_slip
    doc = get_mapped_doc(
  File "apps/frappe/frappe/model/mapper.py", line 148, in get_mapped_doc
    postprocess(source_doc, target_doc)
  File "apps/hrms/hrms/payroll/doctype/salary_structure/salary_structure.py", line 323, in postprocess
    target.run_method("process_salary_structure", for_preview=for_preview)
  File "apps/frappe/frappe/model/document.py", line 915, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1277, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1259, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 912, in fn
    return method_object(*args, **kwargs)
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip.py", line 1880, in process_salary_structure
    self.calculate_net_pay()
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip.py", line 647, in calculate_net_pay
    self.set_loan_repayment()
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip.py", line 1740, in set_loan_repayment
    for loan in self.get_loan_details():
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip.py", line 1778, in get_loan_details
    loan_details = frappe.get_all(
  File "apps/frappe/frappe/__init__.py", line 1939, in get_all
    return get_list(doctype, *args, **kwargs)
  File "apps/frappe/frappe/__init__.py", line 1911, in get_list
    return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)
  File "apps/frappe/frappe/model/db_query.py", line 196, in execute
    result = self.build_and_run()
  File "apps/frappe/frappe/model/db_query.py", line 236, in build_and_run
    return 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.OperationalError: (1054, "Unknown column 'tabLoan.repay_from_salary' in 'where clause'")

Request Data

{
	"type": "POST",
	"args": {
		"docs": "{\"docstatus\":0,\"doctype\":\"Salary Slip\",\"name\":\"new-salary-slip-1\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"Administrator\",\"posting_date\":\"2023-09-06\",\"status\":\"Draft\",\"company\":\"Unicloud\",\"currency\":\"VND\",\"exchange_rate\":1,\"payroll_frequency\":\"\",\"salary_slip_based_on_timesheet\":0,\"deduct_tax_for_unclaimed_employee_benefits\":0,\"deduct_tax_for_unsubmitted_tax_exemption_proof\":0,\"total_principal_amount\":0,\"total_interest_amount\":0,\"total_loan_repayment\":0,\"payroll_entry\":\"HR-PRUN-2023-00001\",\"employee_name\":\"Nguyên Hải Trần\",\"department\":\"Dịch vụ BigData\",\"designation\":\"Business Development Manager\",\"branch\":\"Hà Nội\",\"employee\":\"HR-EMP-00001\"}",
		"method": "get_emp_and_working_day_details"
	},
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/run_doc_method"
}

Response Data

{
	"exception": "pymysql.err.OperationalError: (1054, \"Unknown column 'tabLoan.repay_from_salary' in 'where clause'\")"
}

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

nguyenth1810 avatar Sep 06 '23 08:09 nguyenth1810

I also facing these bug. Please Provide me solution for these problem.

janakvaghela542 avatar Oct 16 '23 06:10 janakvaghela542

This field gets added to Loan on Frappe HR installation. Did you face any issues during installation?

ruchamahabal avatar Mar 04 '24 04:03 ruchamahabal

Not replicable. Closing as there was no response. Loan setup was fixed back then.

ruchamahabal avatar Sep 03 '24 06:09 ruchamahabal