From 83e2ec6391c3f1e48dafd2b1b871663a57fb37c8 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 26 Mar 2025 21:50:18 +0530 Subject: [PATCH] fix: slow query --- erpnext/stock/deprecated_serial_batch.py | 5 ----- .../stock_entry_detail/stock_entry_detail.json | 12 ++++++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/erpnext/stock/deprecated_serial_batch.py b/erpnext/stock/deprecated_serial_batch.py index f20b140d1d..acabe568e3 100644 --- a/erpnext/stock/deprecated_serial_batch.py +++ b/erpnext/stock/deprecated_serial_batch.py @@ -250,7 +250,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: @@ -265,8 +264,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, @@ -274,8 +271,6 @@ class DeprecatedBatchNoValuation: .where( (sle.item_code == self.sle.item_code) & (sle.warehouse == self.sle.warehouse) - & (sle.batch_no.isnotnull()) - & (batch.use_batchwise_valuation == 0) & (sle.is_cancelled == 0) ) .where(timestamp_condition) diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json index fc0f57c550..ea497f7ab7 100644 --- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json +++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json @@ -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,20 @@ "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:00:58.544797", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry Detail", "naming_rule": "Random", "owner": "Administrator", "permissions": [], - "sort_field": "modified", - "sort_order": "DESC", + "row_format": "Dynamic", + "sort_field": "creation", + "sort_order": "ASC", "states": [] } -- GitLab