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 when setting filters in Income Tax Computation Report #23

Closed balamurugan8848 closed 2 weeks ago

balamurugan8848 commented 2 weeks ago

Information about bug

While opening and setting filters in the Income Tax Computation Report the following error occurs.

Image

Module

Payroll

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

query-report/Income Tax Computation

### 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/__init__.py", line 909, in wrapper_fn
    retval = fn(*args, **get_newargs(fn, kwargs))
  File "apps/frappe/frappe/desk/query_report.py", line 224, in run
    result = generate_report_result(report, filters, user, custom_columns, is_tree, parent_field)
  File "apps/frappe/frappe/__init__.py", line 909, in wrapper_fn
    retval = fn(*args, **get_newargs(fn, kwargs))
  File "apps/frappe/frappe/desk/query_report.py", line 84, in generate_report_result
    res = get_report_result(report, filters) or []
  File "apps/frappe/frappe/desk/query_report.py", line 65, in get_report_result
    res = report.execute_script_report(filters)
  File "apps/frappe/frappe/core/doctype/report/report.py", line 163, in execute_script_report
    res = self.execute_module(filters)
  File "apps/frappe/frappe/core/doctype/report/report.py", line 180, in execute_module
    return frappe.get_attr(method_name)(frappe._dict(filters))
  File "apps/hrms/hrms/payroll/report/income_tax_computation/income_tax_computation.py", line 14, in execute
    return IncomeTaxComputationReport(filters).run()
  File "apps/hrms/hrms/payroll/report/income_tax_computation/income_tax_computation.py", line 32, in run
    self.get_data()
  File "apps/hrms/hrms/payroll/report/income_tax_computation/income_tax_computation.py", line 39, in get_data
    self.get_tax_exempted_earnings_and_deductions()
  File "apps/hrms/hrms/payroll/report/income_tax_computation/income_tax_computation.py", line 208, in get_tax_exempted_earnings_and_deductions
    records = (
  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/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.GroupingError: column "tabSalary Slip.name" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT "tabSalary Slip"."name","tabSalary Slip"."employee","...
               ^

### Request Data

{
    "type": "GET",
    "args": {
        "report_name": "Income Tax Computation",
        "filters": "{\"company\":\"8848 Digital\",\"payroll_period\":\"2024-2025\"}",
        "ignore_prepared_report": false,
        "are_default_filters": false
    },
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe.desk.query_report.run",
    "request_id": null
}

### Response Data

{
    "exception": "",
    "exc_type": "GroupingError",
    "_exc_source": "hrms (app)",
    "_server_messages": "[\"{\\\"message\\\": \\\"Added tax components from the Salary Component master as the salary structure didn't have any tax component.\\\", \\\"title\\\": \\\"Message\\\", \\\"indicator\\\": \\\"blue\\\", \\\"alert\\\": 1}\", \"{\\\"message\\\": \\\"Added tax components from the Salary Component master as the salary structure didn't have any tax component.\\\", \\\"title\\\": \\\"Message\\\", \\\"indicator\\\": \\\"blue\\\", \\\"alert\\\": 1}\", \"{\\\"message\\\": \\\"Added tax components from the Salary Component master as the salary structure didn't have any tax component.\\\", \\\"title\\\": \\\"Message\\\", \\\"indicator\\\": \\\"blue\\\", \\\"alert\\\": 1}\", \"{\\\"message\\\": \\\"Added tax components from the Salary Component master as the salary structure didn't have any tax component.\\\", \\\"title\\\": \\\"Message\\\", \\\"indicator\\\": \\\"blue\\\", \\\"alert\\\": 1}\", \"{\\\"message\\\": \\\"Added tax components from the Salary Component master as the salary structure didn't have any tax component.\\\", \\\"title\\\": \\\"Message\\\", \\\"indicator\\\": \\\"blue\\\", \\\"alert\\\": 1}\", \"{\\\"message\\\": \\\"Added tax components from the Salary Component master as the salary structure didn't have any tax component.\\\", \\\"title\\\": \\\"Message\\\", \\\"indicator\\\": \\\"blue\\\", \\\"alert\\\": 1}\", \"{\\\"message\\\": \\\"Added tax components from the Salary Component master as the salary structure didn't have any tax component.\\\", \\\"title\\\": \\\"Message\\\", \\\"indicator\\\": \\\"blue\\\", \\\"alert\\\": 1}\", \"{\\\"message\\\": \\\"Added tax components from the Salary Component master as the salary structure didn't have any tax component.\\\", \\\"title\\\": \\\"Message\\\", \\\"indicator\\\": \\\"blue\\\", \\\"alert\\\": 1}\", \"{\\\"message\\\": \\\"Added tax components from the Salary Component master as the salary structure didn't have any tax component.\\\", \\\"title\\\": \\\"Message\\\", \\\"indicator\\\": \\\"blue\\\", \\\"alert\\\": 1}\", \"{\\\"message\\\": \\\"Added tax components from the Salary Component master as the salary structure didn't have any tax component.\\\", \\\"title\\\": \\\"Message\\\", \\\"indicator\\\": \\\"blue\\\", \\\"alert\\\": 1}\", \"{\\\"message\\\": \\\"Added tax components from the Salary Component master as the salary structure didn't have any tax component.\\\", \\\"title\\\": \\\"Message\\\", \\\"indicator\\\": \\\"blue\\\", \\\"alert\\\": 1}\", \"{\\\"message\\\": \\\"Added tax components from the Salary Component master as the salary structure didn't have any tax component.\\\", \\\"title\\\": \\\"Message\\\", \\\"indicator\\\": \\\"blue\\\", \\\"alert\\\": 1}\", \"{\\\"message\\\": \\\"Added tax components from the Salary Component master as the salary structure didn't have any tax component.\\\", \\\"title\\\": \\\"Message\\\", \\\"indicator\\\": \\\"blue\\\", \\\"alert\\\": 1}\"]",
    "_debug_messages": "[\"Error in query:\\ncolumn \\\"tabSalary Slip.name\\\" must appear in the GROUP BY clause or be used in an aggregate function\\nLINE 1: SELECT \\\"tabSalary Slip\\\".\\\"name\\\",\\\"tabSalary Slip\\\".\\\"employee\\\",\\\"...\\n               ^\\n\"]"
}

Code of Conduct

balamurugan8848 commented 2 weeks ago

@hrishikesh8848 @Satya8848

hrishikesh8848 commented 2 weeks ago

@balamurugan8848 this is fixed

balamurugan8848 commented 2 weeks ago

@hrishikesh8848 it is working fine and closing this issue.