diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 9729987d2d..b2825fc26f 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -232,7 +232,8 @@ class update_entries_after(object): and is_cancelled = 0 and timestamp(posting_date, time_format(posting_time, %(time_format)s)) < timestamp(%(posting_date)s, time_format(%(posting_time)s, %(time_format)s)) order by timestamp(posting_date, posting_time) desc, creation desc - limit 1""", args, as_dict=1) + limit 1 + for update""", args, as_dict=1) return sle[0] if sle else frappe._dict() @@ -623,7 +624,7 @@ class update_entries_after(object): break # If no entry found with outgoing rate, collapse stack - if index == None: + if index is None: # nosemgrep new_stock_value = sum((d[0]*d[1] for d in self.wh_data.stock_queue)) - qty_to_pop*outgoing_rate new_stock_qty = sum((d[0] for d in self.wh_data.stock_queue)) - qty_to_pop self.wh_data.stock_queue = [[new_stock_qty, new_stock_value/new_stock_qty if new_stock_qty > 0 else outgoing_rate]]