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

Deferred Revenue & Expense report getting error #136

Closed 8848swa closed 1 month ago

8848swa commented 1 month ago

Information about bug

image

Module

accounts

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

query-report/Deferred Revenue and Expense

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/desk/query_report.py", line 223, in run
    result = generate_report_result(report, filters, user, custom_columns, is_tree, parent_field)
  File "apps/frappe/frappe/__init__.py", line 928, in wrapper_fn
    retval = fn(*args, **get_newargs(fn, kwargs))
  File "apps/frappe/frappe/desk/query_report.py", line 84, in generate_report_result
    res = get_report_result(report, filters) or []
  File "apps/frappe/frappe/desk/query_report.py", line 65, in get_report_result
    res = report.execute_script_report(filters)
  File "apps/frappe/frappe/core/doctype/report/report.py", line 163, in execute_script_report
    res = self.execute_module(filters)
  File "apps/frappe/frappe/core/doctype/report/report.py", line 180, in execute_module
    return frappe.get_attr(method_name)(frappe._dict(filters))
  File "apps/erpnext/erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.py", line 431, in execute
    report.run()
  File "apps/erpnext/erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.py", line 422, in run
    self.get_invoices()
  File "apps/erpnext/erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.py", line 321, in get_invoices
    self.invoices = query.run(as_dict=True)
  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.UndefinedColumn: column "posted" does not exist
LINE 1: ...it") "debit",SUM("tabGL Entry"."credit") "credit","posted" F...
                                                             ^

During handling of the above exception, another exception occurred:

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/query_report.py", line 226, in run
    frappe.log_error("Report Error")
  File "apps/frappe/frappe/utils/error.py", line 61, in log_error
    error_log = frappe.get_doc(
  File "apps/frappe/frappe/__init__.py", line 1340, in get_doc
    doc = frappe.model.document.get_doc(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 83, in get_doc
    controller = get_controller(doctype)
  File "apps/frappe/frappe/model/base_document.py", line 70, in get_controller
    site_controllers[doctype] = import_controller(doctype)
  File "apps/frappe/frappe/model/base_document.py", line 81, in import_controller
    doctype_info = frappe.db.get_value("DocType", doctype, fieldname="*")
  File "apps/frappe/frappe/database/database.py", line 512, in get_value
    result = self.get_values(
  File "apps/frappe/frappe/database/database.py", line 616, in get_values
    out = self._get_values_from_table(
  File "apps/frappe/frappe/database/database.py", line 889, in _get_values_from_table
    return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
  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.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction block

Request Data

{
    "type": "GET",
    "args": {
        "report_name": "Deferred Revenue and Expense",
        "filters": "{\"company\":\"8848 Digital\",\"filter_based_on\":\"Fiscal Year\",\"period_start_date\":\"2024-04-01\",\"period_end_date\":\"2025-03-31\",\"from_fiscal_year\":\"2024-2025\",\"to_fiscal_year\":\"2024-2025\",\"periodicity\":\"Monthly\",\"type\":\"Revenue\",\"with_upcoming_postings\":1}",
        "ignore_prepared_report": false,
        "are_default_filters": false
    },
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe.desk.query_report.run",
    "request_id": null
}

Response Data

{
    "exception": "",
    "exc_type": "InFailedSqlTransaction",
    "_exc_source": "erpnext (app)",
    "_debug_messages": "[\"Error in query:\\ncolumn \\\"posted\\\" does not exist\\nLINE 1: ...it\\\") \\\"debit\\\",SUM(\\\"tabGL Entry\\\".\\\"credit\\\") \\\"credit\\\",\\\"posted\\\" F...\\n                                                             ^\\n\", \"Error in query:\\ncurrent transaction is aborted, commands ignored until end of transaction block\\n\"]"
}
aasif-patel commented 1 month ago

Resolved hence closing...