Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When applying Filter for Options on custom field list getting error #937

Closed
aasif-patel opened this issue Jan 3, 2025 · 1 comment · Fixed by 8848digital/frappe-v15#52
Assignees
Labels
bug Something isn't working Custom Fields

Comments

@aasif-patel
Copy link
Collaborator

Information about bug

image

Goto Custom field list => Apply filter for Options = Equals = "" (Empty String)

App Versions

{
	"assets": "0.0.1",
	"crm": "0.0.1",
	"erpnext": "15.47.1",
	"frappe": "15.51.0",
	"india_compliance": "15.14.6",
	"payments": "0.0.1",
	"projects": "0.0.1",
	"sales_commission": "0.0.1"
}

Route

List/Custom Field/List

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 1726, 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 879, in wrapper_fn
    retval = fn(*args, **get_newargs(fn, kwargs))
  File "apps/frappe/frappe/desk/reportview.py", line 32, in get
    data = compress(execute(**args), args=args)
  File "apps/frappe/frappe/desk/reportview.py", line 80, in execute
    return 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 237, in build_and_run
    return 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 230, in sql
    self._cursor.execute(query, values)
psycopg2.errors.DatatypeMismatch: COALESCE types text and integer cannot be matched
LINE 3:    where coalesce("tabCustom Field"."options", 0) = '0' and ...
                                                       ^


Request Data

{
	"type": "POST",
	"args": {
		"doctype": "Custom Field",
		"fields": "[\"`tabCustom Field`.`name`\",\"`tabCustom Field`.`owner`\",\"`tabCustom Field`.`creation`\",\"`tabCustom Field`.`modified`\",\"`tabCustom Field`.`modified_by`\",\"`tabCustom Field`.`_user_tags`\",\"`tabCustom Field`.`_comments`\",\"`tabCustom Field`.`_assign`\",\"`tabCustom Field`.`_liked_by`\",\"`tabCustom Field`.`docstatus`\",\"`tabCustom Field`.`idx`\",\"`tabCustom Field`.`dt`\",\"`tabCustom Field`.`fieldname`\",\"`tabCustom Field`.`fieldtype`\",\"`tabCustom Field`.`options`\",\"`tabCustom Field`.`reqd`\"]",
		"filters": "[[\"Custom Field\",\"options\",\"=\",null],[\"Custom Field\",\"dt\",\"=\",\"Supplier\"]]",
		"order_by": "`tabCustom Field`.`modified` desc",
		"start": 0,
		"page_length": 40,
		"view": "List",
		"group_by": null,
		"with_comment_count": 1
	},
	"freeze": false,
	"freeze_message": "Loading...",
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.reportview.get",
	"request_id": null
}

Response Data

{
	"exception": "",
	"exc_type": "DatatypeMismatch",
	"_debug_messages": "[\"Error in query:\\nCOALESCE types text and integer cannot be matched\\nLINE 3:    where coalesce(\\\"tabCustom Field\\\".\\\"options\\\", 0) = '0' and ...\\n                                                       ^\\n\"]"
}

Module

other

Version

ERPNext V15

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

No response

@aasif-patel aasif-patel added bug Something isn't working Custom Fields labels Jan 3, 2025
@sibikumarkuppusamy sibikumarkuppusamy self-assigned this Jan 3, 2025
@tinadn
Copy link

tinadn commented Jan 17, 2025

Working fine. Hence closing.

@tinadn tinadn closed this as completed Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Custom Fields
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants