moves `set_payment_schedule` and `validate_payment_schedule` to accounts_controller
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 4fbfc95..bc35317 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -99,8 +99,6 @@
 		self.set_billing_hours_and_amount()
 		self.update_timesheet_billing_for_project()
 		self.set_status()
-		self.set_payment_schedule()
-		self.validate_payment_schedule()
 
 	def before_save(self):
 		set_account_for_mode_of_payment(self)
@@ -532,31 +530,6 @@
 
 		self.total_billing_amount = total_billing_amount
 
-	def set_payment_schedule(self):
-		if not self.get("payment_schedule"):
-			if self.due_date:
-				self.append("payment_schedule", {
-					"due_date": self.due_date,
-					"invoice_portion": 100,
-					"payment_amount": self.grand_total
-				})
-		else:
-			self.due_date = max([d.due_date for d in self.get("payment_schedule")])
-
-	def validate_payment_schedule(self):
-		if self.due_date and getdate(self.due_date) < getdate(self.posting_date):
-			frappe.throw(_("Due Date cannot be before posting date"))
-
-		total = 0
-		for d in self.get("payment_schedule"):
-			if getdate(d.due_date) < getdate(self.posting_date):
-				frappe.throw(_("Row {0}: Due Date cannot be before posting date").format(d.idx))
-
-			total += flt(d.payment_amount)
-
-		if total != self.grand_total:
-			frappe.throw(_("Total Payment Amount in Payment Schdule must be equal to Grand Total"))
-
 	def get_warehouse(self):
 		user_pos_profile = frappe.db.sql("""select name, warehouse from `tabPOS Profile`
 			where ifnull(user,'') = %s and company = %s""", (frappe.session['user'], self.company))
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 41f8dc5..bb634d1 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -44,6 +44,8 @@
 			self.set_total_in_words()
 
 		if self.doctype in ("Sales Invoice", "Purchase Invoice") and not self.is_return:
+			self.set_payment_schedule()
+			self.validate_payment_schedule()
 			self.validate_due_date()
 			self.validate_advance_entries()
 
@@ -614,6 +616,33 @@
 		for item in duplicate_list:
 			self.remove(item)
 
+	def set_payment_schedule(self):
+		if not self.get("payment_schedule"):
+			if self.due_date:
+				self.append("payment_schedule", {
+					"due_date": self.due_date,
+					"invoice_portion": 100,
+					"payment_amount": self.grand_total
+				})
+		else:
+			self.due_date = max([d.due_date for d in self.get("payment_schedule")])
+
+	def validate_payment_schedule(self):
+		if self.due_date and getdate(self.due_date) < getdate(self.posting_date):
+			frappe.throw(_("Due Date cannot be before posting date"))
+
+		total = 0
+		for d in self.get("payment_schedule"):
+			if getdate(d.due_date) < getdate(self.posting_date):
+				frappe.throw(_("Row {0}: Due Date cannot be before posting date").format(d.idx))
+
+			total += flt(d.payment_amount)
+
+		if total != self.grand_total:
+			frappe.throw(_("Total Payment Amount in Payment Schdule must be equal to Grand Total"))
+
+
+
 @frappe.whitelist()
 def get_tax_rate(account_head):
 	return frappe.db.get_value("Account", account_head, ["tax_rate", "account_name"], as_dict=True)