From c89fe9f1ca3c5ab734bbe64d890714671d715c6a Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 22 Dec 2025 16:19:11 +0530 Subject: [PATCH 1/3] Revert "fix: performance of the reposting" (cherry picked from commit 280558efa210c8674caec71f3b01b448573dba9f) --- erpnext/stock/stock_ledger.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 407040c245c..71a7883d644 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -718,13 +718,6 @@ class update_entries_after: {"item_code": self.item_code, "warehouse": self.args.warehouse} ) - key = (self.item_code, self.args.warehouse) - if key in self.distinct_item_warehouses and self.distinct_item_warehouses[key].get( - "transfer_entry_to_repost" - ): - # only repost stock entries - args["filter_voucher_type"] = "Stock Entry" - return list(self.get_sle_after_datetime(args)) def get_dependent_entries_to_fix(self, entries_to_fix, sle): @@ -758,10 +751,8 @@ class update_entries_after: if getdate(existing_sle.get("posting_date")) > getdate(dependant_sle.posting_date): self.distinct_item_warehouses[key] = val self.new_items_found = True - elif ( - dependant_sle.actual_qty > 0 - and dependant_sle.voucher_type == "Stock Entry" - and is_transfer_stock_entry(dependant_sle.voucher_no) + elif dependant_sle.voucher_type == "Stock Entry" and is_transfer_stock_entry( + dependant_sle.voucher_no ): if self.distinct_item_warehouses[key].get("transfer_entry_to_repost"): return @@ -1848,9 +1839,6 @@ def get_stock_ledger_entries( if operator in (">", "<=") and previous_sle.get("name"): conditions += " and name!=%(name)s" - if previous_sle.get("filter_voucher_type"): - conditions += " and voucher_type = %(filter_voucher_type)s" - if extra_cond: conditions += f"{extra_cond}" From aefde87a0caa110e80ffd6f1ee67b9b7b5f9d59f Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 22 Dec 2025 16:22:44 +0530 Subject: [PATCH 2/3] chore: fix test case (cherry picked from commit d191b8058739d307ea72e98fed37841fc673398b) --- erpnext/stock/stock_ledger.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 71a7883d644..76ad47fb2f2 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -751,8 +751,10 @@ class update_entries_after: if getdate(existing_sle.get("posting_date")) > getdate(dependant_sle.posting_date): self.distinct_item_warehouses[key] = val self.new_items_found = True - elif dependant_sle.voucher_type == "Stock Entry" and is_transfer_stock_entry( - dependant_sle.voucher_no + elif ( + dependant_sle.actual_qty > 0 + and dependant_sle.voucher_type == "Stock Entry" + and is_transfer_stock_entry(dependant_sle.voucher_no) ): if self.distinct_item_warehouses[key].get("transfer_entry_to_repost"): return From c095938e69169dc1e333ec8f5b891d9a5569c72e Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 22 Dec 2025 16:23:15 +0530 Subject: [PATCH 3/3] chore: fix linters issue (cherry picked from commit e9c37642c8f39aa7aece15b44c6f5765a7ea94ab) --- erpnext/stock/stock_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 76ad47fb2f2..d00d092e795 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -753,7 +753,7 @@ class update_entries_after: self.new_items_found = True elif ( dependant_sle.actual_qty > 0 - and dependant_sle.voucher_type == "Stock Entry" + and dependant_sle.voucher_type == "Stock Entry" and is_transfer_stock_entry(dependant_sle.voucher_no) ): if self.distinct_item_warehouses[key].get("transfer_entry_to_repost"):