mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 21:49:18 +00:00
Fixes in validate baatch function
This commit is contained in:
@@ -730,9 +730,9 @@ class StockEntry(StockController):
|
|||||||
if self.purpose in ["Material Transfer for Manufacture", "Manufacture", "Repack", "Subcontract"]:
|
if self.purpose in ["Material Transfer for Manufacture", "Manufacture", "Repack", "Subcontract"]:
|
||||||
for item in self.get("items"):
|
for item in self.get("items"):
|
||||||
if item.batch_no:
|
if item.batch_no:
|
||||||
expiry_date = getdate(frappe.db.get_value("Batch", item.batch_no, "expiry_date"))
|
expiry_date = frappe.db.get_value("Batch", item.batch_no, "expiry_date")
|
||||||
if expiry_date:
|
if expiry_date:
|
||||||
if getdate(self.posting_date) > expiry_date:
|
if getdate(self.posting_date) > getdate(expiry_date):
|
||||||
frappe.throw(_("Batch {0} of Item {1} has expired.").format(item.batch_no, item.item_code))
|
frappe.throw(_("Batch {0} of Item {1} has expired.").format(item.batch_no, item.item_code))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|||||||
@@ -100,9 +100,9 @@ class StockLedgerEntry(Document):
|
|||||||
|
|
||||||
def validate_batch(self):
|
def validate_batch(self):
|
||||||
if self.batch_no and self.voucher_type != "Stock Entry":
|
if self.batch_no and self.voucher_type != "Stock Entry":
|
||||||
expiry_date = getdate(frappe.db.get_value("Batch", self.batch_no, "expiry_date"))
|
expiry_date = frappe.db.get_value("Batch", self.batch_no, "expiry_date")
|
||||||
if expiry_date:
|
if expiry_date:
|
||||||
if getdate(self.posting_date) > expiry_date:
|
if getdate(self.posting_date) > getdate(expiry_date):
|
||||||
frappe.throw(_("Batch {0} of Item {1} has expired.").format(self.batch_no, self.item_code))
|
frappe.throw(_("Batch {0} of Item {1} has expired.").format(self.batch_no, self.item_code))
|
||||||
|
|
||||||
def on_doctype_update():
|
def on_doctype_update():
|
||||||
|
|||||||
Reference in New Issue
Block a user