perf: reduce no of queries for checking if future sl entry exists (#24881)

This commit is contained in:
Sagar Vora
2021-03-27 16:10:20 +05:30
committed by GitHub
parent ab673d9e4b
commit 868c0bf45b
2 changed files with 28 additions and 23 deletions

View File

@@ -207,11 +207,11 @@ class update_entries_after(object):
def build(self):
from erpnext.controllers.stock_controller import check_if_future_sle_exists
from erpnext.controllers.stock_controller import future_sle_exists
if self.args.get("sle_id"):
self.process_sle_against_current_timestamp()
if not check_if_future_sle_exists(self.args):
if not future_sle_exists(self.args):
self.update_bin()
else:
entries_to_fix = self.get_future_entries_to_fix()
@@ -856,4 +856,4 @@ def get_future_sle_with_negative_qty(args):
and qty_after_transaction < 0
order by timestamp(posting_date, posting_time) asc
limit 1
""", args, as_dict=1)
""", args, as_dict=1)