perf: reduce number of queries for checking if future SL entry exists (#25064)

This commit is contained in:
Sagar Vora
2021-03-31 12:44:03 +05:30
committed by GitHub
parent 368cb45147
commit e50324aed7
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)