Description
Description of the issue
We have setup frappe on PostgreSQL Database and while creating workflow, we are getting an "Server Error" and I have added the error contents for your reference. Kindly check and let us know how to resolve this issue.
Context information (for bug reports)
Output of bench version
v13.17.0 (version-13)
Steps to reproduce the issue
- Go to "workflow" Doctype and create a new workflow for any of the doctype you wish.
- I checked workflow status will not override status in list view as false and saved the workflow.
- And a server error popup message occurs and the workflow is also not working on the desired Doctype.
Observed result
Expected result
A workflow should be created successfully and the workflow should work on the selected Doctype.
Stacktrace / full error message
### App Versions
{
"frappe": "13.17.0",
"upkatalog": "0.0.1"
}
### Route
Form/Workflow/Item Workflow
### Trackeback
Traceback (most recent call last):
File "apps/frappe/frappe/app.py", line 68, in application
response = frappe.api.handle()
File "apps/frappe/frappe/api.py", line 55, in handle
return frappe.handler.handle()
File "apps/frappe/frappe/handler.py", line 31, in handle
data = execute_cmd(cmd)
File "apps/frappe/frappe/handler.py", line 67, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "apps/frappe/frappe/init.py", line 1208, in call
return fn(*args, **newargs)
File "apps/frappe/frappe/workflow/doctype/workflow/workflow.py", line 119, in get_workflow_state_count
result = frappe.get_all(
File "apps/frappe/frappe/init.py", line 1469, in get_all
return get_list(doctype, *args, **kwargs)
File "apps/frappe/frappe/init.py", line 1442, in get_list
return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)
File "apps/frappe/frappe/model/db_query.py", line 107, in execute
result = self.build_and_run()
File "apps/frappe/frappe/model/db_query.py", line 144, in build_and_run
return frappe.db.sql(query, as_dict=not self.as_list, debug=self.debug,
File "apps/frappe/frappe/database/postgres/database.py", line 105, in sql
return super(PostgresDatabase, self).sql(args, **kwargs)
File "apps/frappe/frappe/database/database.py", line 154, in sql
self._cursor.execute(query)
psycopg2.errors.GroupingError: column "tabItem.docstatus" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: select "workflow_state", count() as count, "docstatus"
^
### Request Data
{
"type": "POST",
"args": {
"doctype": "Item",
"workflow_state_field": "workflow_state",
"states": "["Pending","Approved"]"
},
"headers": {},
"error_handlers": {},
"url": "/api/method/frappe.workflow.doctype.workflow.workflow.get_workflow_state_count"
}
### Response Data
{
"exception": ""
}
Additional information
OS version / distribution, Frappe
install method, etc.