mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 04:09:11 +00:00
[cleanup] [minor] On cancellation of transation, do not post cancelled sl entries, delete allexisting sl entries against that transaction
This commit is contained in:
@@ -3,13 +3,34 @@
|
||||
|
||||
import webnotes
|
||||
from webnotes import msgprint
|
||||
from webnotes.utils import cint, flt, cstr
|
||||
from webnotes.utils import cint, flt, cstr, now
|
||||
from stock.utils import get_valuation_method
|
||||
import json
|
||||
|
||||
# future reposting
|
||||
class NegativeStockError(webnotes.ValidationError): pass
|
||||
|
||||
def make_sl_entries(sl_entries, is_amended=None):
|
||||
from stock.utils import update_bin
|
||||
for sle in sl_entries:
|
||||
if sle.get("actual_qty"):
|
||||
sle_id = make_entry(sle)
|
||||
|
||||
args = sle.copy()
|
||||
args.update({
|
||||
"sle_id": sle_id,
|
||||
"is_amended": is_amended
|
||||
})
|
||||
update_bin(args)
|
||||
|
||||
def make_entry(args):
|
||||
args.update({"doctype": "Stock Ledger Entry"})
|
||||
sle = webnotes.bean([args])
|
||||
sle.ignore_permissions = 1
|
||||
sle.insert()
|
||||
sle.submit()
|
||||
return sle.doc.name
|
||||
|
||||
_exceptions = []
|
||||
def update_entries_after(args, verbose=1):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user