[fix] [minor] only post sl entries if stock item exists

This commit is contained in:
Nabin Hait
2013-09-26 16:16:44 +05:30
parent 6ec4b0c52a
commit ca77574a66

View File

@@ -11,6 +11,7 @@ import json
class NegativeStockError(webnotes.ValidationError): pass
def make_sl_entries(sl_entries, is_amended=None):
if sl_entries:
from stock.utils import update_bin
cancel = True if sl_entries[0].get("is_cancelled") == "Yes" else False
@@ -33,7 +34,8 @@ def make_sl_entries(sl_entries, is_amended=None):
update_bin(args)
if cancel:
delete_cancelled_entry(sl_entries[0].get('voucher_type'), sl_entries[0].get('voucher_no'))
delete_cancelled_entry(sl_entries[0].get('voucher_type'),
sl_entries[0].get('voucher_no'))
def set_as_cancel(voucher_type, voucher_no):
webnotes.conn.sql("""update `tabStock Ledger Entry` set is_cancelled='Yes',