Settings to show payment schedule in print (#12158)

diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
index 002562f..f80bd74 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
@@ -293,6 +293,36 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "show_payment_schedule_in_print", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Show Payment Schedule in Print", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "currency_exchange_section", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -392,7 +422,7 @@
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-09-05 10:10:03.117505", 
+ "modified": "2017-12-25 13:28:05.067615", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Accounts Settings", 
@@ -417,7 +447,7 @@
    "share": 1, 
    "submit": 0, 
    "write": 1
-  },
+  }, 
   {
    "amend": 0, 
    "apply_user_permissions": 0, 
@@ -437,7 +467,7 @@
    "share": 0, 
    "submit": 0, 
    "write": 0
-  },
+  }, 
   {
    "amend": 0, 
    "apply_user_permissions": 0, 
@@ -466,4 +496,4 @@
  "sort_order": "ASC", 
  "track_changes": 1, 
  "track_seen": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
index 8431173..4f1570c 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
@@ -7,6 +7,7 @@
 import frappe
 from frappe.utils import cint
 from frappe.model.document import Document
+from frappe.custom.doctype.property_setter.property_setter import make_property_setter
 
 
 class AccountsSettings(Document):
@@ -15,6 +16,7 @@
 
 	def validate(self):
 		self.validate_stale_days()
+		self.enable_payment_schedule_in_print()
 
 	def validate_stale_days(self):
 		if not self.allow_stale and cint(self.stale_days) <= 0:
@@ -22,3 +24,8 @@
 				"Stale Days should start from 1.", title='Error', indicator='red',
 				raise_exception=1)
 
+	def enable_payment_schedule_in_print(self):
+		show_in_print = cint(self.show_payment_schedule_in_print)
+		for doctype in ("Sales Order", "Sales Invoice", "Purchase Order", "Purchase Invoice"):
+			make_property_setter(doctype, "due_date", "print_hide", show_in_print, "Check")
+			make_property_setter(doctype, "payment_schedule", "print_hide",  0 if show_in_print else 1, "Check")
\ No newline at end of file