Merge pull request #46740 from frappe/mergify/bp/version-15-hotfix/pr-46739

fix: slow query (backport #46739)
This commit is contained in:
rohitwaghchaure
2025-03-26 22:38:38 +05:30
committed by GitHub
2 changed files with 6 additions and 7 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,11 +608,12 @@
"fieldtype": "Column Break"
}
],
"grid_page_length": 50,
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2024-02-25 15:58:40.982582",
"modified": "2025-03-26 21:01:58.544797",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Detail",
@@ -620,4 +623,4 @@
"sort_field": "modified",
"sort_order": "ASC",
"states": []
}
}