From 62ba320f5bf403d28749297a6fb0ea480eed9ad6 Mon Sep 17 00:00:00 2001 From: Marica Date: Wed, 26 Feb 2020 18:51:13 +0530 Subject: [PATCH] fix: Lock stock ledger entries that are being reposted. (#20737) - If stock ledger entries are being reposted, don't let any other transaction apply itself on the same. --- erpnext/controllers/stock_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 57b4ddd0fb..b10d8befe4 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -429,7 +429,7 @@ def get_future_stock_vouchers(posting_date, posting_time, for_warehouses=None, f for d in frappe.db.sql("""select distinct sle.voucher_type, sle.voucher_no from `tabStock Ledger Entry` sle where timestamp(sle.posting_date, sle.posting_time) >= timestamp(%s, %s) {condition} - order by timestamp(sle.posting_date, sle.posting_time) asc, creation asc""".format(condition=condition), + order by timestamp(sle.posting_date, sle.posting_time) asc, creation asc for update""".format(condition=condition), tuple([posting_date, posting_time] + values), as_dict=True): future_stock_vouchers.append([d.voucher_type, d.voucher_no])