fix: Lock stock ledger entries that are being reposted. (#20739)

- If stock ledger entries are being reposted, don't let any other transaction apply itself on the same.
This commit is contained in:
Marica
2020-02-26 18:51:35 +05:30
committed by GitHub
parent acbc4f648d
commit 4e3ad9c3f2

View File

@@ -420,7 +420,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])