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

order by "tabItem Barcode"."modified" DESC #41341

Closed
zhengdechang opened this issue May 6, 2024 · 1 comment
Closed

order by "tabItem Barcode"."modified" DESC #41341

zhengdechang opened this issue May 6, 2024 · 1 comment
Labels

Comments

@zhengdechang
Copy link

Information about bug

App Versions

{
	"erpnext": "15.21.2",
	"frappe": "15.24.1"
}

Route

Form/BOM/new-bom-qdxwgdfqwd

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 110, 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 49, 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 1761, 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/desk/search.py", line 47, in search_link
    results = search_widget(
              ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/desk/search.py", line 94, in search_widget
    return frappe.call(
           ^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1761, 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 2516, in wrapper
    return fn(**kwargs)
           ^^^^^^^^^^^^
  File "apps/erpnext/erpnext/manufacturing/doctype/bom/bom.py", line 1410, in item_query
    barcodes = frappe.get_all(
               ^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 2050, in get_all
    return get_list(doctype, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 2025, in get_list
    return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/db_query.py", line 191, in execute
    result = self.build_and_run()
             ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/db_query.py", line 232, in build_and_run
    return frappe.db.sql(
           ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/postgres/database.py", line 213, in sql
    return super().sql(modify_query(query), modify_values(values), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/database.py", line 234, in sql
    self._cursor.execute(query, values)
psycopg2.errors.InvalidColumnReference: for SELECT DISTINCT, ORDER BY expressions must appear in select list
LINE 5:     order by "tabItem Barcode"."modified" DESC
                     ^


Request Data

{
	"type": "POST",
	"args": {
		"txt": "test",
		"doctype": "Item",
		"ignore_user_permissions": 0,
		"reference_doctype": "BOM",
		"page_length": 10,
		"query": "erpnext.manufacturing.doctype.bom.bom.item_query",
		"filters": "{\"is_stock_item\":1}"
	},
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.search.search_link",
	"request_id": null
}

Response Data

{
	"exception": "",
	"exc_type": "InvalidColumnReference",
	"_exc_source": "erpnext (app)",
	"_debug_messages": "[\"Error in query:\\nfor SELECT DISTINCT, ORDER BY expressions must appear in select list\\nLINE 5:     order by \\\"tabItem Barcode\\\".\\\"modified\\\" DESC\\n                     ^\\n\"]"
}

Module

CRM

Version

{
"erpnext": "15.21.2",
"frappe": "15.24.1"
}

Installation method

docker

Relevant log output / Stack trace / Full Error Message.

11
@nabinhait
Copy link
Member

Can't replicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants