Skip to content

Commit

Permalink
perf: skip insertion of stock ledger entry
Browse files Browse the repository at this point in the history
  • Loading branch information
nextchamp-saqib committed Oct 12, 2021
1 parent eb3aae8 commit c7fc609
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions erpnext/stock/stock_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,11 @@ def set_as_cancel(voucher_type, voucher_no):
(now(), frappe.session.user, voucher_type, voucher_no))

def make_entry(args, allow_negative_stock=False, via_landed_cost_voucher=False):
args.update({"doctype": "Stock Ledger Entry"})
args["doctype"] = "Stock Ledger Entry"
sle = frappe.get_doc(args)
sle.flags.ignore_permissions = 1
sle.allow_negative_stock=allow_negative_stock
sle.via_landed_cost_voucher = via_landed_cost_voucher
sle.insert()
sle.submit()
return sle

Expand Down Expand Up @@ -240,8 +239,7 @@ def __init__(self, args, allow_zero_rate=False, allow_negative_stock=None, via_l
self.verbose = verbose
self.allow_zero_rate = allow_zero_rate
self.via_landed_cost_voucher = via_landed_cost_voucher
self.allow_negative_stock = allow_negative_stock \
or cint(frappe.db.get_single_value("Stock Settings", "allow_negative_stock"))
self.allow_negative_stock = True

self.args = frappe._dict(args)
self.item_code = args.get("item_code")
Expand Down

0 comments on commit c7fc609

Please sign in to comment.