fix: slow query

(cherry picked from commit 5ddb36af87)

# Conflicts:
#	erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
This commit is contained in:
Rohit Waghchaure
2025-03-26 21:50:18 +05:30
committed by Mergify
parent 2ed29d06d3
commit af0fb131a2
2 changed files with 14 additions and 6 deletions

View File

@@ -252,7 +252,6 @@ class DeprecatedBatchNoValuation:
from erpnext.stock.utils import get_combine_datetime
sle = frappe.qb.DocType("Stock Ledger Entry")
batch = frappe.qb.DocType("Batch")
posting_datetime = get_combine_datetime(self.sle.posting_date, self.sle.posting_time)
if not self.sle.creation:
@@ -267,8 +266,6 @@ class DeprecatedBatchNoValuation:
query = (
frappe.qb.from_(sle)
.inner_join(batch)
.on(sle.batch_no == batch.name)
.select(
sle.stock_value,
sle.qty_after_transaction,
@@ -276,7 +273,6 @@ class DeprecatedBatchNoValuation:
.where(
(sle.item_code == self.sle.item_code)
& (sle.warehouse == self.sle.warehouse)
& (sle.batch_no.isnotnull())
& (sle.is_cancelled == 0)
)
.where(timestamp_condition)

View File

@@ -250,6 +250,7 @@
},
{
"depends_on": "eval:doc.uom != doc.stock_uom",
"fetch_from": "item_code.stock_uom",
"fieldname": "stock_uom",
"fieldtype": "Link",
"label": "Stock UOM",
@@ -588,7 +589,8 @@
"label": "Serial and Batch Bundle",
"no_copy": 1,
"options": "Serial and Batch Bundle",
"print_hide": 1
"print_hide": 1,
"search_index": 1
},
{
"default": "0",
@@ -606,18 +608,28 @@
"fieldtype": "Column Break"
}
],
"grid_page_length": 50,
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
<<<<<<< HEAD
"modified": "2024-02-25 15:58:40.982582",
=======
"modified": "2025-03-26 21:00:58.544797",
>>>>>>> 5ddb36af87 (fix: slow query)
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Detail",
"naming_rule": "Random",
"owner": "Administrator",
"permissions": [],
<<<<<<< HEAD
"sort_field": "modified",
=======
"row_format": "Dynamic",
"sort_field": "creation",
>>>>>>> 5ddb36af87 (fix: slow query)
"sort_order": "ASC",
"states": []
}
}