mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-28 19:18:32 +00:00
Merge pull request #46879 from frappe/mergify/bp/version-15-hotfix/pr-46875
perf: Stock entry cancel is slow (backport #46875)
This commit is contained in:
@@ -1631,6 +1631,8 @@ def is_reposting_pending():
|
||||
|
||||
|
||||
def future_sle_exists(args, sl_entries=None, allow_force_reposting=True):
|
||||
from erpnext.stock.utils import get_combine_datetime
|
||||
|
||||
if allow_force_reposting and frappe.db.get_single_value(
|
||||
"Stock Reposting Settings", "do_reposting_for_each_stock_transaction"
|
||||
):
|
||||
@@ -1652,14 +1654,15 @@ def future_sle_exists(args, sl_entries=None, allow_force_reposting=True):
|
||||
|
||||
or_conditions = get_conditions_to_validate_future_sle(sl_entries)
|
||||
|
||||
args["posting_datetime"] = get_combine_datetime(args["posting_date"], args["posting_time"])
|
||||
|
||||
data = frappe.db.sql(
|
||||
"""
|
||||
select item_code, warehouse, count(name) as total_row
|
||||
from `tabStock Ledger Entry` force index (item_warehouse)
|
||||
from `tabStock Ledger Entry`
|
||||
where
|
||||
({})
|
||||
and timestamp(posting_date, posting_time)
|
||||
>= timestamp(%(posting_date)s, %(posting_time)s)
|
||||
and posting_datetime >= %(posting_datetime)s
|
||||
and voucher_no != %(voucher_no)s
|
||||
and is_cancelled = 0
|
||||
GROUP BY
|
||||
|
||||
Reference in New Issue
Block a user