Fixes in validate baatch function

This commit is contained in:
Neil Trini Lasrado 2015-07-10 17:31:06 +05:30
parent 03bf529622
commit cb4b2ec52a
2 changed files with 4 additions and 4 deletions

View File

@ -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()

View File

@ -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():