Server Error on DocType List View

I have 2 DocType 1. Unit Master and 2. Weapon In. I have set naming rule in both on autoincrement. (Refer Image 1 and 2). In Weapon In, Unit Location is a link filed to the Unit Master. (Refer Image 3). When I am going to List View of Weapon In I can see all documents. (Refer Image 4). In View Setting of Unit Master DocType, when I am selecting the Title Filed “unit_location” and checking the Show Title in Link Fields (Refer Image 5), then I am getting Server Side Error on List View of Weapon In DocType (Refer Image 6). I have also attached the error message. I am using PostgreSQL Database.






Error Message:

### App Versions

{
“frappe”: “14.50.0”,
“weapon_management”: “0.0.1”
}

### Route

List/Weapon In/List

### Traceback

Error in query:
column “tabUnit Master.unit_location” must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: …pon In".“source”, “tabWeapon In”.“unit_location”, "tabUnit M…
^

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 “tabUnit Master.unit_location” must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: …pon In".“source”, “tabWeapon In”.“unit_location”, "tabUnit M…
^

### Request Data

{
“type”: “POST”,
“args”: {
“doctype”: “Weapon In”,
“fields”: “["tabWeapon In.name","tabWeapon In.owner","tabWeapon In.creation","tabWeapon In.modified","tabWeapon In.modified_by","tabWeapon In._user_tags","tabWeapon In._comments","tabWeapon In._assign","tabWeapon In._liked_by","tabWeapon In.docstatus","tabWeapon In.idx","tabWeapon In.source","tabWeapon In.unit_location","unit_location.unit_location as unit_location_unit_location"]”,
“filters”: “[]”,
“order_by”: “tabWeapon In.unit_location desc”,
“start”: 0,
“page_length”: 20,
“view”: “List”,
“group_by”: “tabWeapon In.name”,
“with_comment_count”: true
},
“freeze”: false,
“freeze_message”: “Loading…”,
“headers”: {},
“error_handlers”: {},
“url”: “/api/method/frappe.desk.reportview.get”
}

### Response Data

{
“exception”: “”
}

This a major issue as list views are just not working with link fields