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

Request for Raw Material creation through sales order create button getting error #147

Closed
8848swa opened this issue Oct 1, 2024 · 1 comment · Fixed by #173
Closed
Assignees
Labels
bug Something isn't working Material Request

Comments

@8848swa
Copy link
Collaborator

8848swa commented Oct 1, 2024

Information about bug

image
image

Module

selling

Version

"erpnext": "15.34.0",
"frappe": "15.41.0",

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

### App Versions

{
	"erpnext": "15.34.0",
	"frappe": "15.41.0",
	"payments": "0.0.1"
}

Route

Form/Sales Order/SAL-ORD-2024-00003

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 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 1775, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/erpnext/erpnext/selling/doctype/sales_order/sales_order.py", line 1559, in make_raw_material_request
    raw_materials = get_items_for_material_requests(items)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py", line 1539, in get_items_for_material_requests
    item_details = get_subitems(
  File "apps/erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py", line 1172, in get_subitems
    items = (
  File "apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query
    result = frappe.db.sql(query, params, *args, **kwargs)  # nosemgrep
  File "apps/frappe/frappe/database/postgres/database.py", line 218, in sql
    return super().sql(modify_query(query), modify_values(values), *args, **kwargs)
  File "apps/frappe/frappe/database/database.py", line 227, in sql
    self._cursor.execute(query, values)
psycopg2.errors.GroupingError: column "tabItem.default_material_request_type" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT "tabBOM Item"."item_code","tabItem"."default_material...
                                         ^


Request Data

{
	"type": "POST",
	"args": {
		"items": "{\"include_exploded_items\":0,\"ignore_existing_ordered_qty\":0,\"items\":[{\"name\":\"fa5kqleqb9\",\"item_code\":\"_Test FG Item 2\",\"description\":\"_Test FG Item 2 11\",\"bom\":\"BOM-_Test FG Item 2-002\",\"warehouse\":\"Stores - 8D\",\"pending_qty\":1,\"required_qty\":1,\"sales_order_item\":\"fa5kqleqb9\",\"idx\":1},{\"name\":\"fa5ktlkdfc\",\"item_code\":\"_Test FG Item 2\",\"description\":\"_Test FG Item 2 11\",\"bom\":\"BOM-_Test FG Item 2-002\",\"warehouse\":\"Stores - 8D\",\"pending_qty\":562,\"required_qty\":562,\"sales_order_item\":\"fa5ktlkdfc\",\"idx\":2}]}",
		"company": "8848 Digital",
		"sales_order": "SAL-ORD-2024-00003"
	},
	"freeze": true,
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/erpnext.selling.doctype.sales_order.sales_order.make_raw_material_request",
	"request_id": null
}

Response Data

{
	"exception": "",
	"exc_type": "GroupingError",
	"_exc_source": "erpnext (app)",
	"_debug_messages": "[\"Error in query:\\ncolumn \\\"tabItem.default_material_request_type\\\" must appear in the GROUP BY clause or be used in an aggregate function\\nLINE 1: SELECT \\\"tabBOM Item\\\".\\\"item_code\\\",\\\"tabItem\\\".\\\"default_material...\\n                                         ^\\n\"]"
}
@aasif-patel
Copy link
Collaborator

Resolved hence closed

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working Material Request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants