Fixes in validate baatch function
This commit is contained in:
parent
03bf529622
commit
cb4b2ec52a
@ -730,9 +730,9 @@ class StockEntry(StockController):
|
||||
if self.purpose in ["Material Transfer for Manufacture", "Manufacture", "Repack", "Subcontract"]:
|
||||
for item in self.get("items"):
|
||||
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 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.whitelist()
|
||||
|
@ -100,9 +100,9 @@ class StockLedgerEntry(Document):
|
||||
|
||||
def validate_batch(self):
|
||||
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 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))
|
||||
|
||||
def on_doctype_update():
|
||||
|
Loading…
Reference in New Issue
Block a user