8848digital / Assets

MIT License
0 stars 2 forks source link

An error is occurring while attempting to scrap the asset. #57

Closed deepdoshi79 closed 3 weeks ago

deepdoshi79 commented 3 weeks ago

Information about bug

An error is occurring while attempting to scrap the asset.
Reference Asset : ACC-ASS-2024-01480 image

Module

assets

Version

Assets: v0.0.1 (pre-prod)

ERPNext: v15.34.0 (pre-prod)

Frappe Framework: v15.41.0 (pre-prod)

Installation method

None

Relevant log output / Stack trace / Full Error Message.

### App Versions

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

Route

Form/Asset/ACC-ASS-2024-01480

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/assets/assets/assets/doctype/asset/depreciation.py", line 527, in scrap_asset
    depreciate_asset(asset, date, notes)
  File "apps/assets/assets/assets/doctype/asset/depreciation.py", line 627, in depreciate_asset
    make_depreciation_entry_for_all_asset_depr_schedules(asset_doc, date)
  File "apps/assets/assets/assets/doctype/asset/depreciation.py", line 150, in make_depreciation_entry_for_all_asset_depr_schedules
    make_depreciation_entry(asset_depr_schedule_name, date)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/assets/assets/assets/doctype/asset/depreciation.py", line 276, in make_depreciation_entry
    asset.set_status()
  File "apps/assets/assets/assets/doctype/asset/asset.py", line 592, in set_status
    self.db_set("status", status)
  File "apps/frappe/frappe/model/document.py", line 1208, in db_set
    self.load_doc_before_save()
  File "apps/frappe/frappe/model/document.py", line 1112, in load_doc_before_save
    self._doc_before_save = frappe.get_doc(self.doctype, self.name, for_update=True)
  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 85, in get_doc
    return controller(*args, **kwargs)
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 98, in __init__
    super().__init__(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 126, in __init__
    self.load_from_db()
  File "apps/frappe/frappe/model/document.py", line 167, in load_from_db
    d = frappe.db.get_value(
  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 310, 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": "POST",
    "args": {
        "asset_name": "ACC-ASS-2024-01480",
        "scrap_date": "2024-11-04"
    },
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/assets.assets.doctype.asset.depreciation.scrap_asset",
    "request_id": null
}

Response Data

{
    "exception": "",
    "exc_type": "InFailedSqlTransaction",
    "_exc_source": "assets (app)",
    "_debug_messages": "[\"Error in query:\\ncolumn \\\"department\\\" does not exist\\nLINE 1: SELECT \\\"department\\\" FROM \\\"tabAsset Depreciation Schedule\\\" WH...\\n               ^\\n\", \"Error in query:\\ncurrent transaction is aborted, commands ignored until end of transaction block\\n\", \"Error in query:\\ncurrent transaction is aborted, commands ignored until end of transaction block\\n\"]"
}
rahulgupta8848 commented 3 weeks ago

https://github.com/8848digital/Assets/pull/62

deepdoshi79 commented 3 weeks ago

Functionality Working. Issue Resolved.