Skip to content

Commit b548cc4

Browse files
Merge pull request #46742 from frappe/mergify/bp/version-15/pr-46740
fix: slow query (backport #46739) (backport #46740)
2 parents 8951efb + ad3f985 commit b548cc4

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

erpnext/stock/deprecated_serial_batch.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ def get_last_sle_for_non_batch(self):
252252
from erpnext.stock.utils import get_combine_datetime
253253

254254
sle = frappe.qb.DocType("Stock Ledger Entry")
255-
batch = frappe.qb.DocType("Batch")
256255

257256
posting_datetime = get_combine_datetime(self.sle.posting_date, self.sle.posting_time)
258257
if not self.sle.creation:
@@ -267,16 +266,13 @@ def get_last_sle_for_non_batch(self):
267266

268267
query = (
269268
frappe.qb.from_(sle)
270-
.inner_join(batch)
271-
.on(sle.batch_no == batch.name)
272269
.select(
273270
sle.stock_value,
274271
sle.qty_after_transaction,
275272
)
276273
.where(
277274
(sle.item_code == self.sle.item_code)
278275
& (sle.warehouse == self.sle.warehouse)
279-
& (sle.batch_no.isnotnull())
280276
& (sle.is_cancelled == 0)
281277
)
282278
.where(timestamp_condition)

erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@
250250
},
251251
{
252252
"depends_on": "eval:doc.uom != doc.stock_uom",
253+
"fetch_from": "item_code.stock_uom",
253254
"fieldname": "stock_uom",
254255
"fieldtype": "Link",
255256
"label": "Stock UOM",
@@ -588,7 +589,8 @@
588589
"label": "Serial and Batch Bundle",
589590
"no_copy": 1,
590591
"options": "Serial and Batch Bundle",
591-
"print_hide": 1
592+
"print_hide": 1,
593+
"search_index": 1
592594
},
593595
{
594596
"default": "0",
@@ -606,11 +608,12 @@
606608
"fieldtype": "Column Break"
607609
}
608610
],
611+
"grid_page_length": 50,
609612
"idx": 1,
610613
"index_web_pages_for_search": 1,
611614
"istable": 1,
612615
"links": [],
613-
"modified": "2024-02-25 15:58:40.982582",
616+
"modified": "2025-03-26 21:01:58.544797",
614617
"modified_by": "Administrator",
615618
"module": "Stock",
616619
"name": "Stock Entry Detail",
@@ -620,4 +623,4 @@
620623
"sort_field": "modified",
621624
"sort_order": "ASC",
622625
"states": []
623-
}
626+
}

0 commit comments

Comments
 (0)