Merge branch 'develop' into item-attribute-order-fix
diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
index 24cd3dd..d62ee9d 100644
--- a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
+++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
@@ -18,14 +18,14 @@
 			"doc_type": "Payment Entry",
 			"standard": "No",
 			"custom_format": 1,
-			"print_format_type": "Server",
+			"print_format_type": "Jinja",
 			"name": template_name
 		})
 	else:
 		cheque_print = frappe.get_doc("Print Format", template_name)
-	
+
 	doc = frappe.get_doc("Cheque Print Template", template_name)
-	
+
 	cheque_print.html = """
 <style>
 	.print-format {
@@ -91,9 +91,9 @@
 		"signatory_from_top_edge": doc.signatory_from_top_edge,
 		"signatory_from_left_edge": doc.signatory_from_left_edge
 	}
-		
+
 	cheque_print.save(ignore_permissions=True)
-	
+
 	frappe.db.set_value("Cheque Print Template", template_name, "has_print_format", 1)
-		
+
 	return cheque_print
diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py
index 64aa4e4..c8756af 100644
--- a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py
+++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py
@@ -145,23 +145,25 @@
 
 		if getdate(self.loan_end_date) > getdate(nowdate()):
 			for d in self.invoices:
-				je.append("accounts", {
-					"account": self.accounts_receivable_discounted,
-					"credit_in_account_currency": flt(d.outstanding_amount),
-					"reference_type": "Invoice Discounting",
-					"reference_name": self.name,
-					"party_type": "Customer",
-					"party": d.customer
-				})
+				outstanding_amount = frappe.db.get_value("Sales Invoice", d.sales_invoice, "outstanding_amount")
+				if flt(outstanding_amount) > 0:
+					je.append("accounts", {
+						"account": self.accounts_receivable_discounted,
+						"credit_in_account_currency": flt(outstanding_amount),
+						"reference_type": "Invoice Discounting",
+						"reference_name": self.name,
+						"party_type": "Customer",
+						"party": d.customer
+					})
 
-				je.append("accounts", {
-					"account": self.accounts_receivable_unpaid,
-					"debit_in_account_currency": flt(d.outstanding_amount),
-					"reference_type": "Invoice Discounting",
-					"reference_name": self.name,
-					"party_type": "Customer",
-					"party": d.customer
-				})
+					je.append("accounts", {
+						"account": self.accounts_receivable_unpaid,
+						"debit_in_account_currency": flt(outstanding_amount),
+						"reference_type": "Invoice Discounting",
+						"reference_name": self.name,
+						"party_type": "Customer",
+						"party": d.customer
+					})
 
 		return je
 
@@ -190,9 +192,28 @@
 			customer,
 			posting_date,
 			outstanding_amount
-		from `tabSales Invoice`
+		from `tabSales Invoice` si
 		where
 			docstatus = 1
 			and outstanding_amount > 0
 			%s
-	""" % where_condition, filters, as_dict=1)
\ No newline at end of file
+			and not exists(select di.name from `tabDiscounted Invoice` di
+				where di.docstatus=1 and di.sales_invoice=si.name)
+	""" % where_condition, filters, as_dict=1)
+
+def get_party_account_based_on_invoice_discounting(sales_invoice):
+	party_account = None
+	invoice_discounting = frappe.db.sql("""
+		select par.accounts_receivable_discounted, par.accounts_receivable_unpaid, par.status
+		from `tabInvoice Discounting` par, `tabDiscounted Invoice` ch
+		where par.name=ch.parent
+			and par.docstatus=1
+			and ch.sales_invoice = %s
+	""", (sales_invoice), as_dict=1)
+	if invoice_discounting:
+		if invoice_discounting[0].status == "Disbursed":
+			party_account = invoice_discounting[0].accounts_receivable_discounted
+		elif invoice_discounting[0].status == "Settled":
+			party_account = invoice_discounting[0].accounts_receivable_unpaid
+
+	return party_account
diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py
new file mode 100644
index 0000000..6523cd3
--- /dev/null
+++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py
@@ -0,0 +1,20 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+	return {
+		'fieldname': 'reference_name',
+		'internal_links': {
+			'Sales Invoice': ['invoices', 'sales_invoice']
+		},
+		'transactions': [
+			{
+				'label': _('Reference'),
+				'items': ['Sales Invoice']
+			},
+			{
+				'label': _('Payment'),
+				'items': ['Payment Entry', 'Journal Entry']
+			}
+		]
+	}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py
index 4f93e11..3d74d9a 100644
--- a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py
+++ b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py
@@ -122,27 +122,62 @@
 			period=60
 			)
 
-		inv_disc.create_disbursement_entry()
-		je = inv_disc.close_loan()
+		je1 = inv_disc.create_disbursement_entry()
+		je1.posting_date = nowdate()
+		je1.submit()
 
-		self.assertEqual(je.accounts[0].account, self.short_term_loan)
-		self.assertEqual(je.accounts[0].debit_in_account_currency, flt(inv_disc.total_amount))
+		je2 = inv_disc.close_loan()
 
-		self.assertEqual(je.accounts[1].account, self.bank_account)
-		self.assertEqual(je.accounts[1].credit_in_account_currency, flt(inv_disc.total_amount))
+		self.assertEqual(je2.accounts[0].account, self.short_term_loan)
+		self.assertEqual(je2.accounts[0].debit_in_account_currency, flt(inv_disc.total_amount))
 
-		self.assertEqual(je.accounts[2].account, self.ar_discounted)
-		self.assertEqual(je.accounts[2].credit_in_account_currency, flt(inv.outstanding_amount))
+		self.assertEqual(je2.accounts[1].account, self.bank_account)
+		self.assertEqual(je2.accounts[1].credit_in_account_currency, flt(inv_disc.total_amount))
 
-		self.assertEqual(je.accounts[3].account, self.ar_unpaid)
-		self.assertEqual(je.accounts[3].debit_in_account_currency, flt(inv.outstanding_amount))
+		self.assertEqual(je2.accounts[2].account, self.ar_discounted)
+		self.assertEqual(je2.accounts[2].credit_in_account_currency, flt(inv.outstanding_amount))
 
-		je.posting_date = nowdate()
-		je.submit()
+		self.assertEqual(je2.accounts[3].account, self.ar_unpaid)
+		self.assertEqual(je2.accounts[3].debit_in_account_currency, flt(inv.outstanding_amount))
+
+		je2.posting_date = nowdate()
+		je2.submit()
 		inv_disc.reload()
 
 		self.assertEqual(inv_disc.status, "Settled")
 
+	def test_on_close_after_loan_period_after_inv_payment(self):
+		inv = create_sales_invoice(rate=600)
+		inv_disc = create_invoice_discounting([inv.name],
+			accounts_receivable_credit=self.ar_credit,
+			accounts_receivable_discounted=self.ar_discounted,
+			accounts_receivable_unpaid=self.ar_unpaid,
+			short_term_loan=self.short_term_loan,
+			bank_charges_account=self.bank_charges_account,
+			bank_account=self.bank_account,
+			start=nowdate(),
+			period=60
+			)
+
+		je1 = inv_disc.create_disbursement_entry()
+		je1.posting_date = nowdate()
+		je1.submit()
+
+		je_on_payment = frappe.get_doc(get_payment_entry_against_invoice("Sales Invoice", inv.name))
+		je_on_payment.posting_date = nowdate()
+		je_on_payment.cheque_no = "126981"
+		je_on_payment.cheque_date = nowdate()
+		je_on_payment.save()
+		je_on_payment.submit()
+
+		je2 = inv_disc.close_loan()
+
+		self.assertEqual(je2.accounts[0].account, self.short_term_loan)
+		self.assertEqual(je2.accounts[0].debit_in_account_currency, flt(inv_disc.total_amount))
+
+		self.assertEqual(je2.accounts[1].account, self.bank_account)
+		self.assertEqual(je2.accounts[1].credit_in_account_currency, flt(inv_disc.total_amount))
+
 	def test_on_close_before_loan_period(self):
 		inv = create_sales_invoice(rate=700)
 		inv_disc = create_invoice_discounting([inv.name],
@@ -154,23 +189,21 @@
 			bank_account=self.bank_account,
 			start=add_days(nowdate(), -80),
 			period=60
-			)
+		)
 
-		inv_disc.create_disbursement_entry()
-		je = inv_disc.close_loan()
+		je1 = inv_disc.create_disbursement_entry()
+		je1.posting_date = nowdate()
+		je1.submit()
 
-		je.posting_date = nowdate()
-		je.submit()
+		je2 = inv_disc.close_loan()
+		je2.posting_date = nowdate()
+		je2.submit()
 
-		self.assertEqual(je.accounts[0].account, self.short_term_loan)
-		self.assertEqual(je.accounts[0].debit_in_account_currency, flt(inv_disc.total_amount))
+		self.assertEqual(je2.accounts[0].account, self.short_term_loan)
+		self.assertEqual(je2.accounts[0].debit_in_account_currency, flt(inv_disc.total_amount))
 
-		self.assertEqual(je.accounts[1].account, self.bank_account)
-		self.assertEqual(je.accounts[1].credit_in_account_currency, flt(inv_disc.total_amount))
-
-		inv_disc.reload()
-
-		self.assertEqual(inv_disc.status, "Settled")
+		self.assertEqual(je2.accounts[1].account, self.bank_account)
+		self.assertEqual(je2.accounts[1].credit_in_account_currency, flt(inv_disc.total_amount))
 
 	def test_make_payment_before_loan_period(self):
 		#it has problem
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 28869d8..63f180d 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -3,13 +3,14 @@
 
 from __future__ import unicode_literals
 import frappe, erpnext, json
-from frappe.utils import cstr, flt, fmt_money, formatdate, getdate, nowdate, cint
+from frappe.utils import cstr, flt, fmt_money, formatdate, getdate, nowdate, cint, get_link_to_form
 from frappe import msgprint, _, scrub
 from erpnext.controllers.accounts_controller import AccountsController
 from erpnext.accounts.utils import get_balance_on, get_account_currency
 from erpnext.accounts.party import get_party_account
 from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount
 from erpnext.hr.doctype.loan.loan import update_disbursement_status, update_total_amount_paid
+from erpnext.accounts.doctype.invoice_discounting.invoice_discounting import get_party_account_based_on_invoice_discounting
 
 from six import string_types, iteritems
 
@@ -53,6 +54,20 @@
 		self.update_inter_company_jv()
 		self.update_invoice_discounting()
 
+	def on_cancel(self):
+		from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
+		from erpnext.hr.doctype.salary_slip.salary_slip import unlink_ref_doc_from_salary_slip
+		unlink_ref_doc_from_payment_entries(self)
+		unlink_ref_doc_from_salary_slip(self.name)
+		self.make_gl_entries(1)
+		self.update_advance_paid()
+		self.update_expense_claim()
+		self.update_loan()
+		self.unlink_advance_entry_reference()
+		self.unlink_asset_reference()
+		self.unlink_inter_company_jv()
+		self.unlink_asset_adjustment_entry()
+		self.update_invoice_discounting()
 
 	def get_title(self):
 		return self.pay_to_recd_from or self.accounts[0].account
@@ -83,31 +98,32 @@
 				"inter_company_journal_entry_reference", self.name)
 
 	def update_invoice_discounting(self):
-		invoice_discounting_list = [d.reference_name for d in self.accounts if d.reference_type=="Invoice Discounting"]
+		def _validate_invoice_discounting_status(inv_disc, id_status, expected_status, row_id):
+			id_link = get_link_to_form("Invoice Discounting", inv_disc)
+			if id_status != expected_status:
+				frappe.throw(_("Row #{0}: Status must be {1} for Invoice Discounting {2}").format(d.idx, expected_status, id_link))
+
+		invoice_discounting_list = list(set([d.reference_name for d in self.accounts if d.reference_type=="Invoice Discounting"]))
 		for inv_disc in invoice_discounting_list:
-			short_term_loan_account = frappe.db.get_value("Invoice Discounting", inv_disc, "short_term_loan")
+			short_term_loan_account, id_status = frappe.db.get_value("Invoice Discounting", inv_disc, ["short_term_loan", "status"])
 			for d in self.accounts:
 				if d.account == short_term_loan_account and d.reference_name == inv_disc:
-					if d.credit > 0:
-						status = "Disbursed"
-					elif d.debit > 0:
-						status = "Settled"
+					if self.docstatus == 1:
+						if d.credit > 0:
+							_validate_invoice_discounting_status(inv_disc, id_status, "Sanctioned", d.idx)
+							status = "Disbursed"
+						elif d.debit > 0:
+							_validate_invoice_discounting_status(inv_disc, id_status, "Disbursed", d.idx)
+							status = "Settled"
+					else:
+						if d.credit > 0:
+							_validate_invoice_discounting_status(inv_disc, id_status, "Disbursed", d.idx)
+							status = "Sanctioned"
+						elif d.debit > 0:
+							_validate_invoice_discounting_status(inv_disc, id_status, "Settled", d.idx)
+							status = "Disbursed"
 					frappe.db.set_value("Invoice Discounting", inv_disc, "status", status)
 
-	def on_cancel(self):
-		from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
-		from erpnext.hr.doctype.salary_slip.salary_slip import unlink_ref_doc_from_salary_slip
-		unlink_ref_doc_from_payment_entries(self)
-		unlink_ref_doc_from_salary_slip(self.name)
-		self.make_gl_entries(1)
-		self.update_advance_paid()
-		self.update_expense_claim()
-		self.update_loan()
-		self.unlink_advance_entry_reference()
-		self.unlink_asset_reference()
-		self.unlink_inter_company_jv()
-		self.unlink_asset_adjustment_entry()
-
 	def unlink_advance_entry_reference(self):
 		for d in self.get("accounts"):
 			if d.is_advance == "Yes" and d.reference_type in ("Sales Invoice", "Purchase Invoice"):
@@ -732,23 +748,6 @@
 		"journal_entry": journal_entry
 	})
 
-def get_party_account_based_on_invoice_discounting(sales_invoice):
-	party_account = None
-	invoice_discounting = frappe.db.sql("""
-		select par.accounts_receivable_discounted, par.accounts_receivable_unpaid, par.status
-		from `tabInvoice Discounting` par, `tabDiscounted Invoice` ch
-		where par.name=ch.parent
-			and par.docstatus=1
-			and ch.sales_invoice = %s
-	""", (sales_invoice), as_dict=1)
-	if invoice_discounting:
-		if invoice_discounting[0].status == "Disbursed":
-			party_account = invoice_discounting[0].accounts_receivable_discounted
-		elif invoice_discounting[0].status == "Settled":
-			party_account = invoice_discounting[0].accounts_receivable_unpaid
-
-	return party_account
-
 def get_payment_entry(ref_doc, args):
 	cost_center = ref_doc.get("cost_center") or frappe.get_cached_value('Company',  ref_doc.company,  "cost_center")
 	exchange_rate = 1
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index eb672e0..b7ab4fe 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -14,6 +14,7 @@
 from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount
 from erpnext.accounts.doctype.bank_account.bank_account import get_party_bank_account, get_bank_account_details
 from erpnext.controllers.accounts_controller import AccountsController, get_supplier_block_status
+from erpnext.accounts.doctype.invoice_discounting.invoice_discounting import get_party_account_based_on_invoice_discounting
 
 from six import string_types, iteritems
 
@@ -237,7 +238,7 @@
 
 					if d.reference_doctype in ("Sales Invoice", "Purchase Invoice", "Expense Claim", "Fees"):
 						if self.party_type == "Customer":
-							ref_party_account = ref_doc.debit_to
+							ref_party_account = get_party_account_based_on_invoice_discounting(d.reference_name) or ref_doc.debit_to
 						elif self.party_type == "Student":
 							ref_party_account = ref_doc.receivable_account
 						elif self.party_type=="Supplier":
@@ -826,7 +827,7 @@
 
 	# party account
 	if dt == "Sales Invoice":
-		party_account = doc.debit_to
+		party_account = get_party_account_based_on_invoice_discounting(dn) or doc.debit_to
 	elif dt == "Purchase Invoice":
 		party_account = doc.credit_to
 	elif dt == "Fees":
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js
index a6386dd..10f127a 100755
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.js
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js
@@ -28,7 +28,7 @@
 			return {
 				filters: [
 					['Print Format', 'doc_type', '=', 'Sales Invoice'],
-					['Print Format', 'print_format_type', '=', 'Server'],
+					['Print Format', 'print_format_type', '=', 'Jinja'],
 				]
 			};
 		});
@@ -42,7 +42,7 @@
 		});
 
 		frm.set_query("print_format", function() {
-			return { filters: { doc_type: "Sales Invoice", print_format_type: "Js"} };
+			return { filters: { doc_type: "Sales Invoice", print_format_type: "JS"} };
 		});
 
 		frappe.db.get_value('POS Settings', 'POS Settings', 'use_pos_in_offline_mode', (r) => {
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index bd84506..5f4833c 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -1882,6 +1882,7 @@
    "collapsible": 0,
    "collapsible_depends_on": "",
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "pricing_rule_details",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -1915,6 +1916,7 @@
    "collapsible": 0,
    "collapsible_depends_on": "",
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "pricing_rules",
    "fieldtype": "Table",
    "hidden": 0,
@@ -2318,6 +2320,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "tax_category",
    "fieldtype": "Link",
    "hidden": 0,
@@ -2449,6 +2452,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "taxes_and_charges",
    "fieldtype": "Link",
    "hidden": 0,
@@ -2483,6 +2487,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "taxes",
    "fieldtype": "Table",
    "hidden": 0,
@@ -3947,7 +3952,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
-   "default": "1",
+   "default": "",
    "fetch_if_empty": 0,
    "fieldname": "allocate_advances_automatically",
    "fieldtype": "Check",
@@ -4957,18 +4962,16 @@
   }
  ],
  "has_web_view": 0,
- "hide_heading": 0,
  "hide_toolbar": 0,
  "icon": "fa fa-file-text",
  "idx": 204,
- "image_view": 0,
  "in_create": 0,
  "is_submittable": 1,
  "issingle": 0,
  "istable": 0,
  "max_attachments": 0,
  "menu_index": 0,
- "modified": "2019-04-11 16:08:22.288425",
+ "modified": "2019-04-22 12:08:12.648559",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Purchase Invoice",
@@ -5073,7 +5076,6 @@
  ],
  "quick_entry": 0,
  "read_only": 0,
- "read_only_onload": 1,
  "search_fields": "posting_date, supplier, bill_no, base_grand_total, outstanding_amount",
  "show_name_in_global_search": 1,
  "sort_field": "modified",
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 44af743..90a0ef4 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -369,6 +369,7 @@
 
 	set_pos_data: function() {
 		if(this.frm.doc.is_pos) {
+			this.frm.set_value("allocate_advances_automatically", this.frm.doc.is_pos ? 0 : 1);
 			if(!this.frm.doc.company) {
 				this.frm.set_value("is_pos", 0);
 				frappe.msgprint(__("Please specify Company to proceed"));
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index ffc5a1d..1ded272 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -3731,7 +3731,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
-   "default": "1",
+   "default": "",
    "fetch_if_empty": 0,
    "fieldname": "allocate_advances_automatically",
    "fieldtype": "Check",
@@ -5915,7 +5915,7 @@
  "istable": 0,
  "max_attachments": 0,
  "menu_index": 0,
- "modified": "2019-04-11 17:08:11.629845",
+ "modified": "2019-04-22 12:07:58.168803",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Sales Invoice",
@@ -6010,4 +6010,4 @@
  "track_changes": 1,
  "track_seen": 1,
  "track_views": 0
-}
\ No newline at end of file
+}
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
index 5ce80d1..1bff93c 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
@@ -107,8 +107,8 @@
 	<thead>
 		<tr>
 			{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
-				<th style="width: 9%">{%= __("Date") %}</th>
-				<th style="width: 5%">{%= __("Age (Days)") %}</th>
+				<th style="width: 10%">{%= __("Date") %}</th>
+				<th style="width: 4%">{%= __("Age (Days)") %}</th>
 
 				{% if(report.report_name === "Accounts Receivable" && filters.show_sales_person_in_print) { %}
 					<th style="width: 16%">{%= __("Reference") %}</th>
@@ -206,7 +206,7 @@
 					{% if(!filters.show_pdc_in_print) { %}
 					<td></td>
 					{% } %}
-					{% if(report.report_name === "Accounts Receivable") { %}
+					{% if(report.report_name === "Accounts Receivable" && filters.show_sales_person_in_print) { %}
 					<td></td>
 					{% } %}
 					<td></td>
diff --git a/erpnext/accounts/report/share_ledger/share_ledger.json b/erpnext/accounts/report/share_ledger/share_ledger.json
index d374bb7..fe158a6 100644
--- a/erpnext/accounts/report/share_ledger/share_ledger.json
+++ b/erpnext/accounts/report/share_ledger/share_ledger.json
@@ -1,23 +1,27 @@
 {
  "add_total_row": 0, 
- "apply_user_permissions": 1, 
  "creation": "2017-12-27 16:15:52.615453", 
+ "disable_prepared_report": 0, 
  "disabled": 0, 
  "docstatus": 0, 
  "doctype": "Report", 
  "idx": 0, 
  "is_standard": "Yes", 
- "modified": "2017-12-27 16:46:54.422356", 
+ "modified": "2019-04-19 10:50:36.061588", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Share Ledger", 
  "owner": "Administrator", 
+ "prepared_report": 0, 
  "ref_doctype": "Share Transfer", 
  "report_name": "Share Ledger", 
  "report_type": "Script Report", 
  "roles": [
   {
    "role": "Administrator"
+  }, 
+  {
+   "role": "System Manager"
   }
  ]
 }
\ No newline at end of file
diff --git a/erpnext/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.json b/erpnext/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.json
index f351f3b..9e6e80a 100644
--- a/erpnext/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.json
+++ b/erpnext/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.json
@@ -1,28 +1,29 @@
 {
- "add_total_row": 1, 
- "apply_user_permissions": 1, 
- "creation": "2013-05-13 16:10:02", 
- "disabled": 0, 
- "docstatus": 0, 
- "doctype": "Report", 
- "idx": 3, 
- "is_standard": "Yes", 
- "modified": "2017-02-24 20:10:53.005589", 
- "modified_by": "Administrator", 
- "module": "Buying", 
- "name": "Requested Items To Be Ordered", 
- "owner": "Administrator", 
- "query": "select \n    mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tsum(ifnull(mr_item.qty, 0)) as \"Qty:Float:100\",\n\tsum(ifnull(mr_item.ordered_qty, 0)) as \"Ordered Qty:Float:100\", \n\t(sum(mr_item.qty) - sum(ifnull(mr_item.ordered_qty, 0))) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\",\n\tmr.company as \"Company:Link/Company:\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\ngroup by mr.name, mr_item.item_code\nhaving\n\tsum(ifnull(mr_item.ordered_qty, 0)) < sum(ifnull(mr_item.qty, 0))\norder by mr.transaction_date asc", 
- "ref_doctype": "Purchase Order", 
- "report_name": "Requested Items To Be Ordered", 
- "report_type": "Query Report", 
+ "add_total_row": 1,
+ "creation": "2013-05-13 16:10:02",
+ "disable_prepared_report": 0,
+ "disabled": 0,
+ "docstatus": 0,
+ "doctype": "Report",
+ "idx": 3,
+ "is_standard": "Yes",
+ "modified": "2019-04-18 19:02:03.099422",
+ "modified_by": "Administrator",
+ "module": "Buying",
+ "name": "Requested Items To Be Ordered",
+ "owner": "Administrator",
+ "prepared_report": 0,
+ "query": "select \n    mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tsum(ifnull(mr_item.stock_qty, 0)) as \"Qty:Float:100\",\n\tifnull(mr_item.stock_uom, '') as \"UOM:Link/UOM:100\",\n\tsum(ifnull(mr_item.ordered_qty, 0)) as \"Ordered Qty:Float:100\", \n\t(sum(mr_item.stock_qty) - sum(ifnull(mr_item.ordered_qty, 0))) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\",\n\tmr.company as \"Company:Link/Company:\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\ngroup by mr.name, mr_item.item_code\nhaving\n\tsum(ifnull(mr_item.ordered_qty, 0)) < sum(ifnull(mr_item.stock_qty, 0))\norder by mr.transaction_date asc",
+ "ref_doctype": "Purchase Order",
+ "report_name": "Requested Items To Be Ordered",
+ "report_type": "Query Report",
  "roles": [
   {
    "role": "Stock User"
-  }, 
+  },
   {
    "role": "Purchase Manager"
-  }, 
+  },
   {
    "role": "Purchase User"
   }
diff --git a/erpnext/config/accounting.py b/erpnext/config/accounting.py
index afe35f8..6664c4d 100644
--- a/erpnext/config/accounting.py
+++ b/erpnext/config/accounting.py
@@ -78,6 +78,11 @@
 					"name": "Payment Entry",
 					"description": _("Bank/Cash transactions against party or for internal transfer")
 				},
+				{
+					"type": "doctype",
+					"name": "Payment Term",
+					"description": _("Payment Terms based on conditions")
+				},
 
 				# Reports
 				{
@@ -133,6 +138,11 @@
 				},
 				{
 					"type": "doctype",
+					"name": "Exchange Rate Revaluation",
+					"description": _("Exchange Rate Revaluation master.")
+				},
+				{
+					"type": "doctype",
 					"name": "Payment Gateway Account",
 					"description": _("Setup Gateway accounts.")
 				},
@@ -234,6 +244,11 @@
 				},
 				{
 					"type": "doctype",
+					"label": _("Invoice Discounting"),
+					"name": "Invoice Discounting",
+				},
+				{
+					"type": "doctype",
 					"label": _("Bank Statement Transaction Entry List"),
 					"name": "Bank Statement Transaction Entry",
 					"route": "#List/Bank Statement Transaction Entry",
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 63ea259..90dc086 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -89,7 +89,7 @@
 			self.validate_paid_amount()
 
 		if self.doctype in ['Purchase Invoice', 'Sales Invoice']:
-			if cint(self.allocate_advances_automatically):
+			if cint(self.allocate_advances_automatically) and not cint(self.is_pos):
 				self.set_advances()
 
 			if self.is_return:
diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py
index 442b6c2..d42502d 100644
--- a/erpnext/crm/doctype/lead/lead.py
+++ b/erpnext/crm/doctype/lead/lead.py
@@ -10,6 +10,7 @@
 from erpnext.controllers.selling_controller import SellingController
 from frappe.contacts.address_and_contact import load_address_and_contact
 from erpnext.accounts.party import set_taxes
+from frappe.email.inbox import link_communication_to_document
 
 sender_field = "email_id"
 
@@ -199,3 +200,29 @@
 		out['taxes_and_charges'] = taxes_and_charges
 
 	return out
+
+@frappe.whitelist()
+def make_lead_from_communication(communication, ignore_communication_links=False):
+	""" raise a issue from email """
+
+	doc = frappe.get_doc("Communication", communication)
+	lead_name = None
+	if doc.sender:
+		lead_name = frappe.db.get_value("Lead", {"email_id": doc.sender})
+	if not lead_name and doc.phone_no:
+		lead_name = frappe.db.get_value("Lead", {"mobile_no": doc.phone_no})
+	if not lead_name:
+		lead = frappe.get_doc({
+			"doctype": "Lead",
+			"lead_name": doc.sender_full_name,
+			"email_id": doc.sender,
+			"mobile_no": doc.phone_no
+		})
+		lead.flags.ignore_mandatory = True
+		lead.flags.ignore_permissions = True
+		lead.insert()
+
+		lead_name = lead.name
+
+	link_communication_to_document(doc, "Lead", lead_name, ignore_communication_links)
+	return lead_name
\ No newline at end of file
diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py
index 2e02e75..4d45936 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.py
+++ b/erpnext/crm/doctype/opportunity/opportunity.py
@@ -10,6 +10,7 @@
 from erpnext.utilities.transaction_base import TransactionBase
 from erpnext.accounts.party import get_party_account_currency
 from frappe.desk.form import assign_to
+from frappe.email.inbox import link_communication_to_document
 
 subject_field = "title"
 sender_field = "contact_email"
@@ -349,3 +350,23 @@
 				"name": doc.name,
 				"description": doc.get(subject_field)
 			})
+@frappe.whitelist()
+def make_opportunity_from_communication(communication, ignore_communication_links=False):
+	from erpnext.crm.doctype.lead.lead import make_lead_from_communication
+	doc = frappe.get_doc("Communication", communication)
+
+	lead = doc.reference_name if doc.reference_doctype == "Lead" else None
+	if not lead:
+		lead = make_lead_from_communication(communication, ignore_communication_links=True)
+
+	enquiry_from = "Lead"
+
+	opportunity = frappe.get_doc({
+		"doctype": "Opportunity",
+		"enquiry_from": enquiry_from,
+		"lead": lead
+	}).insert(ignore_permissions=True)
+
+	link_communication_to_document(doc, "Opportunity", opportunity.name, ignore_communication_links)
+
+	return opportunity.name
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index d8532fa..608e8b2 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -74,7 +74,7 @@
 
 website_context = {
 	"favicon": 	"/assets/erpnext/images/favicon.png",
-	"splash_image": "/assets/erpnext/images/erpnext-12.svg"
+	"splash_image": "/assets/erpnext/images/erp-icon.svg"
 }
 
 website_route_rules = [
diff --git a/erpnext/hr/doctype/additional_salary/additional_salary.py b/erpnext/hr/doctype/additional_salary/additional_salary.py
index 968a1c4..9ca1260 100644
--- a/erpnext/hr/doctype/additional_salary/additional_salary.py
+++ b/erpnext/hr/doctype/additional_salary/additional_salary.py
@@ -51,7 +51,7 @@
 	for d in additional_components:
 		component = frappe.get_doc("Salary Component", d.salary_component)
 		struct_row = {'salary_component': d.salary_component}
-		for field in ["depends_on_lwp", "abbr", "is_tax_applicable", "variable_based_on_taxable_salary", "is_additional_component"]:
+		for field in ["depends_on_payment_days", "abbr", "is_tax_applicable", "variable_based_on_taxable_salary", "is_additional_component"]:
 			struct_row[field] = component.get(field)
 
 		additional_components_list.append({
diff --git a/erpnext/hr/doctype/designation/designation.json b/erpnext/hr/doctype/designation/designation.json
index 1d4a3cf..4c3888b 100644
--- a/erpnext/hr/doctype/designation/designation.json
+++ b/erpnext/hr/doctype/designation/designation.json
@@ -1,119 +1,194 @@
 {
- "allow_copy": 0, 
- "allow_import": 1, 
- "allow_rename": 1, 
- "autoname": "field:designation_name", 
- "beta": 0, 
- "creation": "2013-01-10 16:34:13", 
- "custom": 0, 
- "docstatus": 0, 
- "doctype": "DocType", 
- "document_type": "Setup", 
- "editable_grid": 0, 
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 1,
+ "allow_rename": 1,
+ "autoname": "field:designation_name",
+ "beta": 0,
+ "creation": "2013-01-10 16:34:13",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "Setup",
+ "editable_grid": 0,
  "fields": [
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "designation_name", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Designation", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "designation_name", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "designation_name",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 1,
+   "in_standard_filter": 0,
+   "label": "Designation",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "designation_name",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
+   "translatable": 0,
+   "unique": 1
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "description", 
-   "fieldtype": "Text", 
-   "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": "Description", 
-   "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, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "description",
+   "fieldtype": "Text",
+   "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": "Description",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "required_skills_section",
+   "fieldtype": "Section Break",
+   "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": "Required Skills",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "skills",
+   "fieldtype": "Table",
+   "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": "Skills",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Designation Skill",
+   "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,
+   "translatable": 0,
    "unique": 0
   }
- ], 
- "hide_heading": 0, 
- "hide_toolbar": 0, 
- "icon": "fa fa-bookmark", 
- "idx": 1, 
- "image_view": 0, 
- "in_create": 0, 
-
- "is_submittable": 0, 
- "issingle": 0, 
- "istable": 0, 
- "max_attachments": 0, 
- "modified": "2017-02-17 16:53:43.895882", 
- "modified_by": "Administrator", 
- "module": "HR", 
- "name": "Designation", 
- "owner": "Administrator", 
+ ],
+ "has_web_view": 0,
+ "hide_toolbar": 0,
+ "icon": "fa fa-bookmark",
+ "idx": 1,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 0,
+ "max_attachments": 0,
+ "menu_index": 0,
+ "modified": "2019-04-16 10:02:23.277734",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Designation",
+ "owner": "Administrator",
  "permissions": [
   {
-   "amend": 0, 
-   "apply_user_permissions": 0, 
-   "cancel": 0, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "HR User", 
-   "set_user_permissions": 0, 
-   "share": 1, 
-   "submit": 0, 
+   "amend": 0,
+   "cancel": 0,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 0,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "HR User",
+   "set_user_permissions": 0,
+   "share": 1,
+   "submit": 0,
    "write": 1
   }
- ], 
- "quick_entry": 1, 
- "read_only": 0, 
- "read_only_onload": 0, 
- "show_name_in_global_search": 1, 
- "sort_order": "ASC", 
- "track_changes": 0, 
- "track_seen": 0
+ ],
+ "quick_entry": 1,
+ "read_only": 0,
+ "show_name_in_global_search": 1,
+ "sort_order": "ASC",
+ "track_changes": 0,
+ "track_seen": 0,
+ "track_views": 0
 }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/designation_skill/__init__.py b/erpnext/hr/doctype/designation_skill/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/hr/doctype/designation_skill/__init__.py
diff --git a/erpnext/hr/doctype/designation_skill/designation_skill.json b/erpnext/hr/doctype/designation_skill/designation_skill.json
new file mode 100644
index 0000000..30e23d0
--- /dev/null
+++ b/erpnext/hr/doctype/designation_skill/designation_skill.json
@@ -0,0 +1,74 @@
+{
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "beta": 0,
+ "creation": "2019-04-16 10:01:05.259881",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "fields": [
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "skill",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 1,
+   "in_standard_filter": 0,
+   "label": "Skill",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Skill",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  }
+ ],
+ "has_web_view": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 1,
+ "max_attachments": 0,
+ "modified": "2019-04-16 13:42:10.760449",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Designation Skill",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 1,
+ "read_only": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "ASC",
+ "track_changes": 1,
+ "track_seen": 0,
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/designation_skill/designation_skill.py b/erpnext/hr/doctype/designation_skill/designation_skill.py
new file mode 100644
index 0000000..c37d21f
--- /dev/null
+++ b/erpnext/hr/doctype/designation_skill/designation_skill.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+# import frappe
+from frappe.model.document import Document
+
+class DesignationSkill(Document):
+	pass
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index a403c39..48957e5 100755
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -80,6 +80,14 @@
 		if not self.create_user_permission: return
 		if not has_permission('User Permission', ptype='write'): return
 
+		employee_user_permission_exists = frappe.db.exists('User Permission', {
+			'allow': 'Employee',
+			'for_value': self.name,
+			'user': self.user_id
+		})
+
+		if employee_user_permission_exists: return
+
 		add_user_permission("Employee", self.name, self.user_id)
 		set_user_permission_if_allowed("Company", self.company, self.user_id)
 
diff --git a/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.py b/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.py
index 9b6dba5..c613a13 100644
--- a/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.py
+++ b/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.py
@@ -113,7 +113,7 @@
 def get_max_benefits_remaining(employee, on_date, payroll_period):
 	max_benefits = get_max_benefits(employee, on_date)
 	if max_benefits and max_benefits > 0:
-		have_depends_on_lwp = False
+		have_depends_on_payment_days = False
 		per_day_amount_total = 0
 		payroll_period_days = get_payroll_period_days(on_date, on_date, employee)[0]
 		payroll_period_obj = frappe.get_doc("Payroll Period", payroll_period)
@@ -122,22 +122,22 @@
 		prev_sal_slip_flexi_total = get_sal_slip_total_benefit_given(employee, payroll_period_obj)
 
 		if prev_sal_slip_flexi_total > 0:
-			# Check salary structure hold depends_on_lwp component
+			# Check salary structure hold depends_on_payment_days component
 			# If yes then find the amount per day of each component and find the sum
 			sal_struct_name = get_assigned_salary_structure(employee, on_date)
 			if sal_struct_name:
 				sal_struct = frappe.get_doc("Salary Structure", sal_struct_name)
 				for sal_struct_row in sal_struct.get("earnings"):
 					salary_component = frappe.get_doc("Salary Component", sal_struct_row.salary_component)
-					if salary_component.depends_on_lwp == 1 and salary_component.pay_against_benefit_claim != 1:
-						have_depends_on_lwp = True
+					if salary_component.depends_on_payment_days == 1 and salary_component.pay_against_benefit_claim != 1:
+						have_depends_on_payment_days = True
 						benefit_amount = get_benefit_pro_rata_ratio_amount(sal_struct, salary_component.max_benefit_amount)
 						amount_per_day = benefit_amount / payroll_period_days
 						per_day_amount_total += amount_per_day
 
 			# Then the sum multiply with the no of lwp in that period
 			# Include that amount to the prev_sal_slip_flexi_total to get the actual
-			if have_depends_on_lwp and per_day_amount_total > 0:
+			if have_depends_on_payment_days and per_day_amount_total > 0:
 				holidays = get_holidays_for_employee(employee, payroll_period_obj.start_date, on_date)
 				working_days = date_diff(on_date, payroll_period_obj.start_date) + 1
 				leave_days = calculate_lwp(employee, payroll_period_obj.start_date, holidays, working_days)
@@ -185,7 +185,7 @@
 		'payroll_period': payroll_period
 	})
 
-	if frappe.db.get_value("Salary Component", struct_row.salary_component, "depends_on_lwp") != 1:
+	if frappe.db.get_value("Salary Component", struct_row.salary_component, "depends_on_payment_days") != 1:
 		if frequency == "Monthly" and actual_payroll_days in range(360, 370):
 			period_length = 1
 			period_factor = 12
diff --git a/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py b/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py
index bf150b1..8be67a8 100644
--- a/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py
+++ b/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py
@@ -170,7 +170,7 @@
 						amount += current_claimed_amount
 						struct_row = {}
 						salary_components_dict = {}
-						struct_row['depends_on_lwp'] = salary_component.depends_on_lwp
+						struct_row['depends_on_payment_days'] = salary_component.depends_on_payment_days
 						struct_row['salary_component'] = salary_component.name
 						struct_row['abbr'] = salary_component.salary_component_abbr
 						struct_row['do_not_include_in_total'] = salary_component.do_not_include_in_total
diff --git a/erpnext/hr/doctype/employee_skill/__init__.py b/erpnext/hr/doctype/employee_skill/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/hr/doctype/employee_skill/__init__.py
diff --git a/erpnext/hr/doctype/employee_skill/employee_skill.json b/erpnext/hr/doctype/employee_skill/employee_skill.json
new file mode 100644
index 0000000..4b1419e
--- /dev/null
+++ b/erpnext/hr/doctype/employee_skill/employee_skill.json
@@ -0,0 +1,141 @@
+{
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "beta": 0,
+ "creation": "2019-04-16 09:57:52.751635",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "fields": [
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "skill",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 1,
+   "in_standard_filter": 0,
+   "label": "Skill",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Skill",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "proficiency",
+   "fieldtype": "Rating",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 1,
+   "in_standard_filter": 0,
+   "label": "Proficiency",
+   "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": 1,
+   "search_index": 0,
+   "set_only_once": 0,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "default": "Today",
+   "fetch_if_empty": 0,
+   "fieldname": "evaluation_date",
+   "fieldtype": "Date",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 1,
+   "in_standard_filter": 0,
+   "label": "Evaluation Date",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  }
+ ],
+ "has_web_view": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 1,
+ "max_attachments": 0,
+ "modified": "2019-04-16 14:13:17.111035",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Employee Skill",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 1,
+ "read_only": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "ASC",
+ "track_changes": 1,
+ "track_seen": 0,
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee_skill/employee_skill.py b/erpnext/hr/doctype/employee_skill/employee_skill.py
new file mode 100644
index 0000000..ac05fba
--- /dev/null
+++ b/erpnext/hr/doctype/employee_skill/employee_skill.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+# import frappe
+from frappe.model.document import Document
+
+class EmployeeSkill(Document):
+	pass
diff --git a/erpnext/hr/doctype/employee_skill_map/__init__.py b/erpnext/hr/doctype/employee_skill_map/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/hr/doctype/employee_skill_map/__init__.py
diff --git a/erpnext/hr/doctype/employee_skill_map/employee_skill_map.js b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.js
new file mode 100644
index 0000000..b82b18d
--- /dev/null
+++ b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Employee Skill Map', {
+	// refresh: function(frm) {
+
+	// }
+	designation: (frm) => {
+		frm.set_value('employee_skills', null);
+		if (frm.doc.designation) {
+			frappe.db.get_doc('Designation', frm.doc.designation).then((designation) => {
+				designation.skills.forEach(designation_skill => {
+					let row = frappe.model.add_child(frm.doc, 'Employee Skill', 'employee_skills');
+					row.skill = designation_skill.skill;
+					row.proficiency = 1;
+				});
+				refresh_field('employee_skills');
+			});
+		}
+	}
+});
diff --git a/erpnext/hr/doctype/employee_skill_map/employee_skill_map.json b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.json
new file mode 100644
index 0000000..624145f
--- /dev/null
+++ b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.json
@@ -0,0 +1,298 @@
+{
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "autoname": "field:employee",
+ "beta": 0,
+ "creation": "2019-04-16 10:07:48.303426",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 0,
+ "engine": "InnoDB",
+ "fields": [
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "employee",
+   "fieldtype": "Link",
+   "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": "Employee",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Employee",
+   "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,
+   "translatable": 0,
+   "unique": 1
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_from": "employee.employee_name",
+   "fetch_if_empty": 0,
+   "fieldname": "employee_name",
+   "fieldtype": "Read Only",
+   "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": "Employee Name",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_from": "employee.designation",
+   "fetch_if_empty": 0,
+   "fieldname": "designation",
+   "fieldtype": "Read Only",
+   "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": "Designation",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "skills_section",
+   "fieldtype": "Section Break",
+   "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": "Skills",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "employee_skills",
+   "fieldtype": "Table",
+   "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": "Employee Skills",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Employee Skill",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "trainings_section",
+   "fieldtype": "Section Break",
+   "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": "Trainings",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "trainings",
+   "fieldtype": "Table",
+   "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": "Trainings",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Employee Training",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  }
+ ],
+ "has_web_view": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 0,
+ "max_attachments": 0,
+ "modified": "2019-04-16 16:16:40.058429",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Employee Skill Map",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [
+  {
+   "amend": 0,
+   "cancel": 0,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 1,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "System Manager",
+   "set_user_permissions": 0,
+   "share": 1,
+   "submit": 0,
+   "write": 1
+  }
+ ],
+ "quick_entry": 1,
+ "read_only": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "ASC",
+ "title_field": "employee_name",
+ "track_changes": 0,
+ "track_seen": 0,
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee_skill_map/employee_skill_map.py b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.py
new file mode 100644
index 0000000..073f02f
--- /dev/null
+++ b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+# import frappe
+from frappe.model.document import Document
+
+class EmployeeSkillMap(Document):
+	pass
diff --git a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json
index 865e821..899b869 100644
--- a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json
+++ b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json
@@ -1,5 +1,6 @@
 {
  "allow_copy": 0, 
+ "allow_events_in_timeline": 0, 
  "allow_guest_to_view": 0, 
  "allow_import": 1, 
  "allow_rename": 1, 
@@ -20,6 +21,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "employee", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -54,6 +56,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "fetch_from": "employee.company", 
+   "fetch_if_empty": 0, 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -87,6 +90,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "column_break_2", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -118,6 +122,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "payroll_period", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -151,6 +156,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "total_exemption_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -184,6 +190,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "fetch_from": "employee.department", 
+   "fetch_if_empty": 0, 
    "fieldname": "department", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -217,6 +224,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "amended_from", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -249,6 +257,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "section_break_8", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -280,6 +289,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "declarations", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -300,7 +310,7 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 1, 
+   "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
    "translatable": 0, 
@@ -317,7 +327,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-08-21 16:15:49.363307", 
+ "modified": "2019-04-23 15:50:48.693555", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Employee Tax Exemption Declaration", 
diff --git a/erpnext/hr/doctype/employee_training/__init__.py b/erpnext/hr/doctype/employee_training/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/hr/doctype/employee_training/__init__.py
diff --git a/erpnext/hr/doctype/employee_training/employee_training.json b/erpnext/hr/doctype/employee_training/employee_training.json
new file mode 100644
index 0000000..0e0dc15
--- /dev/null
+++ b/erpnext/hr/doctype/employee_training/employee_training.json
@@ -0,0 +1,108 @@
+{
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "beta": 0,
+ "creation": "2019-04-16 16:15:50.931545",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "fields": [
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "training",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 1,
+   "in_standard_filter": 0,
+   "label": "Training",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Training Event",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_from": "training.end_time",
+   "fetch_if_empty": 0,
+   "fieldname": "training_date",
+   "fieldtype": "Date",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 1,
+   "in_standard_filter": 0,
+   "label": "Training Date",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  }
+ ],
+ "has_web_view": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 1,
+ "max_attachments": 0,
+ "modified": "2019-04-22 12:48:56.925419",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Employee Training",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 1,
+ "read_only": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "ASC",
+ "track_changes": 1,
+ "track_seen": 0,
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee_training/employee_training.py b/erpnext/hr/doctype/employee_training/employee_training.py
new file mode 100644
index 0000000..810796d
--- /dev/null
+++ b/erpnext/hr/doctype/employee_training/employee_training.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+# import frappe
+from frappe.model.document import Document
+
+class EmployeeTraining(Document):
+	pass
diff --git a/erpnext/hr/doctype/salary_component/salary_component.js b/erpnext/hr/doctype/salary_component/salary_component.js
index b33451b..1d398cc 100644
--- a/erpnext/hr/doctype/salary_component/salary_component.js
+++ b/erpnext/hr/doctype/salary_component/salary_component.js
@@ -75,5 +75,5 @@
 	frm.set_value("amount_based_on_formula", 0);
 	frm.set_value("statistical_component", 0);
 	frm.set_value("do_not_include_in_total", 0);
-	frm.set_value("depends_on_lwp", 0);
+	frm.set_value("depends_on_payment_days", 0);
 };
diff --git a/erpnext/hr/doctype/salary_component/salary_component.json b/erpnext/hr/doctype/salary_component/salary_component.json
index f7ce08c..697d224 100644
--- a/erpnext/hr/doctype/salary_component/salary_component.json
+++ b/erpnext/hr/doctype/salary_component/salary_component.json
@@ -1,5 +1,6 @@
 {
  "allow_copy": 0, 
+ "allow_events_in_timeline": 0, 
  "allow_guest_to_view": 0, 
  "allow_import": 1, 
  "allow_rename": 1, 
@@ -19,6 +20,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "salary_component", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -51,6 +53,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "salary_component_abbr", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -85,6 +88,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "type", 
    "fieldtype": "Select", 
    "hidden": 0, 
@@ -119,6 +123,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.is_flexible_benefit != 1", 
+   "fetch_if_empty": 0, 
    "fieldname": "is_additional_component", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -153,6 +158,7 @@
    "columns": 0, 
    "default": "1", 
    "depends_on": "eval:doc.type == \"Earning\"", 
+   "fetch_if_empty": 0, 
    "fieldname": "is_tax_applicable", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -186,6 +192,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "default": "1", 
+   "fetch_if_empty": 0, 
    "fieldname": "is_payable", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -218,7 +225,9 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "depends_on_lwp", 
+   "default": "1", 
+   "fetch_if_empty": 0, 
+   "fieldname": "depends_on_payment_days", 
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -227,7 +236,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Depends on Leave Without Pay", 
+   "label": "Depends on Payment Days", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -250,6 +259,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "do_not_include_in_total", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -282,6 +292,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "column_break_4", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -313,6 +324,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "disabled", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -345,6 +357,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "description", 
    "fieldtype": "Small Text", 
    "hidden": 0, 
@@ -378,6 +391,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "description": "If selected, the value specified or calculated in this component will not contribute to the earnings or deductions. However, it's value can be referenced by other components that can be added or deducted. ", 
+   "fetch_if_empty": 0, 
    "fieldname": "statistical_component", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -411,6 +425,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.type==\"Earning\" && doc.is_additional_component != 1 && doc.statistical_component!=1", 
+   "fetch_if_empty": 0, 
    "fieldname": "flexible_benefits", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -444,6 +459,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.is_additional_component != 1", 
+   "fetch_if_empty": 0, 
    "fieldname": "is_flexible_benefit", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -477,6 +493,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "is_flexible_benefit", 
+   "fetch_if_empty": 0, 
    "fieldname": "max_benefit_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -509,6 +526,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "column_break_9", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -541,6 +559,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "is_flexible_benefit", 
+   "fetch_if_empty": 0, 
    "fieldname": "pay_against_benefit_claim", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -574,6 +593,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.is_flexible_benefit == 1 & doc.create_separate_payment_entry_against_benefit_claim !=1", 
+   "fetch_if_empty": 0, 
    "fieldname": "only_tax_impact", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -607,6 +627,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.is_flexible_benefit == 1 & doc.only_tax_impact !=1", 
+   "fetch_if_empty": 0, 
    "fieldname": "create_separate_payment_entry_against_benefit_claim", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -640,6 +661,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.type=='Deduction'", 
+   "fetch_if_empty": 0, 
    "fieldname": "section_break_11", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -671,6 +693,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "variable_based_on_taxable_salary", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -704,6 +727,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.statistical_component != 1", 
+   "fetch_if_empty": 0, 
    "fieldname": "section_break_5", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -736,6 +760,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "accounts", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -771,6 +796,7 @@
    "collapsible_depends_on": "", 
    "columns": 0, 
    "depends_on": "eval:doc.is_flexible_benefit != 1 && doc.variable_based_on_taxable_salary != 1", 
+   "fetch_if_empty": 0, 
    "fieldname": "condition_and_formula", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -803,6 +829,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "condition", 
    "fieldtype": "Code", 
    "hidden": 0, 
@@ -836,6 +863,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "default": "", 
+   "fetch_if_empty": 0, 
    "fieldname": "amount_based_on_formula", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -869,6 +897,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.amount_based_on_formula!==0", 
+   "fetch_if_empty": 0, 
    "fieldname": "formula", 
    "fieldtype": "Code", 
    "hidden": 0, 
@@ -902,6 +931,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.amount_based_on_formula!==1", 
+   "fetch_if_empty": 0, 
    "fieldname": "amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -934,6 +964,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "column_break_28", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -965,6 +996,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "help", 
    "fieldtype": "HTML", 
    "hidden": 0, 
@@ -1003,7 +1035,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-09-20 16:44:58.876044", 
+ "modified": "2019-04-16 19:08:55.323567", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Salary Component", 
diff --git a/erpnext/hr/doctype/salary_detail/salary_detail.json b/erpnext/hr/doctype/salary_detail/salary_detail.json
index 0ec3cd6..8f2649a 100644
--- a/erpnext/hr/doctype/salary_detail/salary_detail.json
+++ b/erpnext/hr/doctype/salary_detail/salary_detail.json
@@ -19,6 +19,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "salary_component", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -55,6 +56,7 @@
    "default": "", 
    "depends_on": "eval:doc.parenttype=='Salary Structure'", 
    "fetch_from": "salary_component.salary_component_abbr", 
+   "fetch_if_empty": 0, 
    "fieldname": "abbr", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -88,6 +90,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "column_break_3", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -121,6 +124,7 @@
    "columns": 0, 
    "description": "If selected, the value specified or calculated in this component will not contribute to the earnings or deductions. However, it's value can be referenced by other components that can be added or deducted. ", 
    "fetch_from": "salary_component.statistical_component", 
+   "fetch_if_empty": 0, 
    "fieldname": "statistical_component", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -154,6 +158,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "fetch_from": "salary_component.is_tax_applicable", 
+   "fetch_if_empty": 0, 
    "fieldname": "is_tax_applicable", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -187,6 +192,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "fetch_from": "salary_component.is_flexible_benefit", 
+   "fetch_if_empty": 0, 
    "fieldname": "is_flexible_benefit", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -221,6 +227,7 @@
    "columns": 0, 
    "default": "", 
    "fetch_from": "salary_component.is_additional_component", 
+   "fetch_if_empty": 0, 
    "fieldname": "is_additional_component", 
    "fieldtype": "Check", 
    "hidden": 1, 
@@ -255,6 +262,7 @@
    "columns": 0, 
    "default": "", 
    "fetch_from": "salary_component.variable_based_on_taxable_salary", 
+   "fetch_if_empty": 0, 
    "fieldname": "variable_based_on_taxable_salary", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -288,8 +296,9 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "", 
-   "fetch_from": "salary_component.depends_on_lwp", 
-   "fieldname": "depends_on_lwp", 
+   "fetch_from": "salary_component.depends_on_payment_days", 
+   "fetch_if_empty": 0, 
+   "fieldname": "depends_on_payment_days", 
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -298,7 +307,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Depends on Leave Without Pay", 
+   "label": "Depends on Payment Days", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -322,6 +331,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.is_flexible_benefit != 1", 
+   "fetch_if_empty": 0, 
    "fieldname": "section_break_2", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -354,6 +364,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.parenttype=='Salary Structure'", 
+   "fetch_if_empty": 0, 
    "fieldname": "condition", 
    "fieldtype": "Code", 
    "hidden": 0, 
@@ -389,6 +400,7 @@
    "default": "0", 
    "depends_on": "eval:doc.parenttype=='Salary Structure'", 
    "fetch_from": "", 
+   "fetch_if_empty": 0, 
    "fieldname": "amount_based_on_formula", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -425,6 +437,7 @@
    "default": "", 
    "depends_on": "eval:doc.amount_based_on_formula!==0 && doc.parenttype==='Salary Structure'", 
    "description": "", 
+   "fetch_if_empty": 0, 
    "fieldname": "formula", 
    "fieldtype": "Code", 
    "hidden": 0, 
@@ -458,6 +471,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.amount_based_on_formula!==1 || doc.parenttype==='Salary Slip'", 
+   "fetch_if_empty": 0, 
    "fieldname": "amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -491,6 +505,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_if_empty": 0, 
    "fieldname": "do_not_include_in_total", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -524,6 +539,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.parenttype=='Salary Structure'", 
+   "fetch_if_empty": 0, 
    "fieldname": "default_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -558,6 +574,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.parenttype=='Salary Slip' && doc.parentfield=='deductions' && doc.variable_based_on_taxable_salary == 1", 
+   "fetch_if_empty": 0, 
    "fieldname": "tax_on_flexible_benefit", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -591,6 +608,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.parenttype=='Salary Slip' && doc.parentfield=='deductions' && doc.variable_based_on_taxable_salary == 1", 
+   "fetch_if_empty": 0, 
    "fieldname": "tax_on_additional_salary", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -624,6 +642,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.parenttype=='Salary Structure'", 
+   "fetch_if_empty": 0, 
    "fieldname": "section_break_11", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -656,6 +675,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "eval:doc.parenttype=='Salary Structure'", 
+   "fetch_if_empty": 0, 
    "fieldname": "condition_and_formula_help", 
    "fieldtype": "HTML", 
    "hidden": 0, 
@@ -693,7 +713,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2019-02-04 14:41:56.030991", 
+ "modified": "2019-04-16 19:09:31.726597", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Salary Detail", 
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.js b/erpnext/hr/doctype/salary_slip/salary_slip.js
index 86c50d0..4e9fcce 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.js
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.js
@@ -132,9 +132,6 @@
 	});
 }
 
-cur_frm.cscript.employee = function(doc,dt,dn){
-	get_emp_and_leave_details(doc, dt, dn);
-}
 
 cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
 	if (doc.employee && doc.start_date && doc.end_date) {
@@ -160,7 +157,7 @@
 	calculate_all(doc, dt, dn);
 }
 
-cur_frm.cscript.depends_on_lwp = function(doc,dt,dn){
+cur_frm.cscript.depends_on_payment_days = function(doc,dt,dn){
 	calculate_earning_total(doc, dt, dn, true);
 	calculate_ded_total(doc, dt, dn, true);
 	calculate_net_pay(doc, dt, dn);
@@ -174,7 +171,7 @@
 	var tbl = doc.earnings || [];
 	var total_earn = 0;
 	for(var i = 0; i < tbl.length; i++){
-		if(cint(tbl[i].depends_on_lwp) == 1) {
+		if(cint(tbl[i].depends_on_payment_days) == 1) {
 			tbl[i].amount =  Math.round(tbl[i].default_amount)*(flt(doc.payment_days) /
 				cint(doc.total_working_days)*100)/100;
 		} else if(reset_amount && tbl[i].default_amount) {
@@ -196,7 +193,7 @@
 	var tbl = doc.deductions || [];
 	var total_ded = 0;
 	for(var i = 0; i < tbl.length; i++){
-		if(cint(tbl[i].depends_on_lwp) == 1) {
+		if(cint(tbl[i].depends_on_payment_days) == 1) {
 			tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days)/cint(doc.total_working_days)*100)/100;
 		} else if(reset_amount && tbl[i].default_amount) {
 			tbl[i].amount = tbl[i].default_amount;
@@ -209,16 +206,12 @@
 	refresh_many(['deductions', 'total_deduction']);
 }
 
-// Calculate net payable amount
-// ------------------------------------------------------------------------
 var calculate_net_pay = function(doc, dt, dn) {
 	doc.net_pay = flt(doc.gross_pay) - flt(doc.total_deduction);
 	doc.rounded_total = Math.round(doc.net_pay);
 	refresh_many(['net_pay', 'rounded_total']);
 }
 
-// validate
-// ------------------------------------------------------------------------
 cur_frm.cscript.validate = function(doc, dt, dn) {
 	calculate_all(doc, dt, dn);
 }
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index 3568e2d..1b487a6 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -131,11 +131,12 @@
 		for d in self.get(key):
 			if d.salary_component == struct_row.salary_component:
 				component_row = d
+
 		if not component_row:
 			self.append(key, {
 				'amount': amount,
 				'default_amount': amount,
-				'depends_on_lwp' : struct_row.depends_on_lwp,
+				'depends_on_payment_days' : struct_row.depends_on_payment_days,
 				'salary_component' : struct_row.salary_component,
 				'abbr' : struct_row.abbr,
 				'do_not_include_in_total' : struct_row.do_not_include_in_total,
@@ -147,12 +148,11 @@
 				'tax_on_additional_salary': additional_tax
 			})
 		else:
-			if overwrite:
-				component_row.default_amount = amount
-				component_row.amount = amount
-			else:
-				component_row.default_amount += amount
-				component_row.amount = component_row.default_amount
+			if not overwrite:
+				amount += struct_row.get("default_amount", 0)
+
+			component_row.default_amount = amount
+			component_row.amount = amount
 
 			component_row.tax_on_flexible_benefit = benefit_tax
 			component_row.tax_on_additional_salary = additional_tax
@@ -167,7 +167,7 @@
 			if d.amount_based_on_formula:
 				formula = d.formula.strip() if d.formula else None
 				if formula:
-					amount = frappe.safe_eval(formula, self.whitelisted_globals, data)
+					amount = rounded(frappe.safe_eval(formula, self.whitelisted_globals, data))
 			if amount:
 				data[d.abbr] = amount
 
@@ -418,7 +418,7 @@
 
 		for d in self.get(component_type):
 			if (self.salary_structure and
-				cint(d.depends_on_lwp) and
+				cint(d.depends_on_payment_days) and
 				(not
 				    self.salary_slip_based_on_timesheet or
 					getdate(self.start_date) < joining_date or
@@ -431,7 +431,7 @@
 				)
 
 			elif not self.payment_days and not self.salary_slip_based_on_timesheet and \
-				cint(d.depends_on_lwp):
+				cint(d.depends_on_payment_days):
 				d.amount = 0
 			elif not d.amount:
 				d.amount = d.default_amount
@@ -602,12 +602,11 @@
 			annual_earning = taxable_earning["taxable_earning"] * period_factor
 			exemption_amount = 0
 			if frappe.db.exists("Employee Tax Exemption Declaration", {"employee": self.employee,
-			"payroll_period": payroll_period.name, "docstatus": 1}):
+					"payroll_period": payroll_period.name, "docstatus": 1}):
 				exemption_amount = frappe.db.get_value("Employee Tax Exemption Declaration",
 					{"employee": self.employee, "payroll_period": payroll_period.name, "docstatus": 1},
 					"total_exemption_amount")
 			annual_taxable_earning = annual_earning - exemption_amount
-
 		if self.deduct_tax_for_unclaimed_employee_benefits or self.deduct_tax_for_unsubmitted_tax_exemption_proof:
 			tax_detail = self.get_tax_paid_in_period(payroll_period, tax_component)
 			if tax_detail:
@@ -739,22 +738,24 @@
 		# less paid taxes
 		if args.get("pro_rata_tax_paid"):
 			tax_amount -= args.get("pro_rata_tax_paid")
+		tax_amount = rounded(tax_amount)
 		struct_row = self.get_salary_slip_row(args.get("tax_component"))
 		return [struct_row, tax_amount, benefit_tax, additional_tax]
 
-	def calculate_tax_by_tax_slab(self, payroll_period, annual_earning):
+	def calculate_tax_by_tax_slab(self, payroll_period, annual_taxable_earning):
 		payroll_period_obj = frappe.get_doc("Payroll Period", payroll_period)
 		data = self.get_data_for_eval()
+		data.update({"annual_taxable_earning": annual_taxable_earning})
 		taxable_amount = 0
 		for slab in payroll_period_obj.taxable_salary_slabs:
 			if slab.condition and not self.eval_tax_slab_condition(slab.condition, data):
 				continue
-			if not slab.to_amount and annual_earning > slab.from_amount:
-				taxable_amount += (annual_earning - slab.from_amount) * slab.percent_deduction *.01
+			if not slab.to_amount and annual_taxable_earning > slab.from_amount:
+				taxable_amount += (annual_taxable_earning - slab.from_amount) * slab.percent_deduction *.01
 				continue
-			if annual_earning > slab.from_amount and annual_earning < slab.to_amount:
-				taxable_amount += (annual_earning - slab.from_amount) * slab.percent_deduction *.01
-			elif annual_earning > slab.from_amount and annual_earning > slab.to_amount:
+			if annual_taxable_earning > slab.from_amount and annual_taxable_earning < slab.to_amount:
+				taxable_amount += (annual_taxable_earning - slab.from_amount) * slab.percent_deduction *.01
+			elif annual_taxable_earning > slab.from_amount and annual_taxable_earning > slab.to_amount:
 				taxable_amount += (slab.to_amount - slab.from_amount) * slab.percent_deduction * .01
 		return taxable_amount
 
@@ -773,13 +774,21 @@
 
 	def get_period_factor(self, period_start, period_end, start_date=None, end_date=None):
 		# TODO if both deduct checked update the factor to make tax consistent
+		joining_date, relieving_date = frappe.db.get_value("Employee", self.employee, ["date_of_joining", "relieving_date"])
+		if getdate(joining_date) > getdate(period_start):
+			period_start = joining_date
+		if relieving_date and getdate(relieving_date) < getdate(period_end):
+			period_end = relieving_date
+
 		payroll_days = date_diff(period_end, period_start) + 1
 		if start_date and end_date:
 			salary_days = date_diff(end_date, start_date) + 1
 			return flt(payroll_days)/flt(salary_days)
+
 		# if period configured for a year and monthly frequency return 12 to make tax calc consistent
 		if 360 <= payroll_days <= 370 and self.payroll_frequency == "Monthly":
 			return 12
+
 		salary_days = date_diff(self.end_date, self.start_date) + 1
 		return flt(payroll_days)/flt(salary_days)
 
@@ -787,7 +796,7 @@
 		component = frappe.get_doc("Salary Component", salary_component)
 		# Data for update_component_row
 		struct_row = {}
-		struct_row['depends_on_lwp'] = component.depends_on_lwp
+		struct_row['depends_on_payment_days'] = component.depends_on_payment_days
 		struct_row['salary_component'] = component.name
 		struct_row['abbr'] = component.salary_component_abbr
 		struct_row['do_not_include_in_total'] = component.do_not_include_in_total
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.js b/erpnext/hr/doctype/salary_structure/salary_structure.js
index 79d75bf..e3f37e7 100755
--- a/erpnext/hr/doctype/salary_structure/salary_structure.js
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.js
@@ -246,7 +246,7 @@
 							frappe.model.set_value(cdt, cdn, 'amount', result.amount);
 						}
 						frappe.model.set_value(cdt, cdn, 'statistical_component', result.statistical_component);
-						frappe.model.set_value(cdt, cdn, 'depends_on_lwp', result.depends_on_lwp);
+						frappe.model.set_value(cdt, cdn, 'depends_on_payment_days', result.depends_on_payment_days);
 						frappe.model.set_value(cdt, cdn, 'do_not_include_in_total', result.do_not_include_in_total);
 						frappe.model.set_value(cdt, cdn, 'variable_based_on_taxable_salary', result.variable_based_on_taxable_salary);
 						frappe.model.set_value(cdt, cdn, 'is_tax_applicable', result.is_tax_applicable);
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.py b/erpnext/hr/doctype/salary_structure/salary_structure.py
index 202ae9b..26efd00 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.py
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.py
@@ -18,7 +18,7 @@
 		self.validate_max_benefits_with_flexi()
 
 	def set_missing_values(self):
-		overwritten_fields = ["depends_on_lwp", "variable_based_on_taxable_salary", "is_tax_applicable", "is_flexible_benefit"]
+		overwritten_fields = ["depends_on_payment_days", "variable_based_on_taxable_salary", "is_tax_applicable", "is_flexible_benefit"]
 		overwritten_fields_if_missing = ["amount_based_on_formula", "formula", "amount"]
 		for table in ["earnings", "deductions"]:
 			for d in self.get(table):
@@ -126,7 +126,7 @@
 
 def get_existing_assignments(employees, salary_structure,from_date):
 	salary_structures_assignments = frappe.db.sql_list("""
-		select distinct employee from `tabSalary Structure Assignment` 
+		select distinct employee from `tabSalary Structure Assignment`
 		where salary_structure=%s and employee in (%s)
 		and from_date=%s and docstatus=1
 	""" % ('%s', ', '.join(['%s']*len(employees)),'%s'), [salary_structure] + employees+[from_date])
diff --git a/erpnext/hr/doctype/skill/__init__.py b/erpnext/hr/doctype/skill/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/hr/doctype/skill/__init__.py
diff --git a/erpnext/hr/doctype/skill/skill.js b/erpnext/hr/doctype/skill/skill.js
new file mode 100644
index 0000000..a939ff0
--- /dev/null
+++ b/erpnext/hr/doctype/skill/skill.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Skill', {
+	// refresh: function(frm) {
+
+	// }
+});
diff --git a/erpnext/hr/doctype/skill/skill.json b/erpnext/hr/doctype/skill/skill.json
new file mode 100644
index 0000000..5182973
--- /dev/null
+++ b/erpnext/hr/doctype/skill/skill.json
@@ -0,0 +1,113 @@
+{
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "autoname": "field:skill_name",
+ "beta": 0,
+ "creation": "2019-04-16 09:54:39.486915",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 0,
+ "engine": "InnoDB",
+ "fields": [
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "skill_name",
+   "fieldtype": "Data",
+   "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": "Skill Name",
+   "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,
+   "translatable": 0,
+   "unique": 1
+  }
+ ],
+ "has_web_view": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 0,
+ "max_attachments": 0,
+ "modified": "2019-04-16 09:55:00.536328",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Skill",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [
+  {
+   "amend": 0,
+   "cancel": 0,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 1,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "System Manager",
+   "set_user_permissions": 0,
+   "share": 1,
+   "submit": 0,
+   "write": 1
+  },
+  {
+   "amend": 0,
+   "cancel": 0,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 1,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "HR Manager",
+   "set_user_permissions": 0,
+   "share": 1,
+   "submit": 0,
+   "write": 1
+  }
+ ],
+ "quick_entry": 1,
+ "read_only": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "ASC",
+ "track_changes": 1,
+ "track_seen": 0,
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/skill/skill.py b/erpnext/hr/doctype/skill/skill.py
new file mode 100644
index 0000000..8d24212
--- /dev/null
+++ b/erpnext/hr/doctype/skill/skill.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+# import frappe
+from frappe.model.document import Document
+
+class Skill(Document):
+	pass
diff --git a/erpnext/hr/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json b/erpnext/hr/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json
index 20c7d23..ceaf4a6 100644
--- a/erpnext/hr/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json
+++ b/erpnext/hr/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json
@@ -1,18 +1,18 @@
 {
- "creation": "2016-07-07 12:38:32.447281", 
- "custom_format": 0, 
- "disabled": 0, 
- "doc_type": "Salary Slip", 
- "docstatus": 0, 
- "doctype": "Print Format", 
- "font": "Default", 
- "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"HTML\", \"options\": \"  <h3 style=\\\"text-align: right;\\\">{{doc.name}}</h3><div><hr></div>  \"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"employee\"}, {\"print_hide\": 0, \"fieldname\": \"employee_name\"}, {\"print_hide\": 0, \"fieldname\": \"department\"}, {\"print_hide\": 0, \"fieldname\": \"designation\"}, {\"print_hide\": 0, \"fieldname\": \"branch\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"start_date\"}, {\"print_hide\": 0, \"fieldname\": \"end_date\"}, {\"print_hide\": 0, \"fieldname\": \"total_working_hours\"}, {\"print_hide\": 0, \"fieldname\": \"hour_rate\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"time_sheet\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"working_hours\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"timesheets\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"depends_on_lwp\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"earnings\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"depends_on_lwp\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"deductions\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"gross_pay\"}, {\"print_hide\": 0, \"fieldname\": \"total_deduction\"}, {\"print_hide\": 0, \"fieldname\": \"net_pay\"}, {\"print_hide\": 0, \"fieldname\": \"rounded_total\"}, {\"print_hide\": 0, \"fieldname\": \"total_in_words\"}]", 
- "idx": 0, 
- "modified": "2016-08-21 21:02:59.896033", 
- "modified_by": "Administrator", 
- "name": "Salary Slip based on Timesheet", 
- "owner": "Administrator", 
- "print_format_builder": 1, 
- "print_format_type": "Server", 
+ "creation": "2016-07-07 12:38:32.447281",
+ "custom_format": 0,
+ "disabled": 0,
+ "doc_type": "Salary Slip",
+ "docstatus": 0,
+ "doctype": "Print Format",
+ "font": "Default",
+ "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"HTML\", \"options\": \"  <h3 style=\\\"text-align: right;\\\">{{doc.name}}</h3><div><hr></div>  \"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"employee\"}, {\"print_hide\": 0, \"fieldname\": \"employee_name\"}, {\"print_hide\": 0, \"fieldname\": \"department\"}, {\"print_hide\": 0, \"fieldname\": \"designation\"}, {\"print_hide\": 0, \"fieldname\": \"branch\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"start_date\"}, {\"print_hide\": 0, \"fieldname\": \"end_date\"}, {\"print_hide\": 0, \"fieldname\": \"total_working_hours\"}, {\"print_hide\": 0, \"fieldname\": \"hour_rate\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"time_sheet\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"working_hours\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"timesheets\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"depends_on_payment_days\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"earnings\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"depends_on_payment_days\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"deductions\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"gross_pay\"}, {\"print_hide\": 0, \"fieldname\": \"total_deduction\"}, {\"print_hide\": 0, \"fieldname\": \"net_pay\"}, {\"print_hide\": 0, \"fieldname\": \"rounded_total\"}, {\"print_hide\": 0, \"fieldname\": \"total_in_words\"}]",
+ "idx": 0,
+ "modified": "2016-08-21 21:02:59.896033",
+ "modified_by": "Administrator",
+ "name": "Salary Slip based on Timesheet",
+ "owner": "Administrator",
+ "print_format_builder": 1,
+ "print_format_type": "Server",
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/hr/print_format/salary_slip_standard/salary_slip_standard.json b/erpnext/hr/print_format/salary_slip_standard/salary_slip_standard.json
index 9f299df..b01239f 100644
--- a/erpnext/hr/print_format/salary_slip_standard/salary_slip_standard.json
+++ b/erpnext/hr/print_format/salary_slip_standard/salary_slip_standard.json
@@ -1,22 +1,22 @@
 {
- "align_labels_right": 0, 
- "creation": "2016-07-07 11:45:14.872204", 
- "custom_format": 0, 
- "disabled": 0, 
- "doc_type": "Salary Slip", 
- "docstatus": 0, 
- "doctype": "Print Format", 
- "font": "Default", 
- "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"   <h3 style=\\\"text-align: right;\\\"><span style=\\\"line-height: 1.42857;\\\">{{doc.name}}</span></h3>\\n<div>\\n    <hr style=\\\"text-align: center;\\\">\\n</div>   \"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"employee\", \"label\": \"Employee\"}, {\"print_hide\": 0, \"fieldname\": \"company\", \"label\": \"Company\"}, {\"print_hide\": 0, \"fieldname\": \"employee_name\", \"label\": \"Employee Name\"}, {\"print_hide\": 0, \"fieldname\": \"department\", \"label\": \"Department\"}, {\"print_hide\": 0, \"fieldname\": \"designation\", \"label\": \"Designation\"}, {\"print_hide\": 0, \"fieldname\": \"branch\", \"label\": \"Branch\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"start_date\", \"label\": \"Start Date\"}, {\"print_hide\": 0, \"fieldname\": \"end_date\", \"label\": \"End Date\"}, {\"print_hide\": 0, \"fieldname\": \"total_working_days\", \"label\": \"Working Days\"}, {\"print_hide\": 0, \"fieldname\": \"leave_without_pay\", \"label\": \"Leave Without Pay\"}, {\"print_hide\": 0, \"fieldname\": \"payment_days\", \"label\": \"Payment Days\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"earnings\", \"label\": \"Earnings\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"depends_on_lwp\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"deductions\", \"label\": \"Deductions\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"gross_pay\", \"label\": \"Gross Pay\"}, {\"print_hide\": 0, \"fieldname\": \"total_deduction\", \"label\": \"Total Deduction\"}, {\"print_hide\": 0, \"fieldname\": \"net_pay\", \"label\": \"Net Pay\"}, {\"print_hide\": 0, \"fieldname\": \"rounded_total\", \"label\": \"Rounded Total\"}, {\"print_hide\": 0, \"fieldname\": \"total_in_words\", \"label\": \"Total in words\"}]", 
- "idx": 0, 
- "line_breaks": 0, 
- "modified": "2018-07-24 19:31:39.040701", 
- "modified_by": "Administrator", 
- "module": "HR", 
- "name": "Salary Slip Standard", 
- "owner": "Administrator", 
- "print_format_builder": 1, 
- "print_format_type": "Server", 
- "show_section_headings": 0, 
+ "align_labels_right": 0,
+ "creation": "2016-07-07 11:45:14.872204",
+ "custom_format": 0,
+ "disabled": 0,
+ "doc_type": "Salary Slip",
+ "docstatus": 0,
+ "doctype": "Print Format",
+ "font": "Default",
+ "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"   <h3 style=\\\"text-align: right;\\\"><span style=\\\"line-height: 1.42857;\\\">{{doc.name}}</span></h3>\\n<div>\\n    <hr style=\\\"text-align: center;\\\">\\n</div>   \"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"employee\", \"label\": \"Employee\"}, {\"print_hide\": 0, \"fieldname\": \"company\", \"label\": \"Company\"}, {\"print_hide\": 0, \"fieldname\": \"employee_name\", \"label\": \"Employee Name\"}, {\"print_hide\": 0, \"fieldname\": \"department\", \"label\": \"Department\"}, {\"print_hide\": 0, \"fieldname\": \"designation\", \"label\": \"Designation\"}, {\"print_hide\": 0, \"fieldname\": \"branch\", \"label\": \"Branch\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"start_date\", \"label\": \"Start Date\"}, {\"print_hide\": 0, \"fieldname\": \"end_date\", \"label\": \"End Date\"}, {\"print_hide\": 0, \"fieldname\": \"total_working_days\", \"label\": \"Working Days\"}, {\"print_hide\": 0, \"fieldname\": \"leave_without_pay\", \"label\": \"Leave Without Pay\"}, {\"print_hide\": 0, \"fieldname\": \"payment_days\", \"label\": \"Payment Days\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"earnings\", \"label\": \"Earnings\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"depends_on_payment_days\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"deductions\", \"label\": \"Deductions\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"gross_pay\", \"label\": \"Gross Pay\"}, {\"print_hide\": 0, \"fieldname\": \"total_deduction\", \"label\": \"Total Deduction\"}, {\"print_hide\": 0, \"fieldname\": \"net_pay\", \"label\": \"Net Pay\"}, {\"print_hide\": 0, \"fieldname\": \"rounded_total\", \"label\": \"Rounded Total\"}, {\"print_hide\": 0, \"fieldname\": \"total_in_words\", \"label\": \"Total in words\"}]",
+ "idx": 0,
+ "line_breaks": 0,
+ "modified": "2018-07-24 19:31:39.040701",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Salary Slip Standard",
+ "owner": "Administrator",
+ "print_format_builder": 1,
+ "print_format_type": "Server",
+ "show_section_headings": 0,
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py
index 59861ce..a7d1d85 100644
--- a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py
+++ b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py
@@ -20,13 +20,12 @@
 		for bom in bom_list:
 			try:
 				bom_obj = frappe.get_doc("BOM", bom)
-				bom_obj.get_doc_before_save()
+				bom_obj.load_doc_before_save()
 				updated_bom = bom_obj.update_cost_and_exploded_items(updated_bom)
 				bom_obj.calculate_cost()
 				bom_obj.update_parent_cost()
 				bom_obj.db_update()
-				if (getattr(bom_obj.meta, 'track_changes', False)
-					and bom_obj._doc_before_save and not bom_obj.flags.ignore_version):
+				if (getattr(bom_obj.meta, 'track_changes', False) and not bom_obj.flags.ignore_version):
 					bom_obj.save_version()
 
 				frappe.db.commit()
@@ -37,7 +36,7 @@
 	def validate_bom(self):
 		if cstr(self.current_bom) == cstr(self.new_bom):
 			frappe.throw(_("Current BOM and New BOM can not be same"))
-			
+
 		if frappe.db.get_value("BOM", self.current_bom, "item") \
 			!= frappe.db.get_value("BOM", self.new_bom, "item"):
 				frappe.throw(_("The selected BOMs are not for the same item"))
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index ccfd37d..6daa85f 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -597,3 +597,5 @@
 erpnext.patches.v12_0.move_item_tax_to_item_tax_template
 erpnext.patches.v11_1.set_variant_based_on
 erpnext.patches.v11_1.woocommerce_set_creation_user
+erpnext.patches.v11_1.set_salary_details_submittable
+erpnext.patches.v11_1.rename_depends_on_lwp
diff --git a/erpnext/patches/v11_1/rename_depends_on_lwp.py b/erpnext/patches/v11_1/rename_depends_on_lwp.py
new file mode 100644
index 0000000..20d8867
--- /dev/null
+++ b/erpnext/patches/v11_1/rename_depends_on_lwp.py
@@ -0,0 +1,13 @@
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import scrub
+from frappe.model.utils.rename_field import rename_field
+
+def execute():
+	for doctype in ("Salary Component", "Salary Detail"):
+		if "depends_on_lwp" in frappe.db.get_table_columns(doctype):
+			frappe.reload_doc("hr", "doctype", scrub(doctype))
+			rename_field(doctype, "depends_on_lwp", "depends_on_payment_days")
\ No newline at end of file
diff --git a/erpnext/patches/v11_1/set_salary_details_submittable.py b/erpnext/patches/v11_1/set_salary_details_submittable.py
new file mode 100644
index 0000000..6d847ec
--- /dev/null
+++ b/erpnext/patches/v11_1/set_salary_details_submittable.py
@@ -0,0 +1,9 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	frappe.db.sql("""
+		update `tabSalary Structure` ss, `tabSalary Detail` sd
+		set sd.docstatus=1
+		where ss.name=sd.parent and ss.docstatus=1 and sd.parenttype='Salary Structure'
+	""")
diff --git a/erpnext/patches/v7_0/rename_salary_components.py b/erpnext/patches/v7_0/rename_salary_components.py
index de92fc6..bc48e34 100644
--- a/erpnext/patches/v7_0/rename_salary_components.py
+++ b/erpnext/patches/v7_0/rename_salary_components.py
@@ -5,79 +5,79 @@
 def execute():
 	if not frappe.db.exists("DocType", "Salary Structure Earning"):
 		return
-	
+
 	frappe.reload_doc("hr", "doctype", "salary_detail")
 	frappe.reload_doc("hr", "doctype", "salary_component")
-	
+
 	standard_cols = ["name", "creation", "modified", "owner", "modified_by", "parent", "parenttype", "parentfield", "idx"]
-	
+
 	dt_cols = {
 		"Salary Structure Deduction": ["d_type", "d_modified_amt", "depend_on_lwp"],
 		"Salary Structure Earning": ["e_type", "modified_value", "depend_on_lwp"],
 		"Salary Slip Earning": ["e_type", "e_modified_amount", "e_depends_on_lwp", "e_amount"],
 		"Salary Slip Deduction": ["d_type", "d_modified_amount", "d_depends_on_lwp", "d_amount"],
 	}
-	
+
 	earning_type_exists = True if "earning_type" in frappe.db.get_table_columns("Salary Slip Earning") else False
 	e_type_exists = True if "e_type" in frappe.db.get_table_columns("Salary Slip Earning") else False
-	
-	
+
+
 	if e_type_exists and earning_type_exists:
-		frappe.db.sql("""update `tabSalary Slip Earning` 
+		frappe.db.sql("""update `tabSalary Slip Earning`
 			set e_type = earning_type, e_modified_amount = earning_amount
 			where e_type is null and earning_type is not null""")
 
-		frappe.db.sql("""update `tabSalary Structure Earning` set e_type = earning_type 
+		frappe.db.sql("""update `tabSalary Structure Earning` set e_type = earning_type
 			where e_type is null and earning_type is not null""")
 
-		frappe.db.sql("""update `tabSalary Slip Deduction` set 
+		frappe.db.sql("""update `tabSalary Slip Deduction` set
 			d_type = deduction_type, d_modified_amount = deduction_amount
 			where d_type is null and deduction_type is not null""")
 
-		frappe.db.sql("""update `tabSalary Structure Deduction` set d_type = deduction_type 
+		frappe.db.sql("""update `tabSalary Structure Deduction` set d_type = deduction_type
 			where d_type is null and deduction_type is not null""")
-			
+
 	if earning_type_exists and not e_type_exists:
 		for val in dt_cols.values():
 			if val[0] == "e_type":
 				val[0] = "earning_type"
-			
+
 			if val[0] == "d_type":
 				val[0] = "deduction_type"
-				
+
 			if val[1] == "e_modified_amount":
 				val[1]  ="earning_amount"
-				
+
 			if val[1] == "d_modified_amount":
 				val[1]  ="deduction_amount"
-			
 
-	
-	target_cols = standard_cols + ["salary_component", "amount", "depends_on_lwp", "default_amount"]
-	target_cols = "`" + "`, `".join(target_cols) + "`"		
-	
-	for doctype, cols in dt_cols.items():		
+
+
+	target_cols = standard_cols + ["salary_component", "amount", "depends_on_payment_days", "default_amount"]
+	target_cols = "`" + "`, `".join(target_cols) + "`"
+
+	for doctype, cols in dt_cols.items():
 		source_cols = "`" + "`, `".join(standard_cols + cols) + "`"
 		if len(cols) == 3:
 			source_cols += ", 0"
-		
-		
+
+
 		frappe.db.sql("""INSERT INTO `tabSalary Detail` ({0}) SELECT {1} FROM `tab{2}`"""
 			.format(target_cols, source_cols, doctype))
-			
-	
+
+
 	dt_cols_de = {
 		"Deduction Type": ["deduction_name", "description"],
 		"Earning Type": ["earning_name", "description"],
 	}
-	
+
 	standard_cols_de = standard_cols
-	
+
 
 	target_cols = standard_cols_de + ["salary_component", "description"]
-	target_cols = "`" + "`, `".join(target_cols) + "`"		
-	
-	for doctype, cols in dt_cols_de.items():		
+	target_cols = "`" + "`, `".join(target_cols) + "`"
+
+	for doctype, cols in dt_cols_de.items():
 		source_cols = "`" + "`, `".join(standard_cols_de + cols) + "`"
 		try:
 			frappe.db.sql("""INSERT INTO `tabSalary Component` ({0}) SELECT {1} FROM `tab{2}`"""
@@ -85,10 +85,10 @@
 		except Exception as e:
 			if e.args[0]==1062:
 				pass
-			
+
 	update_customizations()
-			
-	for doctype in ["Salary Structure Deduction", "Salary Structure Earning", "Salary Slip Earning", 
+
+	for doctype in ["Salary Structure Deduction", "Salary Structure Earning", "Salary Slip Earning",
 			"Salary Slip Deduction", "Deduction Type", "Earning Type"] :
 		frappe.delete_doc("DocType", doctype)
 
@@ -96,35 +96,35 @@
 def update_customizations():
 	dt_cols = {
 		"Salary Structure Deduction": {
-			"d_type": "salary_component", 
-			"deduction_type": "salary_component", 
+			"d_type": "salary_component",
+			"deduction_type": "salary_component",
 			"d_modified_amt": "amount",
-			"depend_on_lwp": "depends_on_lwp"
+			"depend_on_lwp": "depends_on_payment_days"
 		},
 		"Salary Structure Earning": {
-			"e_type": "salary_component", 
-			"earning_type": "salary_component", 
+			"e_type": "salary_component",
+			"earning_type": "salary_component",
 			"modified_value": "amount",
-			"depend_on_lwp": "depends_on_lwp"
+			"depend_on_lwp": "depends_on_payment_days"
 		},
 		"Salary Slip Earning": {
-			"e_type": "salary_component", 
-			"earning_type": "salary_component", 
+			"e_type": "salary_component",
+			"earning_type": "salary_component",
 			"e_modified_amount": "amount",
 			"e_amount" : "default_amount",
-			"e_depends_on_lwp": "depends_on_lwp"
+			"e_depends_on_lwp": "depends_on_payment_days"
 		},
 		"Salary Slip Deduction": {
-			"d_type": "salary_component", 
-			"deduction_type": "salary_component", 
+			"d_type": "salary_component",
+			"deduction_type": "salary_component",
 			"d_modified_amount": "amount",
 			"d_amount" : "default_amount",
-			"d_depends_on_lwp": "depends_on_lwp"
+			"d_depends_on_lwp": "depends_on_payment_days"
 		}
 	}
-	
+
 	update_property_setters_and_custom_fields("Salary Detail", dt_cols)
-	
+
 	dt_cols = {
 		"Earning Type": {
 			"earning_name": "salary_component"
@@ -133,17 +133,17 @@
 			"deduction_name": "salary_component"
 		}
 	}
-	
+
 	update_property_setters_and_custom_fields("Salary Component", dt_cols)
-	
-	
-	
-	
+
+
+
+
 def update_property_setters_and_custom_fields(new_dt, dt_cols):
 	for doctype, cols in dt_cols.items():
 		frappe.db.sql("update `tabProperty Setter` set doc_type = %s where doc_type=%s", (new_dt, doctype))
 		frappe.db.sql("update `tabCustom Field` set dt = %s where dt=%s", (new_dt, doctype))
-		
-		
+
+
 		for old_fieldname, new_fieldname in cols.items():
 			update_property_setters(new_dt, old_fieldname, new_fieldname)
diff --git a/erpnext/projects/doctype/task/task.json b/erpnext/projects/doctype/task/task.json
index 707db08..4012346 100644
--- a/erpnext/projects/doctype/task/task.json
+++ b/erpnext/projects/doctype/task/task.json
@@ -20,6 +20,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "subject",
    "fieldtype": "Data",
    "hidden": 0,
@@ -52,6 +53,7 @@
    "bold": 1,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "project",
    "fieldtype": "Link",
    "hidden": 0,
@@ -86,6 +88,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "issue",
    "fieldtype": "Link",
    "hidden": 0,
@@ -116,10 +119,45 @@
    "allow_bulk_edit": 0,
    "allow_in_quick_entry": 0,
    "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "type",
+   "fieldtype": "Link",
+   "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": "Type",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Task Type",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
    "bold": 1,
    "collapsible": 0,
    "columns": 0,
    "default": "0",
+   "fetch_if_empty": 0,
    "fieldname": "is_group",
    "fieldtype": "Check",
    "hidden": 0,
@@ -152,6 +190,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "column_break0",
    "fieldtype": "Column Break",
    "hidden": 0,
@@ -185,6 +224,7 @@
    "bold": 1,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "status",
    "fieldtype": "Select",
    "hidden": 0,
@@ -219,6 +259,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "priority",
    "fieldtype": "Select",
    "hidden": 0,
@@ -253,6 +294,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "color",
    "fieldtype": "Color",
    "hidden": 0,
@@ -285,6 +327,7 @@
    "bold": 1,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "parent_task",
    "fieldtype": "Link",
    "hidden": 0,
@@ -320,6 +363,7 @@
    "collapsible_depends_on": "eval:doc.__islocal",
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "sb_timeline",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -353,6 +397,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "exp_start_date",
    "fieldtype": "Date",
    "hidden": 0,
@@ -389,6 +434,7 @@
    "default": "0",
    "depends_on": "",
    "description": "",
+   "fetch_if_empty": 0,
    "fieldname": "expected_time",
    "fieldtype": "Float",
    "hidden": 0,
@@ -423,6 +469,8 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "",
+   "fetch_from": "type.weight",
+   "fetch_if_empty": 0,
    "fieldname": "task_weight",
    "fieldtype": "Float",
    "hidden": 0,
@@ -455,6 +503,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "column_break_11",
    "fieldtype": "Column Break",
    "hidden": 0,
@@ -487,6 +536,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "exp_end_date",
    "fieldtype": "Date",
    "hidden": 0,
@@ -521,6 +571,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "progress",
    "fieldtype": "Percent",
    "hidden": 0,
@@ -554,6 +605,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "is_milestone",
    "fieldtype": "Check",
    "hidden": 0,
@@ -588,6 +640,7 @@
    "collapsible_depends_on": "",
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "sb_details",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -622,6 +675,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "description",
    "fieldtype": "Text Editor",
    "hidden": 0,
@@ -659,6 +713,7 @@
    "collapsible_depends_on": "",
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "sb_depends_on",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -692,6 +747,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "depends_on",
    "fieldtype": "Table",
    "hidden": 0,
@@ -726,6 +782,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "depends_on_tasks",
    "fieldtype": "Data",
    "hidden": 1,
@@ -761,6 +818,7 @@
    "columns": 0,
    "depends_on": "",
    "description": "",
+   "fetch_if_empty": 0,
    "fieldname": "sb_actual",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -796,6 +854,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "act_start_date",
    "fieldtype": "Date",
    "hidden": 0,
@@ -832,6 +891,7 @@
    "default": "",
    "depends_on": "",
    "description": "",
+   "fetch_if_empty": 0,
    "fieldname": "actual_time",
    "fieldtype": "Float",
    "hidden": 0,
@@ -865,6 +925,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "column_break_15",
    "fieldtype": "Column Break",
    "hidden": 0,
@@ -897,6 +958,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "act_end_date",
    "fieldtype": "Date",
    "hidden": 0,
@@ -931,6 +993,7 @@
    "collapsible": 1,
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "sb_costing",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -964,6 +1027,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "total_costing_amount",
    "fieldtype": "Currency",
    "hidden": 0,
@@ -999,6 +1063,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "total_expense_claim",
    "fieldtype": "Currency",
    "hidden": 0,
@@ -1032,6 +1097,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "column_break_20",
    "fieldtype": "Column Break",
    "hidden": 0,
@@ -1064,6 +1130,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "total_billing_amount",
    "fieldtype": "Currency",
    "hidden": 0,
@@ -1096,6 +1163,7 @@
    "bold": 0,
    "collapsible": 1,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "sb_more_info",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -1128,6 +1196,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "eval:doc.status == \"Closed\" || doc.status == \"Pending Review\"",
+   "fetch_if_empty": 0,
    "fieldname": "review_date",
    "fieldtype": "Date",
    "hidden": 0,
@@ -1162,6 +1231,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "eval:doc.status == \"Closed\"",
+   "fetch_if_empty": 0,
    "fieldname": "closing_date",
    "fieldtype": "Date",
    "hidden": 0,
@@ -1195,6 +1265,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "column_break_22",
    "fieldtype": "Column Break",
    "hidden": 0,
@@ -1225,6 +1296,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "department",
    "fieldtype": "Link",
    "hidden": 0,
@@ -1258,6 +1330,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "company",
    "fieldtype": "Link",
    "hidden": 0,
@@ -1290,6 +1363,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "lft",
    "fieldtype": "Int",
    "hidden": 1,
@@ -1322,6 +1396,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "rgt",
    "fieldtype": "Int",
    "hidden": 1,
@@ -1354,6 +1429,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "old_parent",
    "fieldtype": "Data",
    "hidden": 1,
@@ -1381,18 +1457,16 @@
   }
  ],
  "has_web_view": 0,
- "hide_heading": 0,
  "hide_toolbar": 0,
  "icon": "fa fa-check",
  "idx": 1,
- "image_view": 0,
  "in_create": 0,
  "is_submittable": 0,
  "issingle": 0,
  "istable": 0,
  "max_attachments": 5,
  "menu_index": 0,
- "modified": "2019-04-18 12:22:02.147606",
+ "modified": "2019-04-20 22:45:20.777600",
  "modified_by": "Administrator",
  "module": "Projects",
  "name": "Task",
@@ -1420,7 +1494,6 @@
  ],
  "quick_entry": 0,
  "read_only": 0,
- "read_only_onload": 0,
  "search_fields": "subject",
  "show_name_in_global_search": 1,
  "sort_order": "DESC",
@@ -1429,4 +1502,4 @@
  "track_changes": 0,
  "track_seen": 1,
  "track_views": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/projects/doctype/task_type/__init__.py b/erpnext/projects/doctype/task_type/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/projects/doctype/task_type/__init__.py
diff --git a/erpnext/projects/doctype/task_type/task_type.js b/erpnext/projects/doctype/task_type/task_type.js
new file mode 100644
index 0000000..c1be5da
--- /dev/null
+++ b/erpnext/projects/doctype/task_type/task_type.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Task Type', {
+	// refresh: function(frm) {
+
+	// }
+});
diff --git a/erpnext/projects/doctype/task_type/task_type.json b/erpnext/projects/doctype/task_type/task_type.json
new file mode 100644
index 0000000..3254444
--- /dev/null
+++ b/erpnext/projects/doctype/task_type/task_type.json
@@ -0,0 +1,127 @@
+{
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "autoname": "Prompt",
+ "beta": 0,
+ "creation": "2019-04-19 15:04:05.317138",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 0,
+ "engine": "InnoDB",
+ "fields": [
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "weight",
+   "fieldtype": "Float",
+   "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": "Weight",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "description",
+   "fieldtype": "Small Text",
+   "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": "Description",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  }
+ ],
+ "has_web_view": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 0,
+ "max_attachments": 0,
+ "modified": "2019-04-19 15:31:48.080164",
+ "modified_by": "Administrator",
+ "module": "Projects",
+ "name": "Task Type",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [
+  {
+   "amend": 0,
+   "cancel": 0,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 1,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "System Manager",
+   "set_user_permissions": 0,
+   "share": 1,
+   "submit": 0,
+   "write": 1
+  }
+ ],
+ "quick_entry": 1,
+ "read_only": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "ASC",
+ "track_changes": 1,
+ "track_seen": 0,
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/projects/doctype/task_type/task_type.py b/erpnext/projects/doctype/task_type/task_type.py
new file mode 100644
index 0000000..9c0b532
--- /dev/null
+++ b/erpnext/projects/doctype/task_type/task_type.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+# import frappe
+from frappe.model.document import Document
+
+class TaskType(Document):
+	pass
diff --git a/erpnext/projects/doctype/task_type/test_task_type.py b/erpnext/projects/doctype/task_type/test_task_type.py
new file mode 100644
index 0000000..1db6e27
--- /dev/null
+++ b/erpnext/projects/doctype/task_type/test_task_type.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+class TestTaskType(unittest.TestCase):
+	pass
diff --git a/erpnext/public/js/communication.js b/erpnext/public/js/communication.js
index 49701b8..5316eb4 100644
--- a/erpnext/public/js/communication.js
+++ b/erpnext/public/js/communication.js
@@ -33,7 +33,7 @@
 
 	make_lead_from_communication: (frm) => {
 		return frappe.call({
-			method: "frappe.email.inbox.make_lead_from_communication",
+			method: "erpnext.crm.doctype.lead.lead.make_lead_from_communication",
 			args: {
 				communication: frm.doc.name
 			},
@@ -48,7 +48,7 @@
 
 	make_issue_from_communication: (frm) => {
 		return frappe.call({
-			method: "frappe.email.inbox.make_issue_from_communication",
+			method: "erpnext.support.doctype.issue.issue.make_issue_from_communication",
 			args: {
 				communication: frm.doc.name
 			},
@@ -63,7 +63,7 @@
 
 	make_opportunity_from_communication: (frm) => {
 		return frappe.call({
-			method: "frappe.email.inbox.make_opportunity_from_communication",
+			method: "erpnext.crm.doctype.opportunity.opportunity.make_opportunity_from_communication",
 			args: {
 				communication: frm.doc.name
 			},
diff --git a/erpnext/public/js/templates/address_list.html b/erpnext/public/js/templates/address_list.html
index 0bc86ed..2379ef6 100644
--- a/erpnext/public/js/templates/address_list.html
+++ b/erpnext/public/js/templates/address_list.html
@@ -9,7 +9,7 @@
             <span class="text-muted">({%= __("Shipping") %})</span>{% } %}
 
         <a href="#Form/Address/{%= encodeURIComponent(addr_list[i].name) %}"
-            class="btn btn-light btn-xs pull-right"
+            class="btn btn-default btn-xs pull-right"
 				style="margin-top:-3px; margin-right: -5px;">
             {%= __("Edit") %}</a>
     </p>
@@ -19,5 +19,5 @@
 {% if(!addr_list.length) { %}
 <p class="text-muted small">{%= __("No address added yet.") %}</p>
 {% } %}
-<p><button class="btn btn-xs btn-light btn-address">{{ __("New Address") }}</button></p>
+<p><button class="btn btn-xs btn-default btn-address">{{ __("New Address") }}</button></p>
 
diff --git a/erpnext/public/js/templates/contact_list.html b/erpnext/public/js/templates/contact_list.html
index 2144893..893b4e0 100644
--- a/erpnext/public/js/templates/contact_list.html
+++ b/erpnext/public/js/templates/contact_list.html
@@ -10,7 +10,7 @@
 			 <span class="text-muted">&ndash; {%= contact_list[i].designation %}</span>
 			{% } %}
 			<a href="#Form/Contact/{%= encodeURIComponent(contact_list[i].name) %}"
-				class="btn btn-xs btn-light pull-right"
+				class="btn btn-xs btn-default pull-right"
 				style="margin-top:-3px; margin-right: -5px;">
 				{%= __("Edit") %}</a>
 		</p>
@@ -33,6 +33,6 @@
 {% if(!contact_list.length) { %}
 <p class="text-muted small">{%= __("No contacts added yet.") %}</p>
 {% } %}
-<p><button class="btn btn-xs btn-light btn-contact">
+<p><button class="btn btn-xs btn-default btn-contact">
 	{{ __("New Contact") }}</button>
 </p>
\ No newline at end of file
diff --git a/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py b/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py
index a9aa1d5..7faabf4 100644
--- a/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py
+++ b/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py
@@ -227,12 +227,18 @@
 
 		for d in inter_state_supply.get("Unregistered", []):
 			self.report_dict["inter_sup"]["unreg_details"].append(d)
+			self.report_dict["sup_details"]["osup_det"]["txval"] += d["txval"]
+			self.report_dict["sup_details"]["osup_det"]["iamt"] += d["iamt"]
 
 		for d in inter_state_supply.get("Registered Composition", []):
 			self.report_dict["inter_sup"]["comp_details"].append(d)
+			self.report_dict["sup_details"]["osup_det"]["txval"] += d["txval"]
+			self.report_dict["sup_details"]["osup_det"]["iamt"] += d["iamt"]
 
 		for d in inter_state_supply.get("UIN Holders", []):
 			self.report_dict["inter_sup"]["uin_details"].append(d)
+			self.report_dict["sup_details"]["osup_det"]["txval"] += d["txval"]
+			self.report_dict["sup_details"]["osup_det"]["iamt"] += d["iamt"]
 
 	def get_total_taxable_value(self, doctype, reverse_charge):
 
@@ -296,7 +302,7 @@
 
 			inter_state_supply_details[d.gst_category].append({
 				"pos": get_state_code(d.gst_state),
-				"txval": d.total,
+				"txval": d.total - d.tax_amount,
 				"iamt": d.tax_amount
 			})
 
diff --git a/erpnext/regional/doctype/gstr_3b_report/test_gstr_3b_report.py b/erpnext/regional/doctype/gstr_3b_report/test_gstr_3b_report.py
index d50eaeb..4667107 100644
--- a/erpnext/regional/doctype/gstr_3b_report/test_gstr_3b_report.py
+++ b/erpnext/regional/doctype/gstr_3b_report/test_gstr_3b_report.py
@@ -57,7 +57,7 @@
 
 		output = json.loads(report.json_output)
 
-		self.assertEqual(output["sup_details"]["osup_det"]["iamt"], 18),
+		self.assertEqual(output["sup_details"]["osup_det"]["iamt"], 36),
 		self.assertEqual(output["sup_details"]["osup_zero"]["iamt"], 18),
 		self.assertEqual(output["inter_sup"]["unreg_details"][0]["iamt"], 18),
 		self.assertEqual(output["sup_details"]["osup_nil_exmp"]["txval"], 100),
diff --git a/erpnext/regional/report/irs_1099/irs_1099.py b/erpnext/regional/report/irs_1099/irs_1099.py
index 0cb4a3a..67834d1 100644
--- a/erpnext/regional/report/irs_1099/irs_1099.py
+++ b/erpnext/regional/report/irs_1099/irs_1099.py
@@ -97,9 +97,7 @@
 		row["recipient_street_address"], row["recipient_city_state"] = get_street_address_html("Supplier", row.supplier)
 		row["payments"] = fmt_money(row["payments"], precision=0, currency="USD")
 		frappe._dict(row)
-		print(row)
 		pdf = get_pdf(render_template(template, row), output=output if output else None)
-		print(pdf)
 	frappe.local.response.filename = filters.fiscal_year + " " + filters.company + " IRS 1099 Forms"
 	frappe.local.response.filecontent = read_multi_pdf(output)
 	frappe.local.response.type = "download"
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index cd69dd4..b8c4604 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -412,7 +412,6 @@
 @frappe.whitelist()
 def make_sales_invoice(source_name, target_doc=None):
 	doc = frappe.get_doc('Delivery Note', source_name)
-	sales_orders = [d.against_sales_order for d in doc.items]
 	returned_qty_map = get_returned_qty_map(source_name)
 	invoiced_qty_map = get_invoiced_qty_map(source_name)
 
@@ -452,7 +451,7 @@
 				returned_qty = 0
 		return pending_qty, returned_qty
 
-	doc = get_mapped_doc("Delivery Note", source_name, 	{
+	doc = get_mapped_doc("Delivery Note", source_name, {
 		"Delivery Note": {
 			"doctype": "Sales Invoice",
 			"validation": {
@@ -470,7 +469,7 @@
 				"cost_center": "cost_center"
 			},
 			"postprocess": update_item,
-			"filter": lambda d: get_pending_qty(d)[0]<=0
+			"filter": lambda d: get_pending_qty(d)[0] <= 0 if not doc.get("is_return") else get_pending_qty(d)[0] > 0
 		},
 		"Sales Taxes and Charges": {
 			"doctype": "Sales Taxes and Charges",
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index aa51f47..ed02cee 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -90,8 +90,6 @@
 			self.set_opening_stock()
 
 	def validate(self):
-		self.get_doc_before_save()
-
 		super(Item, self).validate()
 
 		if not self.item_name:
@@ -1062,3 +1060,7 @@
 		count+=1
 		if publish_progress:
 				frappe.publish_progress(count*100/len(variants), title = _("Updating Variants..."))
+
+def on_doctype_update():
+	# since route is a Text column, it needs a length for indexing
+	frappe.db.add_index("Item", ["route(500)"])
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 71cf1da..6953279 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -457,7 +457,7 @@
 				"asset": "asset",
 			},
 			"postprocess": update_item,
-			"filter": lambda d: get_pending_qty(d)[0]<=0
+			"filter": lambda d: get_pending_qty(d)[0] <= 0 if not doc.get("is_return") else get_pending_qty(d)[0] > 0
 		},
 		"Purchase Taxes and Charges": {
 			"doctype": "Purchase Taxes and Charges",
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index da2d09f..a6af4bd 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -35,7 +35,7 @@
 
 class StockEntry(StockController):
 	def get_feed(self):
-		return _("From {0} to {1}").format(self.from_warehouse, self.to_warehouse)
+		return self.stock_entry_type
 
 	def onload(self):
 		for item in self.get("items"):
diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py
index 20b5e45..70da5b5 100644
--- a/erpnext/stock/report/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/report/stock_ledger/stock_ledger.py
@@ -154,10 +154,10 @@
 		"posting_date": filters.from_date,
 		"posting_time": "00:00:00"
 	})
-	row = [""]*len(columns)
-	row[1] = _("'Opening'")
-	for i, v in ((9, 'qty_after_transaction'), (11, 'valuation_rate'), (12, 'stock_value')):
-			row[i] = last_entry.get(v, 0)
+	row = {}
+	row["item_code"] = _("'Opening'")
+	for dummy, v in ((9, 'qty_after_transaction'), (11, 'valuation_rate'), (12, 'stock_value')):
+			row[v] = last_entry.get(v, 0)
 
 	return row
 
diff --git a/erpnext/support/doctype/issue/issue.json b/erpnext/support/doctype/issue/issue.json
index 3a1c5ef..91b718e 100644
--- a/erpnext/support/doctype/issue/issue.json
+++ b/erpnext/support/doctype/issue/issue.json
@@ -1,1309 +1,1309 @@
 {
- "allow_copy": 0,
- "allow_events_in_timeline": 0,
- "allow_guest_to_view": 0,
- "allow_import": 1,
- "allow_rename": 1,
- "autoname": "naming_series:",
- "beta": 0,
- "creation": "2013-02-01 10:36:25",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "Setup",
- "editable_grid": 0,
- "engine": "InnoDB",
+ "allow_copy": 0, 
+ "allow_events_in_timeline": 0, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "naming_series:", 
+ "beta": 0, 
+ "creation": "2013-02-01 10:36:25", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Setup", 
+ "editable_grid": 0, 
+ "engine": "InnoDB", 
  "fields": [
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "subject_section",
-   "fieldtype": "Section Break",
-   "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": "Subject",
-   "length": 0,
-   "no_copy": 0,
-   "options": "fa fa-flag",
-   "permlevel": 0,
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "subject_section", 
+   "fieldtype": "Section Break", 
+   "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": "Subject", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "fa fa-flag", 
+   "permlevel": 0, 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "",
-   "fetch_if_empty": 0,
-   "fieldname": "naming_series",
-   "fieldtype": "Select",
-   "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": "Series",
-   "length": 0,
-   "no_copy": 1,
-   "options": "ISS-.YYYY.-",
-   "permlevel": 0,
-   "print_hide": 1,
-   "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": 1,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "", 
+   "fetch_if_empty": 0, 
+   "fieldname": "naming_series", 
+   "fieldtype": "Select", 
+   "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": "Series", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "ISS-.YYYY.-", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "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": 1, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 1,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "subject",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 1,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Subject",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "subject", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 1, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Subject", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "issue_type",
-   "fieldtype": "Link",
-   "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": "Issue Type",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Issue Type",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "customer", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 1, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Customer", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "customer", 
+   "oldfieldtype": "Link", 
+   "options": "Customer", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "customer",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 1,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Customer",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "customer",
-   "oldfieldtype": "Link",
-   "options": "Customer",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.__islocal", 
+   "fetch_if_empty": 0, 
+   "fieldname": "raised_by", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 1, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Raised By (Email)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "raised_by", 
+   "oldfieldtype": "Data", 
+   "options": "Email", 
+   "permlevel": 0, 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "cb00",
-   "fieldtype": "Column Break",
-   "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,
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "cb00", 
+   "fieldtype": "Column Break", 
+   "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, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "Open",
-   "fetch_if_empty": 0,
-   "fieldname": "status",
-   "fieldtype": "Select",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 1,
-   "in_standard_filter": 1,
-   "label": "Status",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "status",
-   "oldfieldtype": "Select",
-   "options": "Open\nReplied\nHold\nClosed",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Open", 
+   "fetch_if_empty": 0, 
+   "fieldname": "status", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 1, 
+   "label": "Status", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "status", 
+   "oldfieldtype": "Select", 
+   "options": "Open\nReplied\nHold\nClosed", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "Medium",
-   "depends_on": "",
-   "fetch_if_empty": 0,
-   "fieldname": "priority",
-   "fieldtype": "Select",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 1,
-   "label": "Priority",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Low\nMedium\nHigh",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Medium", 
+   "depends_on": "", 
+   "fetch_if_empty": 0, 
+   "fieldname": "priority", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 1, 
+   "label": "Priority", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Low\nMedium\nHigh", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 1,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval:doc.__islocal",
-   "fetch_if_empty": 0,
-   "fieldname": "raised_by",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 1,
-   "in_list_view": 1,
-   "in_standard_filter": 0,
-   "label": "Raised By (Email)",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "raised_by",
-   "oldfieldtype": "Data",
-   "options": "Email",
-   "permlevel": 0,
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "issue_type", 
+   "fieldtype": "Link", 
+   "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": "Issue Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Issue Type", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "email_account",
-   "fieldtype": "Link",
-   "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": "Email Account",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Email Account",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "collapsible_depends_on": "eval:doc.status!=\"Closed\"", 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "sb_details", 
+   "fieldtype": "Section Break", 
+   "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": "Details", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "collapsible_depends_on": "eval:doc.status!=\"Closed\"",
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "sb_details",
-   "fieldtype": "Section Break",
-   "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": "Details",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fetch_if_empty": 0, 
+   "fieldname": "description", 
+   "fieldtype": "Text Editor", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 1, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "problem_description", 
+   "oldfieldtype": "Text", 
+   "permlevel": 0, 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 1,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fetch_if_empty": 0,
-   "fieldname": "description",
-   "fieldtype": "Text Editor",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 1,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Description",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "problem_description",
-   "oldfieldtype": "Text",
-   "permlevel": 0,
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "depends_on": "eval: doc.service_level_agreement", 
+   "fetch_if_empty": 0, 
+   "fieldname": "service_level_section", 
+   "fieldtype": "Section Break", 
+   "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": "Service Level", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "depends_on": "eval: doc.service_level_agreement",
-   "fetch_if_empty": 0,
-   "fieldname": "service_level_section",
-   "fieldtype": "Section Break",
-   "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": "Service Level",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "service_level_agreement", 
+   "fieldtype": "Link", 
+   "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": "Service Level Agreement", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Service Level Agreement", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "service_level_agreement",
-   "fieldtype": "Link",
-   "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": "Service Level Agreement",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Service Level Agreement",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "response_by", 
+   "fieldtype": "Datetime", 
+   "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": "Response By", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "response_by",
-   "fieldtype": "Datetime",
-   "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": "Response By",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "cb", 
+   "fieldtype": "Column Break", 
+   "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": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "fa fa-pushpin", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "cb",
-   "fieldtype": "Column Break",
-   "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": "",
-   "length": 0,
-   "no_copy": 0,
-   "options": "fa fa-pushpin",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Ongoing", 
+   "fetch_if_empty": 0, 
+   "fieldname": "agreement_status", 
+   "fieldtype": "Select", 
+   "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": "Agreement Status", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Ongoing\nFulfilled\nFailed", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "Ongoing",
-   "fetch_if_empty": 0,
-   "fieldname": "agreement_status",
-   "fieldtype": "Select",
-   "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": "Agreement Status",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Ongoing\nFulfilled\nFailed",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "resolution_by", 
+   "fieldtype": "Datetime", 
+   "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": "Resolution By", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "resolution_by",
-   "fieldtype": "Datetime",
-   "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": "Resolution By",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "response", 
+   "fieldtype": "Section Break", 
+   "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": "Response", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "response",
-   "fieldtype": "Section Break",
-   "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": "Response",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "mins_to_first_response", 
+   "fieldtype": "Float", 
+   "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": "Mins to First Response", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 1,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "mins_to_first_response",
-   "fieldtype": "Float",
-   "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": "Mins to First Response",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "first_responded_on", 
+   "fieldtype": "Datetime", 
+   "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": "First Responded On", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "first_responded_on",
-   "fieldtype": "Datetime",
-   "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": "First Responded On",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "additional_info", 
+   "fieldtype": "Section Break", 
+   "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": "Reference", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "fa fa-pushpin", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "additional_info",
-   "fieldtype": "Section Break",
-   "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": "Reference",
-   "length": 0,
-   "no_copy": 0,
-   "options": "fa fa-pushpin",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "lead", 
+   "fieldtype": "Link", 
+   "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": "Lead", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Lead", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "lead",
-   "fieldtype": "Link",
-   "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": "Lead",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Lead",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "contact", 
+   "fieldtype": "Link", 
+   "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": "Contact", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Contact", 
+   "permlevel": 0, 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "contact",
-   "fieldtype": "Link",
-   "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": "Contact",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Contact",
-   "permlevel": 0,
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "email_account", 
+   "fieldtype": "Link", 
+   "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": "Email Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Email Account", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "column_break_16",
-   "fieldtype": "Column Break",
-   "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,
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "column_break_16", 
+   "fieldtype": "Column Break", 
+   "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, 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 1,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "customer_name",
-   "fieldtype": "Data",
-   "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": "Customer Name",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "customer_name",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "customer_name", 
+   "fieldtype": "Data", 
+   "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": "Customer Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "customer_name", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "project",
-   "fieldtype": "Link",
-   "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": "Project",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Project",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "project", 
+   "fieldtype": "Link", 
+   "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": "Project", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Project", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "company",
-   "fieldtype": "Link",
-   "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": "Company",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Company",
-   "permlevel": 0,
-   "print_hide": 1,
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "company", 
+   "fieldtype": "Link", 
+   "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": "Company", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "section_break_19",
-   "fieldtype": "Section Break",
-   "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": "Resolution",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "section_break_19", 
+   "fieldtype": "Section Break", 
+   "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": "Resolution", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval:!doc.__islocal",
-   "fetch_if_empty": 0,
-   "fieldname": "resolution_details",
-   "fieldtype": "Text Editor",
-   "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": "Resolution Details",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "resolution_details",
-   "oldfieldtype": "Text",
-   "permlevel": 0,
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:!doc.__islocal", 
+   "fetch_if_empty": 0, 
+   "fieldname": "resolution_details", 
+   "fieldtype": "Text Editor", 
+   "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": "Resolution Details", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "resolution_details", 
+   "oldfieldtype": "Text", 
+   "permlevel": 0, 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval:!doc.__islocal",
-   "fetch_if_empty": 0,
-   "fieldname": "column_break1",
-   "fieldtype": "Column Break",
-   "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,
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Column Break",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:!doc.__islocal", 
+   "fetch_if_empty": 0, 
+   "fieldname": "column_break1", 
+   "fieldtype": "Column Break", 
+   "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, 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Column Break", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "Today",
-   "fetch_if_empty": 0,
-   "fieldname": "opening_date",
-   "fieldtype": "Date",
-   "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": "Opening Date",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "opening_date",
-   "oldfieldtype": "Date",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Today", 
+   "fetch_if_empty": 0, 
+   "fieldname": "opening_date", 
+   "fieldtype": "Date", 
+   "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": "Opening Date", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "opening_date", 
+   "oldfieldtype": "Date", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "opening_time",
-   "fieldtype": "Time",
-   "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": "Opening Time",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "opening_time",
-   "oldfieldtype": "Time",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "opening_time", 
+   "fieldtype": "Time", 
+   "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": "Opening Time", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "opening_time", 
+   "oldfieldtype": "Time", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval:!doc.__islocal",
-   "fetch_if_empty": 0,
-   "fieldname": "resolution_date",
-   "fieldtype": "Datetime",
-   "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": "Resolution Date",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "resolution_date",
-   "oldfieldtype": "Date",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:!doc.__islocal", 
+   "fetch_if_empty": 0, 
+   "fieldname": "resolution_date", 
+   "fieldtype": "Datetime", 
+   "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": "Resolution Date", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "resolution_date", 
+   "oldfieldtype": "Date", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "content_type",
-   "fieldtype": "Data",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Content Type",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "content_type", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Content Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "attachment",
-   "fieldtype": "Attach",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Attachment",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "attachment", 
+   "fieldtype": "Attach", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Attachment", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
-   "fieldname": "via_customer_portal",
-   "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": "Via Customer Portal",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fetch_if_empty": 0, 
+   "fieldname": "via_customer_portal", 
+   "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": "Via Customer Portal", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
   }
- ],
- "has_web_view": 0,
- "hide_toolbar": 0,
- "icon": "fa fa-ticket",
- "idx": 7,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 0,
- "max_attachments": 0,
- "modified": "2019-04-04 10:55:40.222692",
+ ], 
+ "has_web_view": 0, 
+ "hide_toolbar": 0, 
+ "icon": "fa fa-ticket", 
+ "idx": 7, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2019-04-23 18:04:42.039620", 
  "modified_by": "Administrator",
- "module": "Support",
- "name": "Issue",
- "owner": "Administrator",
+ "module": "Support", 
+ "name": "Issue", 
+ "owner": "Administrator", 
  "permissions": [
   {
-   "amend": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 1,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Support Team",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Support Team", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
   }
- ],
- "quick_entry": 1,
- "read_only": 0,
- "search_fields": "status,customer,subject,raised_by",
- "show_name_in_global_search": 0,
- "sort_order": "ASC",
- "timeline_field": "customer",
- "title_field": "subject",
- "track_changes": 0,
- "track_seen": 1,
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "search_fields": "status,customer,subject,raised_by", 
+ "show_name_in_global_search": 0, 
+ "sort_order": "ASC", 
+ "timeline_field": "customer", 
+ "title_field": "subject", 
+ "track_changes": 0, 
+ "track_seen": 1, 
  "track_views": 0
 }
\ No newline at end of file
diff --git a/erpnext/support/doctype/issue/issue.py b/erpnext/support/doctype/issue/issue.py
index 01677ae..d626def 100644
--- a/erpnext/support/doctype/issue/issue.py
+++ b/erpnext/support/doctype/issue/issue.py
@@ -13,6 +13,7 @@
 from frappe.utils.user import is_website_user
 from ..service_level_agreement.service_level_agreement import get_active_service_level_agreement_for
 from erpnext.crm.doctype.opportunity.opportunity import assign_to_user
+from frappe.email.inbox import link_communication_to_document
 
 sender_field = "raised_by"
 
@@ -294,3 +295,19 @@
 			"doctype": "Task"
 		}
 	}, target_doc)
+@frappe.whitelist()
+def make_issue_from_communication(communication, ignore_communication_links=False):
+	""" raise a issue from email """
+
+	doc = frappe.get_doc("Communication", communication)
+	issue = frappe.get_doc({
+		"doctype": "Issue",
+		"subject": doc.subject,
+		"communication_medium": doc.communication_medium,
+		"raised_by": doc.sender or "",
+		"raised_by_phone": doc.phone_no or ""
+	}).insert(ignore_permissions=True)
+
+	link_communication_to_document(doc, "Issue", issue.name, ignore_communication_links)
+
+	return issue.name