fix: item_name added for message

This commit is contained in:
vishdha 2020-04-07 19:59:06 +05:30
parent 74dd0e12e7
commit 0b34b90e71

View File

@ -72,7 +72,7 @@ class StockLedgerEntry(Document):
frappe.throw(_("Actual Qty is mandatory"))
def validate_item(self):
item_det = frappe.db.sql("""select name, has_batch_no, docstatus,
item_det = frappe.db.sql("""select name, item_name, has_batch_no, docstatus,
is_stock_item, has_variants, stock_uom, create_new_batch
from tabItem where name=%s""", self.item_code, as_dict=True)
@ -88,9 +88,9 @@ class StockLedgerEntry(Document):
if self.voucher_type != 'Stock Reconciliation':
if item_det.has_batch_no ==1:
if not self.batch_no:
frappe.throw(_("Batch number is mandatory for Item {0}").format(self.item_code))
frappe.throw(_("Batch number is mandatory for Item {0}:{1}").format(self.item_code, item_det.item_name))
elif not frappe.db.get_value("Batch",{"item": self.item_code, "name": self.batch_no}):
frappe.throw(_("{0} is not a valid Batch Number for Item {1}").format(self.batch_no, self.item_code))
frappe.throw(_("{0} is not a valid Batch Number for Item {1}:{2}").format(self.batch_no, self.item_code, item_det.item_name))
elif item_det.has_batch_no ==0 and self.batch_no and self.is_cancelled == "No":
frappe.throw(_("The Item {0} cannot have Batch").format(self.item_code))