"I have two doctypes: WMC and WM. In WMC, there is a field called “weapon_category,” which is configured as a link field to WM and has been selected as the title field in WCM, as shown in the WCM.png image.
Now, in the WM doctype, when I add the “weapon_category” field to the List Settings, I encounter a server error. However, if I don’t select the “weapon_category” field in the List Settings, there is no error. Also, if I uncheck “SHOW Title In link Field,” then it works fine. However, I need to display it in my list view.
How can I resolve this issue?
ERROR:
App Versions
{
"frappe": "14.50.0",
"weapon_management": "0.0.1"
}
Route
List/Weapon Master/List
Traceback
Error in query:
column "tabWeapon Category Master.weapon_category" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ..."."status", "tabWeapon Master"."weapon_category", "tabWeapon...
^
Traceback (most recent call last):
File "apps/frappe/frappe/app.py", line 95, 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/__init__.py", line 802, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
File "apps/frappe/frappe/desk/reportview.py", line 29, in get
data = compress(execute(**args), args=args)
File "apps/frappe/frappe/desk/reportview.py", line 65, in execute
return 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/postgres/database.py", line 199, in sql
return super().sql(modify_query(query), modify_values(values), *args, **kwargs)
File "apps/frappe/frappe/database/database.py", line 220, in sql
self._cursor.execute(query, values)
psycopg2.errors.GroupingError: column "tabWeapon Category Master.weapon_category" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ..."."status", "tabWeapon Master"."weapon_category", "tabWeapon...
^
Request Data
{
"type": "POST",
"args": {
"doctype": "Weapon Master",
"fields": "[\"`tabWeapon Master`.`name`\",\"`tabWeapon Master`.`owner`\",\"`tabWeapon Master`.`creation`\",\"`tabWeapon Master`.`modified`\",\"`tabWeapon Master`.`modified_by`\",\"`tabWeapon Master`.`_user_tags`\",\"`tabWeapon Master`.`_comments`\",\"`tabWeapon Master`.`_assign`\",\"`tabWeapon Master`.`_liked_by`\",\"`tabWeapon Master`.`docstatus`\",\"`tabWeapon Master`.`idx`\",\"`tabWeapon Master`.`status`\",\"`tabWeapon Master`.`weapon_category`\",\"weapon_category.weapon_category as weapon_category_weapon_category\"]",
"filters": "[]",
"order_by": "`tabWeapon Master`.`modified` DESC",
"start": 0,
"page_length": 20,
"view": "List",
"group_by": "`tabWeapon Master`.`name`",
"with_comment_count": true
},
"freeze": false,
"freeze_message": "Loading...",
"headers": {},
"error_handlers": {},
"url": "/api/method/frappe.desk.reportview.get"
}
Response Data
{
"exception": ""
}
Image references are included for clarification."