Merge pull request #21215 from vishdha/batch_message_v13
fix(UX): batch error message improved
This commit is contained in:
commit
3ea95ee451
@ -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)
|
||||
|
||||
@ -87,10 +87,11 @@ class StockLedgerEntry(Document):
|
||||
# check if batch number is required
|
||||
if self.voucher_type != 'Stock Reconciliation':
|
||||
if item_det.has_batch_no ==1:
|
||||
batch_item = self.item_code if self.item_code == item_det.item_name else self.item_code + ":" + item_det.item_name
|
||||
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}").format(batch_item))
|
||||
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}").format(self.batch_no, batch_item))
|
||||
|
||||
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))
|
||||
|
Loading…
Reference in New Issue
Block a user