[minor] close button for task and item not found error fix

This commit is contained in:
Rushabh Mehta
2015-07-20 10:56:39 +05:30
parent f3791797d6
commit 823e88d5bd
2 changed files with 50 additions and 28 deletions

View File

@@ -57,7 +57,12 @@ class StockLedgerEntry(Document):
def validate_item(self):
item_det = frappe.db.sql("""select name, has_batch_no, docstatus,
is_stock_item, has_variants, stock_uom
from tabItem where name=%s""", self.item_code, as_dict=True)[0]
from tabItem where name=%s""", self.item_code, as_dict=True)
if not item_det:
frappe.throw(_("Item {0} not found").format(self.item_code))
item_det = item_det[0]
if item_det.is_stock_item != 'Yes':
frappe.throw(_("Item {0} must be a stock Item").format(self.item_code))
@@ -97,7 +102,7 @@ class StockLedgerEntry(Document):
def scrub_posting_time(self):
if not self.posting_time or self.posting_time == '00:0':
self.posting_time = '00:00'
def validate_batch(self):
if self.batch_no and self.voucher_type != "Stock Entry":
expiry_date = frappe.db.get_value("Batch", self.batch_no, "expiry_date")