8848digital / hrms

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

Server Error while submitting the expense claim with status approved #8

Closed balamurugan8848 closed 2 weeks ago

balamurugan8848 commented 2 weeks ago

Information about bug

while submitting the Expense Claim the below server error occurs.

Image

Module

HR

Version

Frappe HR: v15.36.1 (pre-prod) ERPNext: v15.50.0 (pre-prod) Frappe Framework: v15.52.0 (pre-prod)

Installation method

None

Relevant log output / Stack trace / Full Error Message.

### App Versions

{
    "assets": "0.0.1",
    "crm": "2.0.0-dev",
    "custom_crm": "0.0.1",
    "erpnext": "15.50.0",
    "erpnext_india": "0.0.1",
    "exotel_integration": "0.0.1",
    "frappe": "15.52.0",
    "helpdesk": "1.4.0",
    "hr_addon": "0.0.1",
    "hrms": "15.36.1",
    "india_compliance": "15.15.0",
    "insights": "3.0.0",
    "payments": "0.0.1",
    "print_designer": "1.4.3",
    "projects": "0.0.1",
    "sales_commission": "0.0.1",
    "transportation": "0.0.1"
}

### Route

Form/Expense Claim/HR-EXP-2025-00002

### 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 50, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 86, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1758, 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/form/save.py", line 37, in savedocs
    doc.submit()
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1063, in submit
    return self._submit()
  File "apps/frappe/frappe/model/document.py", line 1046, in _submit
    return self.save()
  File "apps/frappe/frappe/model/document.py", line 345, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 398, in _save
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1146, in run_post_save_methods
    self.run_method("on_submit")
  File "apps/frappe/frappe/model/document.py", line 977, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1337, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1319, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 974, in fn
    return method_object(*args, **kwargs)
  File "apps/hrms/hrms/hr/doctype/expense_claim/expense_claim.py", line 111, in on_submit
    self.update_claimed_amount_in_employee_advance()
  File "apps/hrms/hrms/hr/doctype/expense_claim/expense_claim.py", line 131, in update_claimed_amount_in_employee_advance
    frappe.get_doc("Employee Advance", d.employee_advance).update_claimed_amount()
  File "apps/hrms/hrms/hr/doctype/employee_advance/employee_advance.py", line 146, in update_claimed_amount
    frappe.db.sql(
  File "apps/frappe/frappe/database/postgres/database.py", line 326, in sql
    return super().sql(modify_query(query), modify_values(values), *args, **kwargs)
  File "apps/frappe/frappe/database/database.py", line 236, in sql
    self._cursor.execute(query, values)
psycopg2.errors.UndefinedColumn: column "Approved" does not exist
LINE 5:     AND ec.approval_status="Approved"
                                   ^

### Request Data

{
    "type": "POST",
    "args": {
        "doc": "{\"name\":\"HR-EXP-2025-00002\",\"owner\":\"Administrator\",\"creation\":\"2025-03-05 11:29:19.841731\",\"modified\":\"2025-03-05 11:29:39.890380\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":0,\"naming_series\":\"HR-EXP-.YYYY.-\",\"employee\":\"HR-EMP-00002\",\"employee_name\":\"Deepa\",\"company\":\"8848 Digital\",\"company_gstin\":\"\",\"expense_approver\":\"Administrator\",\"approval_status\":\"Approved\",\"total_sanctioned_amount\":10000,\"total_taxes_and_charges\":0,\"total_advance_amount\":8500,\"grand_total\":1500,\"total_claimed_amount\":10000,\"total_amount_reimbursed\":0,\"posting_date\":\"2025-03-05\",\"is_paid\":0,\"mode_of_payment\":\"Cash\",\"payable_account\":\"Creditors - 8D\",\"cost_center\":\"Main - 8D\",\"status\":\"Draft\",\"doctype\":\"Expense Claim\",\"taxes\":[],\"advances\":[{\"name\":\"q96rtcrhi5\",\"owner\":\"Administrator\",\"creation\":\"2025-03-05 11:29:19.841731\",\"modified\":\"2025-03-05 11:29:39.890380\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":1,\"employee_advance\":\"HR-EAD-2025-00001\",\"posting_date\":\"2025-03-05\",\"advance_paid\":8500,\"unclaimed_amount\":8500,\"allocated_amount\":8500,\"advance_account\":\"Advances - 8D\",\"parent\":\"HR-EXP-2025-00002\",\"parentfield\":\"advances\",\"parenttype\":\"Expense Claim\",\"doctype\":\"Expense Claim Advance\"}],\"expenses\":[{\"name\":\"v885esi16g\",\"owner\":\"Administrator\",\"creation\":\"2025-03-05 11:29:19.841731\",\"modified\":\"2025-03-05 11:29:39.890380\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":1,\"expense_date\":\"2025-03-05\",\"expense_type\":\"Stall Expense\",\"default_account\":\"Administrative Expenses - 8D\",\"amount\":10000,\"sanctioned_amount\":10000,\"cost_center\":\"Main - 8D\",\"parent\":\"HR-EXP-2025-00002\",\"parentfield\":\"expenses\",\"parenttype\":\"Expense Claim\",\"doctype\":\"Expense Claim Detail\"}],\"__onload\":{\"make_payment_via_journal_entry\":0},\"__last_sync_on\":\"2025-03-05T06:00:55.405Z\"}",
        "action": "Submit"
    },
    "btn": {
        "jQuery3700407998483557705741": {
            "events": {
                "click": [
                    {
                        "type": "click",
                        "origType": "click",
                        "guid": 252,
                        "namespace": ""
                    }
                ]
            }
        }
    },
    "freeze": true,
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe.desk.form.save.savedocs",
    "request_id": null
}

### Response Data

{
    "exception": "",
    "exc_type": "UndefinedColumn",
    "_exc_source": "hrms (app)",
    "_debug_messages": "[\"Error in query:\\ncolumn \\\"Approved\\\" does not exist\\nLINE 5:     AND ec.approval_status=\\\"Approved\\\"\\n                                   ^\\n\"]"
}

Code of Conduct

balamurugan8848 commented 2 weeks ago

@hrishikesh8848 @Satya8848

hrishikesh8848 commented 2 weeks ago

@balamurugan8848 this is fixed, please check and close it

balamurugan8848 commented 2 weeks ago

@hrishikesh8848 It's working fine, and the issue is closed.