Merge pull request #12347 from pratu16x7/buying-fix
[minor][buying] fix schedule date check
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index d3bcebc..24ad3a3 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -447,7 +447,8 @@
if not d.schedule_date:
d.schedule_date = self.schedule_date
- if d.schedule_date and getdate(d.schedule_date) < getdate(self.transaction_date):
+ if (d.schedule_date and self.transaction_date and
+ getdate(d.schedule_date) < getdate(self.transaction_date)):
frappe.throw(_("Row #{0}: Reqd by Date cannot be before Transaction Date").format(d.idx))
else:
frappe.throw(_("Please enter Reqd by Date"))