8848digital / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
0 stars 0 forks source link

Stock: If you click on dashboard in Item getting server error #66

Closed 8848swa closed 2 weeks ago

8848swa commented 3 weeks ago

Information about bug

If you click on dashboard in Item getting server error image

Module

stock

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/Item/_Test FG Item 2

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/frappe/frappe/__init__.py", line 928, in wrapper_fn
    retval = fn(*args, **get_newargs(fn, kwargs))
  File "apps/frappe/frappe/desk/notifications.py", line 299, in get_open_count
    out["timeline_data"] = module.get_timeline_data(doctype, name)
  File "apps/erpnext/erpnext/stock/doctype/item/item.py", line 1098, in get_timeline_data
    .run()
  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.SyntaxError: syntax error at or near "("
LINE 1: ...item_code"='Test1' AND "posting_date">CURRENT_DATE()-INTERVA...
                                                             ^

Request Data

{
    "type": "GET",
    "args": {
        "doctype": "Item",
        "name": "Test1",
        "items": "[\"BOM\",\"Product Bundle\",\"Item Alternative\",\"Item Price\",\"Pricing Rule\",\"Quotation\",\"Sales Order\",\"Delivery Note\",\"Sales Invoice\",\"Material Request\",\"Supplier Quotation\",\"Request for Quotation\",\"Purchase Order\",\"Purchase Receipt\",\"Purchase Invoice\",\"Production Plan\",\"Work Order\",\"Item Manufacturer\",\"Serial No\",\"Batch\",\"Stock Entry\",\"Stock Reconciliation\"]"
    },
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe.desk.notifications.get_open_count",
    "request_id": null
}

Response Data

{
    "exception": "",
    "exc_type": "SyntaxError",
    "_exc_source": "erpnext (app)",
    "_debug_messages": "[\"Syntax error in query:\\nSELECT EXTRACT(epoch FROM \\\"posting_date\\\"),COUNT(*) FROM \\\"tabStock Ledger Entry\\\" WHERE \\\"item_code\\\"=%(param1)s AND \\\"posting_date\\\">CURRENT_DATE()-INTERVAL '1 YEAR' GROUP BY \\\"posting_date\\\" {'param1': 'Test1'}\"]"
}
aasif-patel commented 2 weeks ago

Resolved hence closing...