Merge branch 'develop' into feat-bom-process-loss-fp
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index e7fa354..566323a 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -13,3 +13,6 @@
 
 # This commit just changes spaces to tabs for indentation in some files
 5f473611bd6ed57703716244a054d3fb5ba9cd23
+
+# Whitespace fix throughout codebase
+4551d7d6029b6f587f6c99d4f8df5519241c6a86
diff --git a/erpnext/.stylelintrc b/erpnext/.stylelintrc
index 1e05d1f..30075f1 100644
--- a/erpnext/.stylelintrc
+++ b/erpnext/.stylelintrc
@@ -6,4 +6,4 @@
 		"scss/at-rule-no-unknown": true,
 		"no-descending-specificity": null
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.js b/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.js
index e12eae9..d8a83e5 100644
--- a/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.js
+++ b/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.js
@@ -19,4 +19,4 @@
 			reqd: 1
 		},
 	]
-};
\ No newline at end of file
+};
diff --git a/erpnext/accounts/deferred_revenue.py b/erpnext/accounts/deferred_revenue.py
index 335e8a1..0c81d83 100644
--- a/erpnext/accounts/deferred_revenue.py
+++ b/erpnext/accounts/deferred_revenue.py
@@ -450,5 +450,3 @@
 		return debit_account
 	else:
 		return credit_account
-
-
diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js
index 65c5ff1..2fa1d53 100644
--- a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js
+++ b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js
@@ -60,4 +60,4 @@
 		let row = locals[cdt][cdn];
 		row.reference_document = frm.doc.document_type;
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py
index e657a9a..4f3ee76 100644
--- a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py
+++ b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py
@@ -113,5 +113,3 @@
 	dimension2 = frappe.get_doc("Accounting Dimension", "Location")
 	dimension2.disabled = 1
 	dimension2.save()
-
-
diff --git a/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.js b/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.js
index 74b7b51..9dd882a 100644
--- a/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.js
+++ b/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.js
@@ -79,4 +79,4 @@
 		row.accounting_dimension = frm.doc.accounting_dimension;
 		frm.refresh_field("dimensions");
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/accounting_period/accounting_period.py b/erpnext/accounts/doctype/accounting_period/accounting_period.py
index 63b5dbb..739d8f6 100644
--- a/erpnext/accounts/doctype/accounting_period/accounting_period.py
+++ b/erpnext/accounts/doctype/accounting_period/accounting_period.py
@@ -56,4 +56,4 @@
 				self.append('closed_documents', {
 					"document_type": doctype_for_closing.document_type,
 					"closed": doctype_for_closing.closed
-				})
\ No newline at end of file
+				})
diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.js b/erpnext/accounts/doctype/accounts_settings/accounts_settings.js
index 541901c..e44af3a 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.js
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.js
@@ -48,4 +48,4 @@
 		title: "Unlink Advance Payment on Cancellation of Order",
 		description: __("Similar to the previous option, this unlinks any advance payments made against Purchase/Sales Orders.")
 	}
-];
\ No newline at end of file
+];
diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
index 5544913..62c97f2 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
@@ -37,7 +37,7 @@
 
 	def toggle_discount_accounting_fields(self):
 		enable_discount_accounting = cint(self.enable_discount_accounting)
-		
+
 		for doctype in ["Sales Invoice Item", "Purchase Invoice Item"]:
 			make_property_setter(doctype, "discount_account", "hidden", not(enable_discount_accounting), "Check", validate_fields_for_doctype=False)
 			if enable_discount_accounting:
@@ -52,4 +52,4 @@
 			else:
 				make_property_setter(doctype, "additional_discount_account", "mandatory_depends_on", "", "Code", validate_fields_for_doctype=False)
 
-		make_property_setter("Item", "default_discount_account", "hidden", not(enable_discount_accounting), "Check", validate_fields_for_doctype=False)
\ No newline at end of file
+		make_property_setter("Item", "default_discount_account", "hidden", not(enable_discount_accounting), "Check", validate_fields_for_doctype=False)
diff --git a/erpnext/accounts/doctype/accounts_settings/regional/united_states.js b/erpnext/accounts/doctype/accounts_settings/regional/united_states.js
index d47d6e5..3e38386 100644
--- a/erpnext/accounts/doctype/accounts_settings/regional/united_states.js
+++ b/erpnext/accounts/doctype/accounts_settings/regional/united_states.js
@@ -5,4 +5,4 @@
 		frm.set_df_property("frozen_accounts_modifier", "label", "Role Allowed to Close Books & Make Changes to Closed Periods");
 		frm.set_df_property("credit_controller", "label", "Credit Manager");
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/bank/bank.js b/erpnext/accounts/doctype/bank/bank.js
index 19041a3..059e1d3 100644
--- a/erpnext/accounts/doctype/bank/bank.js
+++ b/erpnext/accounts/doctype/bank/bank.js
@@ -120,4 +120,4 @@
 	plaid_success(token, response) {
 		frappe.show_alert({ message: __('Plaid Link Updated'), indicator: 'green' });
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/accounts/doctype/bank/bank.py b/erpnext/accounts/doctype/bank/bank.py
index 41aae14..99fa21c 100644
--- a/erpnext/accounts/doctype/bank/bank.py
+++ b/erpnext/accounts/doctype/bank/bank.py
@@ -13,4 +13,4 @@
 		load_address_and_contact(self)
 
 	def on_trash(self):
-		delete_contact_and_address('Bank', self.name)
\ No newline at end of file
+		delete_contact_and_address('Bank', self.name)
diff --git a/erpnext/accounts/doctype/bank_account/bank_account_dashboard.py b/erpnext/accounts/doctype/bank_account/bank_account_dashboard.py
index a959cea..c7ea152 100644
--- a/erpnext/accounts/doctype/bank_account/bank_account_dashboard.py
+++ b/erpnext/accounts/doctype/bank_account/bank_account_dashboard.py
@@ -26,4 +26,4 @@
 				'items': ['Journal Entry']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/accounts/doctype/bank_clearance/bank_clearance.js b/erpnext/accounts/doctype/bank_clearance/bank_clearance.js
index ba3f2fa..63cc465 100644
--- a/erpnext/accounts/doctype/bank_clearance/bank_clearance.js
+++ b/erpnext/accounts/doctype/bank_clearance/bank_clearance.js
@@ -8,7 +8,7 @@
 
 	onload: function(frm) {
 
-		let default_bank_account =  frappe.defaults.get_user_default("Company")? 
+		let default_bank_account =  frappe.defaults.get_user_default("Company")?
 			locals[":Company"][frappe.defaults.get_user_default("Company")]["default_bank_account"]: "";
 		frm.set_value("account", default_bank_account);
 
diff --git a/erpnext/accounts/doctype/bank_clearance_detail/bank_clearance_detail.py b/erpnext/accounts/doctype/bank_clearance_detail/bank_clearance_detail.py
index ecc5367..59299f8 100644
--- a/erpnext/accounts/doctype/bank_clearance_detail/bank_clearance_detail.py
+++ b/erpnext/accounts/doctype/bank_clearance_detail/bank_clearance_detail.py
@@ -6,4 +6,4 @@
 from frappe.model.document import Document
 
 class BankClearanceDetail(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
index 88e1055..a0aac6a 100644
--- a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
+++ b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
@@ -25,6 +25,6 @@
 def get_vouchar_detials(column_list, doctype, docname):
 	column_list = json.loads(column_list)
 	for col in column_list:
-		sanitize_searchfield(col) 
+		sanitize_searchfield(col)
 	return frappe.db.sql(''' select {columns} from `tab{doctype}` where name=%s'''
 		.format(columns=", ".join(column_list), doctype=doctype), docname, as_dict=1)[0]
diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py
index 5246baa..31cfb2d 100644
--- a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py
+++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py
@@ -105,4 +105,3 @@
 			frappe.db.set_value(doc.payment_document, doc.payment_entry, "clearance_date", None)
 
 		return doc.payment_entry
-
diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction_list.js b/erpnext/accounts/doctype/bank_transaction/bank_transaction_list.js
index 2ecc2b0..bff41d5 100644
--- a/erpnext/accounts/doctype/bank_transaction/bank_transaction_list.js
+++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction_list.js
@@ -10,4 +10,4 @@
 			return [__("Reconciled"), "green", "unallocated_amount,=,0"];
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py b/erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py
index 33ae454..dc3b867 100644
--- a/erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py
+++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py
@@ -77,4 +77,4 @@
 
 	mapping = {row.file_field:row.bank_transaction_field for row in bank.bank_transaction_mapping}
 
-	return mapping
\ No newline at end of file
+	return mapping
diff --git a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py
index ee5098b..20e423a 100644
--- a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py
+++ b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py
@@ -6,4 +6,4 @@
 from frappe.model.document import Document
 
 class CFormInvoiceDetail(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/accounts/doctype/cash_flow_mapping/cash_flow_mapping.py b/erpnext/accounts/doctype/cash_flow_mapping/cash_flow_mapping.py
index 28d84b4..b1ad297 100644
--- a/erpnext/accounts/doctype/cash_flow_mapping/cash_flow_mapping.py
+++ b/erpnext/accounts/doctype/cash_flow_mapping/cash_flow_mapping.py
@@ -18,5 +18,3 @@
 				frappe._('You can only select a maximum of one option from the list of check boxes.'),
 				title='Error'
 			)
-
-
diff --git a/erpnext/accounts/doctype/cashier_closing/cashier_closing.py b/erpnext/accounts/doctype/cashier_closing/cashier_closing.py
index 7ad1d3a..081c6fa 100644
--- a/erpnext/accounts/doctype/cashier_closing/cashier_closing.py
+++ b/erpnext/accounts/doctype/cashier_closing/cashier_closing.py
@@ -33,4 +33,4 @@
 
 	def validate_time(self):
 		if self.from_time >= self.time:
-			frappe.throw(_("From Time Should Be Less Than To Time"))
\ No newline at end of file
+			frappe.throw(_("From Time Should Be Less Than To Time"))
diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.js b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.js
index 6a430eb..d10c618 100644
--- a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.js
+++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.js
@@ -10,10 +10,10 @@
 				function() {
 					erpnext.cheque_print.view_cheque_print(frm);
 				}).addClass("btn-primary");
-				
+
 			$(frm.fields_dict.cheque_print_preview.wrapper).empty()
-				
-				
+
+
 			var template = '<div style="position: relative; overflow-x: scroll;">\
 				<div id="cheque_preview" style="width: {{ cheque_width }}cm; \
 					height: {{ cheque_height }}cm;\
@@ -47,9 +47,9 @@
 						position: absolute;"> Signatory Name </span>\
 				</div>\
 			</div>';
-			
+
 			$(frappe.render(template, frm.doc)).appendTo(frm.fields_dict.cheque_print_preview.wrapper)
-			
+
 			if (frm.doc.scanned_cheque) {
 				$(frm.fields_dict.cheque_print_preview.wrapper).find("#cheque_preview").css('background-image', 'url(' + frm.doc.scanned_cheque + ')');
 			}
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py
index 8a5473f..981fec3 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.py
+++ b/erpnext/accounts/doctype/cost_center/cost_center.py
@@ -129,4 +129,4 @@
 
 def check_if_distributed_cost_center_enabled(cost_center_list):
 	value_list = frappe.get_list("Cost Center", {"name": ["in", cost_center_list]}, "enable_distributed_cost_center", as_list=1)
-	return next((True for x in value_list if x[0]), False)
\ No newline at end of file
+	return next((True for x in value_list if x[0]), False)
diff --git a/erpnext/accounts/doctype/cost_center/cost_center_dashboard.py b/erpnext/accounts/doctype/cost_center/cost_center_dashboard.py
index 788ac8b..24cf3ea 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center_dashboard.py
+++ b/erpnext/accounts/doctype/cost_center/cost_center_dashboard.py
@@ -12,4 +12,4 @@
 				'items': ['Budget Variance Report', 'General Ledger']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/accounts/doctype/cost_center/cost_center_tree.js b/erpnext/accounts/doctype/cost_center/cost_center_tree.js
index fde4123..1d482c5 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center_tree.js
+++ b/erpnext/accounts/doctype/cost_center/cost_center_tree.js
@@ -51,4 +51,4 @@
 
 	}
 
-}
\ No newline at end of file
+}
diff --git a/erpnext/accounts/doctype/cost_center/test_cost_center.py b/erpnext/accounts/doctype/cost_center/test_cost_center.py
index b5fc7e3..7779cce 100644
--- a/erpnext/accounts/doctype/cost_center/test_cost_center.py
+++ b/erpnext/accounts/doctype/cost_center/test_cost_center.py
@@ -62,6 +62,3 @@
 			cc.is_group = args.is_group or 0
 			cc.parent_cost_center = args.parent_cost_center or "_Test Company - _TC"
 			cc.insert()
-
-
-
diff --git a/erpnext/accounts/doctype/coupon_code/coupon_code.py b/erpnext/accounts/doctype/coupon_code/coupon_code.py
index 55c1193..92a816d 100644
--- a/erpnext/accounts/doctype/coupon_code/coupon_code.py
+++ b/erpnext/accounts/doctype/coupon_code/coupon_code.py
@@ -17,7 +17,7 @@
 				self.coupon_code =''.join(i for i in self.coupon_name if not i.isdigit())[0:8].upper()
 			elif self.coupon_type == "Gift Card":
 				self.coupon_code = frappe.generate_hash()[:10].upper()
-		
+
 	def validate(self):
 		if self.coupon_type == "Gift Card":
 			self.maximum_use = 1
diff --git a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py
index 5af12cd..06987a8 100644
--- a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py
+++ b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py
@@ -124,6 +124,3 @@
 
 		so.submit()
 		self.assertEqual(frappe.db.get_value("Coupon Code", "SAVE30", "used"), 1)
-
-
-
diff --git a/erpnext/accounts/doctype/discounted_invoice/discounted_invoice.py b/erpnext/accounts/doctype/discounted_invoice/discounted_invoice.py
index 109737f..93dfcc1 100644
--- a/erpnext/accounts/doctype/discounted_invoice/discounted_invoice.py
+++ b/erpnext/accounts/doctype/discounted_invoice/discounted_invoice.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class DiscountedInvoice(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/accounts/doctype/dunning/dunning_dashboard.py b/erpnext/accounts/doctype/dunning/dunning_dashboard.py
index 19a73dd..33c6ab0 100644
--- a/erpnext/accounts/doctype/dunning/dunning_dashboard.py
+++ b/erpnext/accounts/doctype/dunning/dunning_dashboard.py
@@ -14,4 +14,4 @@
 				'items': ['Payment Entry', 'Journal Entry']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/accounts/doctype/dunning/test_dunning.py b/erpnext/accounts/doctype/dunning/test_dunning.py
index 7fc2e4b..67692ec 100644
--- a/erpnext/accounts/doctype/dunning/test_dunning.py
+++ b/erpnext/accounts/doctype/dunning/test_dunning.py
@@ -143,4 +143,4 @@
 			'closing_text': 'We kindly request that you pay the outstanding amount immediately, and late fees.'
 		}
 	)
-	dunning_type.save() 
+	dunning_type.save()
diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js
index b7b6020..926a442 100644
--- a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js
+++ b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js
@@ -31,7 +31,7 @@
 						}, __('Create'));
 					}
 				}
-			});			
+			});
 		}
 	},
 
@@ -128,4 +128,4 @@
 			frm.events.get_total_gain_loss(frm);
 		}
 	});
-};
\ No newline at end of file
+};
diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py
index f2b0a8c..dbbcedc 100644
--- a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py
+++ b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py
@@ -44,7 +44,7 @@
 
 		if total_amt != total_debit:
 			return True
-		
+
 		return False
 
 	@frappe.whitelist()
@@ -205,4 +205,4 @@
 			"new_balance_in_base_currency": new_balance_in_base_currency
 		}
 
-	return account_details
\ No newline at end of file
+	return account_details
diff --git a/erpnext/accounts/doctype/finance_book/test_finance_book.py b/erpnext/accounts/doctype/finance_book/test_finance_book.py
index 5027658..2ba2139 100644
--- a/erpnext/accounts/doctype/finance_book/test_finance_book.py
+++ b/erpnext/accounts/doctype/finance_book/test_finance_book.py
@@ -9,19 +9,8 @@
 import unittest
 
 class TestFinanceBook(unittest.TestCase):
-	def create_finance_book(self):
-		if not frappe.db.exists("Finance Book", "_Test Finance Book"):
-			finance_book = frappe.get_doc({
-				"doctype": "Finance Book",
-				"finance_book_name": "_Test Finance Book"
-			}).insert()
-		else:
-			finance_book = frappe.get_doc("Finance Book", "_Test Finance Book")
-
-		return finance_book
-	
 	def test_finance_book(self):
-		finance_book = self.create_finance_book()
+		finance_book = create_finance_book()
 
 		# create jv entry
 		jv = make_journal_entry("_Test Bank - _TC",
@@ -41,3 +30,14 @@
 
 		for gl_entry in gl_entries:
 			self.assertEqual(gl_entry.finance_book, finance_book.name)
+
+def create_finance_book():
+	if not frappe.db.exists("Finance Book", "_Test Finance Book"):
+		finance_book = frappe.get_doc({
+			"doctype": "Finance Book",
+			"finance_book_name": "_Test Finance Book"
+		}).insert()
+	else:
+		finance_book = frappe.get_doc("Finance Book", "_Test Finance Book")
+
+	return finance_book
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py
index 6523cd3..6d35ca2 100644
--- a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py
+++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py
@@ -17,4 +17,4 @@
 				'items': ['Payment Entry', 'Journal Entry']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_list.js b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_list.js
index a72023d..4895efc 100644
--- a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_list.js
+++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_list.js
@@ -18,4 +18,4 @@
 			return [__("Canceled"), "red", "status,=,Canceled"];
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/accounts/doctype/journal_entry/regional/india.js b/erpnext/accounts/doctype/journal_entry/regional/india.js
index 75a69ac..c5f5520 100644
--- a/erpnext/accounts/doctype/journal_entry/regional/india.js
+++ b/erpnext/accounts/doctype/journal_entry/regional/india.js
@@ -14,4 +14,4 @@
 			};
 		});
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py
index 5f003e0..5835d46 100644
--- a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py
@@ -100,7 +100,7 @@
 			"debit_in_account_currency": 0 if diff > 0 else abs(diff),
 			"credit_in_account_currency": diff if diff > 0 else 0
 		})
-		
+
 		jv.append("accounts", {
 			"account": "Stock Adjustment - TCP1",
 			"cost_center": "Main - TCP1",
diff --git a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
index cbb9fc4..1c19c1d 100644
--- a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
+++ b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
@@ -88,4 +88,4 @@
 		frappe.model.clear_table(frm.doc, "accounts");
 		frm.refresh_field("accounts");
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.js b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.js
index 7a06d35..103fa96 100644
--- a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.js
+++ b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.js
@@ -14,4 +14,4 @@
 			};
 		});
 	},
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py
index 3247369..cea921e 100644
--- a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py
+++ b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py
@@ -39,4 +39,3 @@
 				message = "POS Profile " + frappe.bold(", ".join(pos_profiles)) + " contains \
 					Mode of Payment " + frappe.bold(str(self.name)) + ". Please remove them to disable this mode."
 				frappe.throw(_(message), title="Not Allowed")
-
diff --git a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.py b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.py
index bff6422..ad8623f 100644
--- a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.py
+++ b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.py
@@ -55,4 +55,4 @@
 		if d.month in months:
 			percentage += d.percentage_allocation
 
-	return percentage
\ No newline at end of file
+	return percentage
diff --git a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py
index a679499..912bd9e 100644
--- a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py
+++ b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py
@@ -20,4 +20,4 @@
 				'items': ['Budget']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js
index a8c07d6..7eb5c42 100644
--- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js
+++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js
@@ -162,4 +162,4 @@
 	invoices_add: (frm) => {
 		frm.trigger('update_invoice_table');
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
index d76d909..9914b45 100644
--- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
+++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
@@ -241,4 +241,3 @@
 		frappe.throw(_("Please add a Temporary Opening account in Chart of Accounts"))
 
 	return accounts[0].name
-
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index 439b1ed..d96bc27 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -533,8 +533,8 @@
 	source_exchange_rate: function(frm) {
 		if (frm.doc.paid_amount) {
 			frm.set_value("base_paid_amount", flt(frm.doc.paid_amount) * flt(frm.doc.source_exchange_rate));
-			if(!frm.set_paid_amount_based_on_received_amount &&
-					(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency)) {
+			// target exchange rate should always be same as source if both account currencies is same
+			if(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency) {
 				frm.set_value("target_exchange_rate", frm.doc.source_exchange_rate);
 				frm.set_value("base_received_amount", frm.doc.base_paid_amount);
 			}
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 46904f7..abacee9 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -55,14 +55,17 @@
 		self.validate_mandatory()
 		self.validate_reference_documents()
 		self.set_tax_withholding()
-		self.apply_taxes()
 		self.set_amounts()
+		self.validate_amounts()
+		self.apply_taxes()
+		self.set_amounts_after_tax()
 		self.clear_unallocated_reference_document_rows()
 		self.validate_payment_against_negative_invoice()
 		self.validate_transaction_reference()
 		self.set_title()
 		self.set_remarks()
 		self.validate_duplicate_entry()
+		self.validate_payment_type_with_outstanding()
 		self.validate_allocated_amount()
 		self.validate_paid_invoices()
 		self.ensure_supplier_is_not_blocked()
@@ -118,6 +121,11 @@
 			if not self.get(field):
 				self.set(field, bank_data.account)
 
+	def validate_payment_type_with_outstanding(self):
+		total_outstanding = sum(d.allocated_amount for d in self.get('references'))
+		if total_outstanding < 0 and self.party_type == 'Customer' and self.payment_type == 'Receive':
+			frappe.throw(_("Cannot receive from customer against negative outstanding"), title=_("Incorrect Payment Type"))
+
 	def validate_allocated_amount(self):
 		for d in self.get("references"):
 			if (flt(d.allocated_amount))> 0:
@@ -185,7 +193,7 @@
 				for field, value in iteritems(ref_details):
 					if d.exchange_gain_loss:
 						# for cases where gain/loss is booked into invoice
-						# exchange_gain_loss is calculated from invoice & populated 
+						# exchange_gain_loss is calculated from invoice & populated
 						# and row.exchange_rate is already set to payment entry's exchange rate
 						# refer -> `update_reference_in_payment_entry()` in utils.py
 						continue
@@ -236,7 +244,9 @@
 						self.company_currency, self.posting_date)
 
 	def set_target_exchange_rate(self, ref_doc=None):
-		if self.paid_to and not self.target_exchange_rate:
+		if self.paid_from_account_currency == self.paid_to_account_currency:
+			self.target_exchange_rate = self.source_exchange_rate
+		elif self.paid_to and not self.target_exchange_rate:
 			if ref_doc:
 				if self.paid_to_account_currency == ref_doc.currency:
 					self.target_exchange_rate = ref_doc.get("exchange_rate")
@@ -417,7 +427,7 @@
 			net_total_for_tds = 0
 			if reference.reference_doctype == 'Purchase Order':
 				net_total_for_tds += flt(frappe.db.get_value('Purchase Order', reference.reference_name, 'net_total'))
-		
+
 			if net_total_for_tds:
 				net_total = net_total_for_tds
 
@@ -468,13 +478,22 @@
 	def set_amounts(self):
 		self.set_received_amount()
 		self.set_amounts_in_company_currency()
-		self.set_amounts_after_tax()
 		self.set_total_allocated_amount()
 		self.set_unallocated_amount()
 		self.set_difference_amount()
 
+	def validate_amounts(self):
+		self.validate_received_amount()
+	
+	def validate_received_amount(self):
+		if self.paid_from_account_currency == self.paid_to_account_currency:
+			if self.paid_amount != self.received_amount:
+				frappe.throw(_("Received Amount cannot be greater than Paid Amount"))
+
 	def set_received_amount(self):
 		self.base_received_amount = self.base_paid_amount
+		if self.paid_from_account_currency == self.paid_to_account_currency:
+			self.received_amount = self.paid_amount
 
 	def set_amounts_after_tax(self):
 		applicable_tax = 0
@@ -529,7 +548,7 @@
 			if self.payment_type == "Receive" \
 				and self.base_total_allocated_amount < self.base_received_amount + total_deductions \
 				and self.total_allocated_amount < self.paid_amount + (total_deductions / self.source_exchange_rate):
-				self.unallocated_amount = (self.received_amount + total_deductions -
+				self.unallocated_amount = (self.base_received_amount + total_deductions -
 					self.base_total_allocated_amount) / self.source_exchange_rate
 				self.unallocated_amount -= included_taxes
 			elif self.payment_type == "Pay" \
@@ -841,7 +860,7 @@
 
 		if account_details:
 			row.update(account_details)
-		
+
 		if not row.get('amount'):
 			# if no difference amount
 			return
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry_list.js b/erpnext/accounts/doctype/payment_entry/payment_entry_list.js
index e6d83b9..2d76fe6 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry_list.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry_list.js
@@ -11,4 +11,4 @@
 			};
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
index d1302f5..dac927b 100644
--- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
@@ -107,7 +107,7 @@
 		pe = get_payment_entry("Sales Invoice", si.name, bank_account="_Test Bank USD - _TC")
 		pe.reference_no = "1"
 		pe.reference_date = "2016-01-01"
-		pe.target_exchange_rate = 50
+		pe.source_exchange_rate = 50
 		pe.insert()
 		pe.submit()
 
@@ -154,7 +154,7 @@
 		pe = get_payment_entry("Sales Invoice", si.name, bank_account="_Test Bank USD - _TC")
 		pe.reference_no = "1"
 		pe.reference_date = "2016-01-01"
-		pe.target_exchange_rate = 50
+		pe.source_exchange_rate = 50
 		pe.insert()
 		pe.submit()
 
@@ -295,6 +295,34 @@
 		outstanding_amount = flt(frappe.db.get_value("Sales Invoice", si.name, "outstanding_amount"))
 		self.assertEqual(outstanding_amount, 80)
 
+	def test_payment_entry_against_si_usd_to_usd_with_deduction_in_base_currency (self):
+		si = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
+			currency="USD", conversion_rate=50, do_not_save=1)
+
+		si.plc_conversion_rate = 50
+		si.save()
+		si.submit()
+
+		pe = get_payment_entry("Sales Invoice", si.name, party_amount=20,
+			bank_account="_Test Bank USD - _TC", bank_amount=900)
+
+		pe.source_exchange_rate = 45.263
+		pe.target_exchange_rate = 45.263
+		pe.reference_no = "1"
+		pe.reference_date = "2016-01-01"
+
+
+		pe.append("deductions", {
+			"account": "_Test Exchange Gain/Loss - _TC",
+			"cost_center": "_Test Cost Center - _TC",
+			"amount": 94.80
+		})
+
+		pe.save()
+
+		self.assertEqual(flt(pe.difference_amount, 2), 0.0)
+		self.assertEqual(flt(pe.unallocated_amount, 2), 0.0)
+
 	def test_payment_entry_retrieves_last_exchange_rate(self):
 		from erpnext.setup.doctype.currency_exchange.test_currency_exchange import test_records, save_new_records
 
@@ -463,7 +491,7 @@
 		pe = get_payment_entry("Sales Invoice", si.name, bank_account="_Test Bank USD - _TC")
 		pe.reference_no = "1"
 		pe.reference_date = "2016-01-01"
-		pe.target_exchange_rate = 55
+		pe.source_exchange_rate = 55
 
 		pe.append("deductions", {
 			"account": "_Test Exchange Gain/Loss - _TC",
diff --git a/erpnext/accounts/doctype/payment_entry/tests/test_payment_against_purchase_invoice.js b/erpnext/accounts/doctype/payment_entry/tests/test_payment_against_purchase_invoice.js
index 14aa073..e8db2c3 100644
--- a/erpnext/accounts/doctype/payment_entry/tests/test_payment_against_purchase_invoice.js
+++ b/erpnext/accounts/doctype/payment_entry/tests/test_payment_against_purchase_invoice.js
@@ -57,4 +57,4 @@
 		() => frappe.timeout(3),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/payment_entry/tests/test_payment_entry.js b/erpnext/accounts/doctype/payment_entry/tests/test_payment_entry.js
index 0c76343..34af79f 100644
--- a/erpnext/accounts/doctype/payment_entry/tests/test_payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/tests/test_payment_entry.js
@@ -25,4 +25,4 @@
 		() => frappe.timeout(0.3),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/payment_entry/tests/test_payment_entry_write_off.js b/erpnext/accounts/doctype/payment_entry/tests/test_payment_entry_write_off.js
index 9849d76..8c7f6f4 100644
--- a/erpnext/accounts/doctype/payment_entry/tests/test_payment_entry_write_off.js
+++ b/erpnext/accounts/doctype/payment_entry/tests/test_payment_entry_write_off.js
@@ -64,4 +64,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.py b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.py
index fd213a4..3529c16 100644
--- a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.py
+++ b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.py
@@ -9,19 +9,19 @@
 class PaymentGatewayAccount(Document):
 	def autoname(self):
 		self.name = self.payment_gateway + " - " + self.currency
-		
+
 	def validate(self):
 		self.currency = frappe.db.get_value("Account", self.payment_account, "account_currency")
-		
+
 		self.update_default_payment_gateway()
 		self.set_as_default_if_not_set()
-	
+
 	def update_default_payment_gateway(self):
 		if self.is_default:
 			frappe.db.sql("""update `tabPayment Gateway Account` set is_default = 0
 				where is_default = 1 """)
-		
+
 	def set_as_default_if_not_set(self):
-		if not frappe.db.get_value("Payment Gateway Account", 
+		if not frappe.db.get_value("Payment Gateway Account",
 			{"is_default": 1, "name": ("!=", self.name)}, "name"):
 			self.is_default = 1
diff --git a/erpnext/accounts/doctype/payment_order/payment_order.js b/erpnext/accounts/doctype/payment_order/payment_order.js
index d12e474..aa373bc 100644
--- a/erpnext/accounts/doctype/payment_order/payment_order.js
+++ b/erpnext/accounts/doctype/payment_order/payment_order.js
@@ -136,4 +136,4 @@
 
 		dialog.show();
 	},
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/payment_order/payment_order_dashboard.py b/erpnext/accounts/doctype/payment_order/payment_order_dashboard.py
index 6b93f92..a4f3358 100644
--- a/erpnext/accounts/doctype/payment_order/payment_order_dashboard.py
+++ b/erpnext/accounts/doctype/payment_order/payment_order_dashboard.py
@@ -9,4 +9,4 @@
 				'items': ['Payment Entry', 'Journal Entry']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/accounts/doctype/payment_order/test_payment_order.py b/erpnext/accounts/doctype/payment_order/test_payment_order.py
index 5fdde07..9ba57ae 100644
--- a/erpnext/accounts/doctype/payment_order/test_payment_order.py
+++ b/erpnext/accounts/doctype/payment_order/test_payment_order.py
@@ -46,4 +46,4 @@
 	doc = make_payment_order(ref_doc.name, payment_order)
 	doc.save()
 	doc.submit()
-	return doc
\ No newline at end of file
+	return doc
diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
index d788d91..acfe1fe 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
+++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
@@ -307,4 +307,4 @@
 			]
 		})
 		jv.flags.ignore_mandatory = True
-		jv.submit()
\ No newline at end of file
+		jv.submit()
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index 438951d..f83cb37 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -541,4 +541,4 @@
 		}
 	}, target_doc, set_missing_values)
 
-	return doclist
\ No newline at end of file
+	return doclist
diff --git a/erpnext/accounts/doctype/payment_request/test_payment_request.py b/erpnext/accounts/doctype/payment_request/test_payment_request.py
index 5eba62c..ad6ff6f 100644
--- a/erpnext/accounts/doctype/payment_request/test_payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/test_payment_request.py
@@ -138,4 +138,4 @@
 
 		# Try to make Payment Request more than SO amount, should give validation
 		pr2.grand_total = 900
-		self.assertRaises(frappe.ValidationError, pr2.save)
\ No newline at end of file
+		self.assertRaises(frappe.ValidationError, pr2.save)
diff --git a/erpnext/accounts/doctype/payment_term/payment_term.js b/erpnext/accounts/doctype/payment_term/payment_term.js
index acd0144..feecf93 100644
--- a/erpnext/accounts/doctype/payment_term/payment_term.js
+++ b/erpnext/accounts/doctype/payment_term/payment_term.js
@@ -19,4 +19,4 @@
 			frm.set_df_property("discount", "description", description);
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/payment_terms_template/payment_terms_template.js b/erpnext/accounts/doctype/payment_terms_template/payment_terms_template.js
index 84c8d09..ea18ade 100644
--- a/erpnext/accounts/doctype/payment_terms_template/payment_terms_template.js
+++ b/erpnext/accounts/doctype/payment_terms_template/payment_terms_template.js
@@ -3,6 +3,6 @@
 
 frappe.ui.form.on('Payment Terms Template', {
 	setup: function(frm) {
-		
+
 	}
 });
diff --git a/erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py b/erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py
index c705097..5c8cb4f 100644
--- a/erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py
+++ b/erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py
@@ -30,4 +30,4 @@
 				'items': ['Customer Group', 'Supplier Group']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
index 9cfb478..289278e 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
@@ -50,9 +50,13 @@
 				.format(pce[0][0], self.posting_date))
 
 	def make_gl_entries(self):
+		gl_entries = self.get_gl_entries()
+		if gl_entries:
+			from erpnext.accounts.general_ledger import make_gl_entries
+			make_gl_entries(gl_entries)
+	
+	def get_gl_entries(self):
 		gl_entries = []
-		net_pl_balance = 0 
-
 		pl_accounts = self.get_pl_balances()
 
 		for acc in pl_accounts:
@@ -60,6 +64,7 @@
 				gl_entries.append(self.get_gl_dict({
 					"account": acc.account,
 					"cost_center": acc.cost_center,
+					"finance_book": acc.finance_book,
 					"account_currency": acc.account_currency,
 					"debit_in_account_currency": abs(flt(acc.bal_in_account_currency)) if flt(acc.bal_in_account_currency) < 0 else 0,
 					"debit": abs(flt(acc.bal_in_company_currency)) if flt(acc.bal_in_company_currency) < 0 else 0,
@@ -67,35 +72,13 @@
 					"credit": abs(flt(acc.bal_in_company_currency)) if flt(acc.bal_in_company_currency) > 0 else 0
 				}, item=acc))
 
-				net_pl_balance += flt(acc.bal_in_company_currency)
+		if gl_entries:
+			gle_for_net_pl_bal = self.get_pnl_gl_entry(pl_accounts)
+			gl_entries += gle_for_net_pl_bal
 
-		if net_pl_balance:
-			if self.cost_center_wise_pnl:
-				costcenter_wise_gl_entries = self.get_costcenter_wise_pnl_gl_entries(pl_accounts)
-				gl_entries += costcenter_wise_gl_entries
-			else:
-				gl_entry = self.get_pnl_gl_entry(net_pl_balance)
-				gl_entries.append(gl_entry)
-
-		from erpnext.accounts.general_ledger import make_gl_entries
-		make_gl_entries(gl_entries)
+		return gl_entries
 	
-	def get_pnl_gl_entry(self, net_pl_balance):
-		cost_center = frappe.db.get_value("Company", self.company, "cost_center")
-		gl_entry = self.get_gl_dict({
-			"account": self.closing_account_head,
-			"debit_in_account_currency": abs(net_pl_balance) if net_pl_balance > 0 else 0,
-			"debit": abs(net_pl_balance) if net_pl_balance > 0 else 0,
-			"credit_in_account_currency": abs(net_pl_balance) if net_pl_balance < 0 else 0,
-			"credit": abs(net_pl_balance) if net_pl_balance < 0 else 0,
-			"cost_center": cost_center
-		})
-
-		self.update_default_dimensions(gl_entry)
-
-		return gl_entry
-
-	def get_costcenter_wise_pnl_gl_entries(self, pl_accounts):
+	def get_pnl_gl_entry(self, pl_accounts):
 		company_cost_center = frappe.db.get_value("Company", self.company, "cost_center")
 		gl_entries = []
 
@@ -104,6 +87,7 @@
 				gl_entry = self.get_gl_dict({
 					"account": self.closing_account_head,
 					"cost_center": acc.cost_center or company_cost_center,
+					"finance_book": acc.finance_book,
 					"account_currency": acc.account_currency,
 					"debit_in_account_currency": abs(flt(acc.bal_in_account_currency)) if flt(acc.bal_in_account_currency) > 0 else 0,
 					"debit": abs(flt(acc.bal_in_company_currency)) if flt(acc.bal_in_company_currency) > 0 else 0,
@@ -130,7 +114,7 @@
 	def get_pl_balances(self):
 		"""Get balance for dimension-wise pl accounts"""
 
-		dimension_fields = ['t1.cost_center']
+		dimension_fields = ['t1.cost_center', 't1.finance_book']
 
 		self.accounting_dimensions = get_accounting_dimensions()
 		for dimension in self.accounting_dimensions:
diff --git a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
index 2f29372..2d19391 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
@@ -8,6 +8,7 @@
 from frappe.utils import flt, today
 from erpnext.accounts.utils import get_fiscal_year, now
 from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
+from erpnext.accounts.doctype.finance_book.test_finance_book import create_finance_book
 from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
 
 class TestPeriodClosingVoucher(unittest.TestCase):
@@ -118,6 +119,58 @@
 
 		self.assertTrue(pcv_gle, expected_gle)
 
+	def test_period_closing_with_finance_book_entries(self):
+		frappe.db.sql("delete from `tabGL Entry` where company='Test PCV Company'")
+
+		company = create_company()
+		surplus_account = create_account()
+		cost_center = create_cost_center("Test Cost Center 1")
+
+		create_sales_invoice(
+			company=company,
+			income_account="Sales - TPC",
+			expense_account="Cost of Goods Sold - TPC",
+			cost_center=cost_center,
+			rate=400,
+			debit_to="Debtors - TPC"
+		)
+		jv = make_journal_entry(
+			account1="Cash - TPC",
+			account2="Sales - TPC",
+			amount=400,
+			cost_center=cost_center,
+			posting_date=now()
+		)
+		jv.company = company
+		jv.finance_book = create_finance_book().name
+		jv.save()
+		jv.submit()
+
+		pcv = frappe.get_doc({
+			"transaction_date": today(),
+			"posting_date": today(),
+			"fiscal_year": get_fiscal_year(today())[0],
+			"company": company,
+			"closing_account_head": surplus_account,
+			"remarks": "Test",
+			"doctype": "Period Closing Voucher"
+		})
+		pcv.insert()
+		pcv.submit()
+
+		expected_gle = (
+			(surplus_account, 0.0, 400.0, ''),
+			(surplus_account, 0.0, 400.0, jv.finance_book),
+			('Sales - TPC', 400.0, 0.0, ''),
+			('Sales - TPC', 400.0, 0.0, jv.finance_book)
+		)
+
+		pcv_gle = frappe.db.sql("""
+			select account, debit, credit, finance_book from `tabGL Entry` where voucher_no=%s
+		""", (pcv.name))
+
+		self.assertTrue(pcv_gle, expected_gle)
+
 	def make_period_closing_voucher(self):
 		pcv = frappe.get_doc({
 			"doctype": "Period Closing Voucher",
@@ -139,7 +192,7 @@
 		'company_name': "Test PCV Company",
 		'country': 'United States',
 		'default_currency': 'USD'
-	})		
+	})
 	company.insert(ignore_if_duplicate = True)
 	return company.name
 
diff --git a/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.js b/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.js
index 6418d73..264d4a6 100644
--- a/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.js
+++ b/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.js
@@ -20,9 +20,9 @@
 		frm.set_query("pos_opening_entry", function(doc) {
 			return { filters: { 'status': 'Open', 'docstatus': 1 } };
 		});
-		
+
 		if (frm.doc.docstatus === 0 && !frm.doc.amended_from) frm.set_value("period_end_date", frappe.datetime.now_datetime());
-		
+
 		frappe.realtime.on('closing_process_complete', async function(data) {
 			await frm.reload_doc();
 			if (frm.doc.status == 'Failed' && frm.doc.error_message && data.user == frappe.session.user) {
@@ -43,7 +43,7 @@
 			const issue = '<a id="jump_to_error" style="text-decoration: underline;">issue</a>';
 			frm.dashboard.set_headline(
 				__('POS Closing failed while running in a background process. You can resolve the {0} and retry the process again.', [issue]));
-			
+
 			$('#jump_to_error').on('click', (e) => {
 				e.preventDefault();
 				frappe.utils.scroll_to(
diff --git a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py
index b596c0c..5b18ebb 100644
--- a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py
+++ b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py
@@ -85,9 +85,15 @@
 
 		pcv_doc.load_from_db()
 		pcv_doc.cancel()
-		si_doc.load_from_db()
+
+		cancelled_invoice = frappe.db.get_value(
+			'POS Invoice Merge Log', {'pos_closing_entry': pcv_doc.name},
+			'consolidated_invoice'
+		)
+		docstatus = frappe.db.get_value("Sales Invoice", cancelled_invoice, 'docstatus')
+		self.assertEqual(docstatus, 2)
+
 		pos_inv1.load_from_db()
-		self.assertEqual(si_doc.docstatus, 2)
 		self.assertEqual(pos_inv1.status, 'Paid')
 
 
diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.js b/erpnext/accounts/doctype/pos_invoice/pos_invoice.js
index 181e9f8..15c2922 100644
--- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.js
+++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.js
@@ -16,7 +16,7 @@
 
 	onload(doc) {
 		super.onload();
-		this.frm.ignore_doctypes_on_cancel_all = ['POS Invoice Merge Log'];
+		this.frm.ignore_doctypes_on_cancel_all = ['POS Invoice Merge Log', 'POS Closing Entry'];
 		if(doc.__islocal && doc.is_pos && frappe.get_route_str() !== 'point-of-sale') {
 			this.frm.script_manager.trigger("is_pos");
 			this.frm.refresh_fields();
@@ -111,16 +111,12 @@
 	}
 
 	write_off_outstanding_amount_automatically() {
-		if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) {
+		if (cint(this.frm.doc.write_off_outstanding_amount_automatically)) {
 			frappe.model.round_floats_in(this.frm.doc, ["grand_total", "paid_amount"]);
 			// this will make outstanding amount 0
 			this.frm.set_value("write_off_amount",
 				flt(this.frm.doc.grand_total - this.frm.doc.paid_amount - this.frm.doc.total_advance, precision("write_off_amount"))
 			);
-			this.frm.toggle_enable("write_off_amount", false);
-
-		} else {
-			this.frm.toggle_enable("write_off_amount", true);
 		}
 
 		this.calculate_outstanding_amount(false);
diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.json b/erpnext/accounts/doctype/pos_invoice/pos_invoice.json
index 33c3e04..b819537 100644
--- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.json
+++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.json
@@ -99,6 +99,7 @@
   "loyalty_redemption_account",
   "loyalty_redemption_cost_center",
   "section_break_49",
+  "coupon_code",
   "apply_discount_on",
   "base_discount_amount",
   "column_break_51",
@@ -595,7 +596,8 @@
   {
    "fieldname": "scan_barcode",
    "fieldtype": "Data",
-   "label": "Scan Barcode"
+   "label": "Scan Barcode",
+   "options": "Barcode"
   },
   {
    "allow_bulk_edit": 1,
@@ -1182,7 +1184,8 @@
    "label": "Write Off Amount",
    "no_copy": 1,
    "options": "currency",
-   "print_hide": 1
+   "print_hide": 1,
+   "read_only_depends_on": "eval: doc.write_off_outstanding_amount_automatically"
   },
   {
    "fieldname": "base_write_off_amount",
@@ -1548,12 +1551,20 @@
    "no_copy": 1,
    "options": "Sales Invoice",
    "read_only": 1
+  },
+  {
+   "depends_on": "coupon_code",
+   "fieldname": "coupon_code",
+   "fieldtype": "Link",
+   "label": "Coupon Code",
+   "options": "Coupon Code",
+   "print_hide": 1
   }
  ],
  "icon": "fa fa-file-text",
  "is_submittable": 1,
  "links": [],
- "modified": "2021-07-29 13:37:20.636171",
+ "modified": "2021-08-18 16:13:52.080543",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "POS Invoice",
diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
index 8ec4ef2..034a217 100644
--- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
+++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
@@ -44,6 +44,9 @@
 		self.validate_pos()
 		self.validate_payment_amount()
 		self.validate_loyalty_transaction()
+		if self.coupon_code:
+			from erpnext.accounts.doctype.pricing_rule.utils import validate_coupon_code
+			validate_coupon_code(self.coupon_code)
 
 	def on_submit(self):
 		# create the loyalty point ledger entry if the customer is enrolled in any loyalty program
@@ -58,6 +61,10 @@
 		self.check_phone_payments()
 		self.set_status(update=True)
 
+		if self.coupon_code:
+			from erpnext.accounts.doctype.pricing_rule.utils import update_coupon_code_count
+			update_coupon_code_count(self.coupon_code,'used')
+
 	def before_cancel(self):
 		if self.consolidated_invoice and frappe.db.get_value('Sales Invoice', self.consolidated_invoice, 'docstatus') == 1:
 			pos_closing_entry = frappe.get_all(
@@ -84,6 +91,10 @@
 			against_psi_doc.delete_loyalty_point_entry()
 			against_psi_doc.make_loyalty_point_entry()
 
+		if self.coupon_code:
+			from erpnext.accounts.doctype.pricing_rule.utils import update_coupon_code_count
+			update_coupon_code_count(self.coupon_code,'cancelled')
+
 	def check_phone_payments(self):
 		for pay in self.payments:
 			if pay.type == "Phone" and pay.amount >= 0:
@@ -127,7 +138,7 @@
 						.format(item.idx, bold_delivered_serial_nos), title=_("Item Unavailable"))
 
 	def validate_stock_availablility(self):
-		if self.is_return:
+		if self.is_return or self.docstatus != 1:
 			return
 
 		allow_negative_stock = frappe.db.get_single_value('Stock Settings', 'allow_negative_stock')
diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
index 6172796..d2527fb 100644
--- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
+++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
@@ -320,7 +320,8 @@
 		pos2.get("items")[0].serial_no = serial_nos[0]
 		pos2.append("payments", {'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - _TC', 'amount': 1000})
 
-		self.assertRaises(frappe.ValidationError, pos2.insert)
+		pos2.insert()
+		self.assertRaises(frappe.ValidationError, pos2.submit)
 
 	def test_delivered_serialized_item_transaction(self):
 		from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
@@ -348,7 +349,8 @@
 		pos2.get("items")[0].serial_no = serial_nos[0]
 		pos2.append("payments", {'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - _TC', 'amount': 1000})
 
-		self.assertRaises(frappe.ValidationError, pos2.insert)
+		pos2.insert()
+		self.assertRaises(frappe.ValidationError, pos2.submit)
 
 	def test_loyalty_points(self):
 		from erpnext.accounts.doctype.loyalty_program.test_loyalty_program import create_records
diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.js b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.js
index cd08efc..2f8081b 100644
--- a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.js
+++ b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.js
@@ -5,10 +5,10 @@
 	setup: function(frm) {
 		frm.set_query("pos_invoice", "pos_invoices", doc => {
 			return{
-				filters: { 
+				filters: {
 					'docstatus': 1,
-					'customer': doc.customer, 
-					'consolidated_invoice': '' 
+					'customer': doc.customer,
+					'consolidated_invoice': ''
 				}
 			}
 		});
diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
index 08e072e..e50d437 100644
--- a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
+++ b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
@@ -354,4 +354,4 @@
 	except Exception:
 		json_message = message
 
-	return json_message
\ No newline at end of file
+	return json_message
diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py
index 040a815..1b96594 100644
--- a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py
+++ b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py
@@ -147,4 +147,3 @@
 			frappe.set_user("Administrator")
 			frappe.db.sql("delete from `tabPOS Profile`")
 			frappe.db.sql("delete from `tabPOS Invoice`")
-
diff --git a/erpnext/accounts/doctype/pos_opening_entry/pos_opening_entry.js b/erpnext/accounts/doctype/pos_opening_entry/pos_opening_entry.js
index 372e756..d23f348 100644
--- a/erpnext/accounts/doctype/pos_opening_entry/pos_opening_entry.js
+++ b/erpnext/accounts/doctype/pos_opening_entry/pos_opening_entry.js
@@ -53,4 +53,4 @@
 				});
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/pos_opening_entry/pos_opening_entry.py b/erpnext/accounts/doctype/pos_opening_entry/pos_opening_entry.py
index 0023a84..3318fef 100644
--- a/erpnext/accounts/doctype/pos_opening_entry/pos_opening_entry.py
+++ b/erpnext/accounts/doctype/pos_opening_entry/pos_opening_entry.py
@@ -38,4 +38,4 @@
 			frappe.throw(msg.format(", ".join(invalid_modes)), title=_("Missing Account"))
 
 	def on_submit(self):
-		self.set_status(update=True)
\ No newline at end of file
+		self.set_status(update=True)
diff --git a/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py b/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py
index 2e36391..c115be5 100644
--- a/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py
+++ b/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py
@@ -21,8 +21,8 @@
 		balance_details.append(frappe._dict({
 			'mode_of_payment': d.mode_of_payment
 		}))
-	
+
 	entry.set("balance_details", balance_details)
 	entry.submit()
-	
-	return entry.as_dict()	
+
+	return entry.as_dict()
diff --git a/erpnext/accounts/doctype/pos_settings/pos_settings.py b/erpnext/accounts/doctype/pos_settings/pos_settings.py
index 913f498..d925dd9 100644
--- a/erpnext/accounts/doctype/pos_settings/pos_settings.py
+++ b/erpnext/accounts/doctype/pos_settings/pos_settings.py
@@ -8,4 +8,4 @@
 
 class POSSettings(Document):
 	def validate(self):
-		pass
\ No newline at end of file
+		pass
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index 556f49d..4903c50 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -198,12 +198,19 @@
 	set_serial_nos_based_on_fifo = frappe.db.get_single_value("Stock Settings",
 		"automatically_set_serial_nos_based_on_fifo")
 
+	item_code_list = tuple(item.get('item_code') for item in item_list)
+	query_items = frappe.get_all('Item', fields=['item_code','has_serial_no'], filters=[['item_code','in',item_code_list]],as_list=1)
+	serialized_items = dict()
+	for item_code, val in query_items:
+		serialized_items.setdefault(item_code, val)
+	
 	for item in item_list:
 		args_copy = copy.deepcopy(args)
 		args_copy.update(item)
 		data = get_pricing_rule_for_item(args_copy, item.get('price_list_rate'), doc=doc)
 		out.append(data)
-		if not item.get("serial_no") and set_serial_nos_based_on_fifo and not args.get('is_return'):
+		
+		if serialized_items.get(item.get('item_code')) and not item.get("serial_no") and set_serial_nos_based_on_fifo and not args.get('is_return'):
 			out[0].update(get_serial_no_for_item(args_copy))
 
 	return out
diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
index 3173db1..680370b 100644
--- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
@@ -615,4 +615,4 @@
 	for doctype in ["Pricing Rule", "Pricing Rule Item Code",
 		"Pricing Rule Item Group", "Pricing Rule Brand"]:
 
-		frappe.db.sql("delete from `tab{0}`".format(doctype))
\ No newline at end of file
+		frappe.db.sql("delete from `tab{0}`".format(doctype))
diff --git a/erpnext/accounts/doctype/pricing_rule/tests/test_pricing_rule.js b/erpnext/accounts/doctype/pricing_rule/tests/test_pricing_rule.js
index 8155e7d..8279b59 100644
--- a/erpnext/accounts/doctype/pricing_rule/tests/test_pricing_rule.js
+++ b/erpnext/accounts/doctype/pricing_rule/tests/test_pricing_rule.js
@@ -26,4 +26,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/accounts/doctype/process_deferred_accounting/process_deferred_accounting.py b/erpnext/accounts/doctype/process_deferred_accounting/process_deferred_accounting.py
index 0eac732..5e7583a 100644
--- a/erpnext/accounts/doctype/process_deferred_accounting/process_deferred_accounting.py
+++ b/erpnext/accounts/doctype/process_deferred_accounting/process_deferred_accounting.py
@@ -31,4 +31,4 @@
 				'against_voucher': self.name
 			})
 
-		make_reverse_gl_entries(gl_entries=gl_entries)
\ No newline at end of file
+		make_reverse_gl_entries(gl_entries=gl_entries)
diff --git a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py
index e08a0e5..03c269a 100644
--- a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py
+++ b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py
@@ -45,4 +45,4 @@
 			["Sales - _TC", 0.0, 33.85, "2019-01-31"]
 		]
 
-		check_gl_entries(self, si.name, expected_gle, "2019-01-10")
\ No newline at end of file
+		check_gl_entries(self, si.name, expected_gle, "2019-01-10")
diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
index 500952e..a12ea40 100644
--- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
+++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
@@ -284,4 +284,4 @@
 	selected = frappe.get_list('Process Statement Of Accounts', filters={'to_date': format_date(today()), 'enable_auto_email': 1})
 	for entry in selected:
 		send_emails(entry.name, from_scheduler=True)
-	return True
\ No newline at end of file
+	return True
diff --git a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.js b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.js
index 890a187..e840c79 100644
--- a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.js
+++ b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.js
@@ -48,4 +48,4 @@
 				frm.doc.apply_on === key ? 1 : 0);
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme_dashboard.py b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme_dashboard.py
index 28c4c61..54fedb7 100644
--- a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme_dashboard.py
+++ b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme_dashboard.py
@@ -9,4 +9,4 @@
 				'items': ['Pricing Rule']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
index 7354ef0..286f7cf 100644
--- a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
+++ b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
@@ -11,25 +11,25 @@
 		ps = make_promotional_scheme()
 		price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name", "creation"],
 			filters = {'promotional_scheme': ps.name})
-		self.assertTrue(len(price_rules),1) 
+		self.assertTrue(len(price_rules),1)
 		price_doc_details = frappe.db.get_value('Pricing Rule', price_rules[0].name, ['customer', 'min_qty', 'discount_percentage'], as_dict = 1)
 		self.assertTrue(price_doc_details.customer, '_Test Customer')
 		self.assertTrue(price_doc_details.min_qty, 4)
 		self.assertTrue(price_doc_details.discount_percentage, 20)
 
 		ps.price_discount_slabs[0].min_qty = 6
-		ps.append('customer', {  
+		ps.append('customer', {
 			'customer': "_Test Customer 2"})
 		ps.save()
 		price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name"],
 			filters = {'promotional_scheme': ps.name})
-		self.assertTrue(len(price_rules), 2) 
+		self.assertTrue(len(price_rules), 2)
 
 		price_doc_details = frappe.db.get_value('Pricing Rule', price_rules[1].name, ['customer', 'min_qty', 'discount_percentage'], as_dict = 1)
 		self.assertTrue(price_doc_details.customer, '_Test Customer 2')
 		self.assertTrue(price_doc_details.min_qty, 6)
 		self.assertTrue(price_doc_details.discount_percentage, 20)
-		
+
 		price_doc_details = frappe.db.get_value('Pricing Rule', price_rules[0].name, ['customer', 'min_qty', 'discount_percentage'], as_dict = 1)
 		self.assertTrue(price_doc_details.customer, '_Test Customer')
 		self.assertTrue(price_doc_details.min_qty, 6)
@@ -38,7 +38,7 @@
 		price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name"],
 			filters = {'promotional_scheme': ps.name})
 		self.assertEqual(price_rules, [])
-		
+
 def make_promotional_scheme():
 	ps = frappe.new_doc('Promotional Scheme')
 	ps.name = '_Test Scheme'
@@ -57,4 +57,4 @@
 	})
 	ps.save()
 
-	return ps
\ No newline at end of file
+	return ps
diff --git a/erpnext/accounts/doctype/promotional_scheme_price_discount/promotional_scheme_price_discount.json b/erpnext/accounts/doctype/promotional_scheme_price_discount/promotional_scheme_price_discount.json
index 795fb1c..a70d5c9 100644
--- a/erpnext/accounts/doctype/promotional_scheme_price_discount/promotional_scheme_price_discount.json
+++ b/erpnext/accounts/doctype/promotional_scheme_price_discount/promotional_scheme_price_discount.json
@@ -106,7 +106,6 @@
    "depends_on": "eval:doc.rate_or_discount==\"Rate\"",
    "fieldname": "rate",
    "fieldtype": "Currency",
-   "in_list_view": 1,
    "label": "Rate"
   },
   {
@@ -170,7 +169,7 @@
  "index_web_pages_for_search": 1,
  "istable": 1,
  "links": [],
- "modified": "2021-03-07 11:56:23.424137",
+ "modified": "2021-08-19 15:49:29.598727",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Promotional Scheme Price Discount",
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 3b91118..6c74d2b 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -591,4 +591,4 @@
 	company: function(frm) {
 		erpnext.accounts.dimensions.update_dimension(frm, frm.doctype);
 	},
-})
\ No newline at end of file
+})
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index 7025dd9..7822f74 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -668,8 +668,7 @@
    "fieldname": "scan_barcode",
    "fieldtype": "Data",
    "label": "Scan Barcode",
-   "show_days": 1,
-   "show_seconds": 1
+   "options": "Barcode"
   },
   {
    "allow_bulk_edit": 1,
@@ -1715,7 +1714,7 @@
  "idx": 204,
  "is_submittable": 1,
  "links": [],
- "modified": "2021-08-07 17:53:14.351439",
+ "modified": "2021-08-17 20:16:12.737743",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Purchase Invoice",
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py
index 173939d..b6467a3 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py
@@ -34,4 +34,4 @@
 				'items': ['Auto Repeat']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js
index 914a245..771b49a 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js
@@ -26,4 +26,4 @@
 			return [__("Paid"), "green", "outstanding_amount,=,0"];
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js
index b470051..94b3b9e 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js
@@ -72,4 +72,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.py b/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.py
index bfaa849..d157837 100644
--- a/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.py
+++ b/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class PurchaseInvoiceAdvance(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.py b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.py
index a7489da..5854dde 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.py
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class PurchaseTaxesandCharges(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py
index 11c220b..db9793d 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py
@@ -19,4 +19,4 @@
 				'items': ['Supplier Quotation', 'Tax Rule']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.js b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.js
index c73f03b..10b05d0 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.js
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.js
@@ -26,4 +26,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/accounts/doctype/sales_invoice/regional/india.js b/erpnext/accounts/doctype/sales_invoice/regional/india.js
index f54bce8..6336db1 100644
--- a/erpnext/accounts/doctype/sales_invoice/regional/india.js
+++ b/erpnext/accounts/doctype/sales_invoice/regional/india.js
@@ -1,8 +1,6 @@
 {% include "erpnext/regional/india/taxes.js" %}
-{% include "erpnext/regional/india/e_invoice/einvoice.js" %}
 
 erpnext.setup_auto_gst_taxation('Sales Invoice');
-erpnext.setup_einvoice_actions('Sales Invoice')
 
 frappe.ui.form.on("Sales Invoice", {
 	setup: function(frm) {
diff --git a/erpnext/accounts/doctype/sales_invoice/regional/india_list.js b/erpnext/accounts/doctype/sales_invoice/regional/india_list.js
index ada665a..d9d6634 100644
--- a/erpnext/accounts/doctype/sales_invoice/regional/india_list.js
+++ b/erpnext/accounts/doctype/sales_invoice/regional/india_list.js
@@ -36,139 +36,4 @@
 	};
 
 	list_view.page.add_actions_menu_item(__('Generate E-Way Bill JSON'), action, false);
-
-	const generate_irns = () => {
-		const docnames = list_view.get_checked_items(true);
-		if (docnames && docnames.length) {
-			frappe.call({
-				method: 'erpnext.regional.india.e_invoice.utils.generate_einvoices',
-				args: { docnames },
-				freeze: true,
-				freeze_message: __('Generating E-Invoices...')
-			});
-		} else {
-			frappe.msgprint({
-				message: __('Please select at least one sales invoice to generate IRN'),
-				title: __('No Invoice Selected'),
-				indicator: 'red'
-			});
-		}
-	};
-
-	const cancel_irns = () => {
-		const docnames = list_view.get_checked_items(true);
-
-		const fields = [
-			{
-				"label": "Reason",
-				"fieldname": "reason",
-				"fieldtype": "Select",
-				"reqd": 1,
-				"default": "1-Duplicate",
-				"options": ["1-Duplicate", "2-Data Entry Error", "3-Order Cancelled", "4-Other"]
-			},
-			{ 
-				"label": "Remark",
-				"fieldname": "remark",
-				"fieldtype": "Data",
-				"reqd": 1
-			}
-		];
-
-		const d = new frappe.ui.Dialog({
-			title: __("Cancel IRN"),
-			fields: fields,
-			primary_action: function() {
-				const data = d.get_values();
-				frappe.call({
-					method: 'erpnext.regional.india.e_invoice.utils.cancel_irns',
-					args: { 
-						doctype: list_view.doctype,
-						docnames,
-						reason: data.reason.split('-')[0],
-						remark: data.remark
-					},
-					freeze: true,
-					freeze_message: __('Cancelling E-Invoices...'),
-				});
-				d.hide();
-			},
-			primary_action_label: __('Submit')
-		});
-		d.show();
-	};
-
-	let einvoicing_enabled = false;
-	frappe.db.get_single_value("E Invoice Settings", "enable").then(enabled => {
-		einvoicing_enabled = enabled;
-	});
-
-	list_view.$result.on("change", "input[type=checkbox]", () => {
-		if (einvoicing_enabled) {
-			const docnames = list_view.get_checked_items(true);
-			// show/hide e-invoicing actions when no sales invoices are checked
-			if (docnames && docnames.length) {
-				// prevent adding actions twice if e-invoicing action group already exists
-				if (list_view.page.get_inner_group_button(__('E-Invoicing')).length == 0) {
-					list_view.page.add_inner_button(__('Generate IRNs'), generate_irns, __('E-Invoicing'));
-					list_view.page.add_inner_button(__('Cancel IRNs'), cancel_irns, __('E-Invoicing'));
-				}
-			} else {
-				list_view.page.remove_inner_button(__('Generate IRNs'), __('E-Invoicing'));
-				list_view.page.remove_inner_button(__('Cancel IRNs'), __('E-Invoicing'));
-			}
-		}
-	});
-
-	frappe.realtime.on("bulk_einvoice_generation_complete", (data) => {
-		const { failures, user, invoices } = data;
-		
-		if (invoices.length != failures.length) {
-			frappe.msgprint({
-				message: __('{0} e-invoices generated successfully', [invoices.length]),
-				title: __('Bulk E-Invoice Generation Complete'),
-				indicator: 'orange'
-			});
-		}
-
-		if (failures && failures.length && user == frappe.session.user) {
-			let message = `
-				Failed to generate IRNs for following ${failures.length} sales invoices:
-				<ul style="padding-left: 20px; padding-top: 5px;">
-					${failures.map(d => `<li>${d.docname}</li>`).join('')}
-				</ul>
-			`;
-			frappe.msgprint({
-				message: message,
-				title: __('Bulk E-Invoice Generation Complete'),
-				indicator: 'orange'
-			});
-		}
-	});
-
-	frappe.realtime.on("bulk_einvoice_cancellation_complete", (data) => {
-		const { failures, user, invoices } = data;
-
-		if (invoices.length != failures.length) {
-			frappe.msgprint({
-				message: __('{0} e-invoices cancelled successfully', [invoices.length]),
-				title: __('Bulk E-Invoice Cancellation Complete'),
-				indicator: 'orange'
-			});
-		}
-
-		if (failures && failures.length && user == frappe.session.user) {
-			let message = `
-				Failed to cancel IRNs for following ${failures.length} sales invoices:
-				<ul style="padding-left: 20px; padding-top: 5px;">
-					${failures.map(d => `<li>${d.docname}</li>`).join('')}
-				</ul>
-			`;
-			frappe.msgprint({
-				message: message,
-				title: __('Bulk E-Invoice Cancellation Complete'),
-				indicator: 'orange'
-			});
-		}
-	});
-};
\ No newline at end of file
+};
diff --git a/erpnext/accounts/doctype/sales_invoice/regional/italy.js b/erpnext/accounts/doctype/sales_invoice/regional/italy.js
index 1c47d3a..21eb8ce 100644
--- a/erpnext/accounts/doctype/sales_invoice/regional/italy.js
+++ b/erpnext/accounts/doctype/sales_invoice/regional/italy.js
@@ -1,3 +1,3 @@
 {% include "erpnext/regional/italy/sales_invoice.js" %}
 
-erpnext.setup_e_invoice_button('Sales Invoice')
\ No newline at end of file
+erpnext.setup_e_invoice_button('Sales Invoice')
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 7a273c7..2071827 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -324,16 +324,12 @@
 	}
 
 	write_off_outstanding_amount_automatically() {
-		if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) {
+		if (cint(this.frm.doc.write_off_outstanding_amount_automatically)) {
 			frappe.model.round_floats_in(this.frm.doc, ["grand_total", "paid_amount"]);
 			// this will make outstanding amount 0
 			this.frm.set_value("write_off_amount",
 				flt(this.frm.doc.grand_total - this.frm.doc.paid_amount - this.frm.doc.total_advance, precision("write_off_amount"))
 			);
-			this.frm.toggle_enable("write_off_amount", false);
-
-		} else {
-			this.frm.toggle_enable("write_off_amount", true);
 		}
 
 		this.calculate_outstanding_amount(false);
@@ -447,10 +443,10 @@
 		this.frm.refresh_field("outstanding_amount");
 		this.frm.refresh_field("paid_amount");
 		this.frm.refresh_field("base_paid_amount");
-	},
+	}
 
 	currency() {
-		this._super();
+		super.currency();
 		$.each(cur_frm.doc.timesheets, function(i, d) {
 			let row = frappe.get_doc(d.doctype, d.name)
 			set_timesheet_detail_rate(row.doctype, row.name, cur_frm.doc.currency, row.timesheet_detail)
@@ -787,8 +783,6 @@
 		if (frappe.boot.sysdefaults.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
 		else hide_field(['c_form_applicable', 'c_form_no']);
 
-		frm.toggle_enable("write_off_amount", !!!cint(doc.write_off_outstanding_amount_automatically));
-
 		frm.refresh_fields();
 	},
 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index b2be860..5023c9c 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -199,9 +199,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "options": "fa fa-user",
-   "show_days": 1,
-   "show_seconds": 1
+   "options": "fa fa-user"
   },
   {
    "allow_on_submit": 1,
@@ -213,9 +211,7 @@
    "hide_seconds": 1,
    "label": "Title",
    "no_copy": 1,
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "bold": 1,
@@ -230,9 +226,7 @@
    "options": "ACC-SINV-.YYYY.-\nACC-SINV-RET-.YYYY.-",
    "print_hide": 1,
    "reqd": 1,
-   "set_only_once": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "set_only_once": 1
   },
   {
    "bold": 1,
@@ -246,9 +240,7 @@
    "oldfieldtype": "Link",
    "options": "Customer",
    "print_hide": 1,
-   "search_index": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "search_index": 1
   },
   {
    "bold": 1,
@@ -262,9 +254,7 @@
    "label": "Customer Name",
    "oldfieldname": "customer_name",
    "oldfieldtype": "Data",
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "tax_id",
@@ -273,9 +263,7 @@
    "hide_seconds": 1,
    "label": "Tax Id",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "project",
@@ -287,9 +275,7 @@
    "oldfieldname": "project_name",
    "oldfieldtype": "Link",
    "options": "Project",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "default": "0",
@@ -300,9 +286,7 @@
    "label": "Include Payment (POS)",
    "oldfieldname": "is_pos",
    "oldfieldtype": "Check",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "depends_on": "is_pos",
@@ -312,9 +296,7 @@
    "hide_seconds": 1,
    "label": "POS Profile",
    "options": "POS Profile",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "default": "0",
@@ -324,18 +306,14 @@
    "hide_seconds": 1,
    "label": "Is Return (Credit Note)",
    "no_copy": 1,
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "column_break1",
    "fieldtype": "Column Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "oldfieldtype": "Column Break",
-   "show_days": 1,
-   "show_seconds": 1
+   "oldfieldtype": "Column Break"
   },
   {
    "fieldname": "company",
@@ -349,9 +327,7 @@
    "options": "Company",
    "print_hide": 1,
    "remember_last_selected_value": 1,
-   "reqd": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "reqd": 1
   },
   {
    "fieldname": "cost_center",
@@ -359,9 +335,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Cost Center",
-   "options": "Cost Center",
-   "show_days": 1,
-   "show_seconds": 1
+   "options": "Cost Center"
   },
   {
    "bold": 1,
@@ -375,9 +349,7 @@
    "oldfieldname": "posting_date",
    "oldfieldtype": "Date",
    "reqd": 1,
-   "search_index": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "search_index": 1
   },
   {
    "fieldname": "posting_time",
@@ -388,9 +360,7 @@
    "no_copy": 1,
    "oldfieldname": "posting_time",
    "oldfieldtype": "Time",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "default": "0",
@@ -400,9 +370,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Edit Posting Date and Time",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "due_date",
@@ -412,9 +380,7 @@
    "label": "Payment Due Date",
    "no_copy": 1,
    "oldfieldname": "due_date",
-   "oldfieldtype": "Date",
-   "show_days": 1,
-   "show_seconds": 1
+   "oldfieldtype": "Date"
   },
   {
    "fieldname": "amended_from",
@@ -428,9 +394,7 @@
    "oldfieldtype": "Link",
    "options": "Sales Invoice",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "depends_on": "eval:doc.return_against || doc.is_debit_note",
@@ -443,9 +407,7 @@
    "options": "Sales Invoice",
    "print_hide": 1,
    "read_only_depends_on": "eval:doc.is_return",
-   "search_index": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "search_index": 1
   },
   {
    "default": "0",
@@ -454,9 +416,7 @@
    "fieldtype": "Check",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Update Billed Amount in Sales Order",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Update Billed Amount in Sales Order"
   },
   {
    "collapsible": 1,
@@ -465,9 +425,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Customer PO Details",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Customer PO Details"
   },
   {
    "allow_on_submit": 1,
@@ -477,17 +435,13 @@
    "hide_seconds": 1,
    "label": "Customer's Purchase Order",
    "no_copy": 1,
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "column_break_23",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -495,9 +449,7 @@
    "fieldtype": "Date",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Customer's Purchase Order Date",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Customer's Purchase Order Date"
   },
   {
    "collapsible": 1,
@@ -505,9 +457,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Address and Contact",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Address and Contact"
   },
   {
    "fieldname": "customer_address",
@@ -516,9 +466,7 @@
    "hide_seconds": 1,
    "label": "Customer Address",
    "options": "Address",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "address_display",
@@ -526,9 +474,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Address",
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "contact_person",
@@ -538,9 +484,7 @@
    "in_global_search": 1,
    "label": "Contact Person",
    "options": "Contact",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "contact_display",
@@ -548,9 +492,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Contact",
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "contact_mobile",
@@ -559,9 +501,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Mobile No",
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "contact_email",
@@ -572,9 +512,7 @@
    "label": "Contact Email",
    "options": "Email",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "territory",
@@ -583,17 +521,13 @@
    "hide_seconds": 1,
    "label": "Territory",
    "options": "Territory",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "col_break4",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "fieldname": "shipping_address_name",
@@ -602,9 +536,7 @@
    "hide_seconds": 1,
    "label": "Shipping Address Name",
    "options": "Address",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "shipping_address",
@@ -613,9 +545,7 @@
    "hide_seconds": 1,
    "label": "Shipping Address",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "company_address",
@@ -624,9 +554,7 @@
    "hide_seconds": 1,
    "label": "Company Address Name",
    "options": "Address",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "company_address_display",
@@ -636,9 +564,7 @@
    "hide_seconds": 1,
    "label": "Company Address",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "collapsible": 1,
@@ -647,9 +573,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Currency and Price List",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Currency and Price List"
   },
   {
    "fieldname": "currency",
@@ -661,9 +585,7 @@
    "oldfieldtype": "Select",
    "options": "Currency",
    "print_hide": 1,
-   "reqd": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "reqd": 1
   },
   {
    "description": "Rate at which Customer Currency is converted to customer's base currency",
@@ -676,17 +598,13 @@
    "oldfieldtype": "Currency",
    "precision": "9",
    "print_hide": 1,
-   "reqd": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "reqd": 1
   },
   {
    "fieldname": "column_break2",
    "fieldtype": "Column Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1,
    "width": "50%"
   },
   {
@@ -699,9 +617,7 @@
    "oldfieldtype": "Select",
    "options": "Price List",
    "print_hide": 1,
-   "reqd": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "reqd": 1
   },
   {
    "fieldname": "price_list_currency",
@@ -712,9 +628,7 @@
    "options": "Currency",
    "print_hide": 1,
    "read_only": 1,
-   "reqd": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "reqd": 1
   },
   {
    "description": "Rate at which Price list currency is converted to customer's base currency",
@@ -725,9 +639,7 @@
    "label": "Price List Exchange Rate",
    "precision": "9",
    "print_hide": 1,
-   "reqd": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "reqd": 1
   },
   {
    "default": "0",
@@ -738,18 +650,14 @@
    "label": "Ignore Pricing Rule",
    "no_copy": 1,
    "permlevel": 1,
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "sec_warehouse",
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Warehouse",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Warehouse"
   },
   {
    "depends_on": "update_stock",
@@ -759,9 +667,7 @@
    "hide_seconds": 1,
    "label": "Source Warehouse",
    "options": "Warehouse",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "items_section",
@@ -770,9 +676,7 @@
    "hide_seconds": 1,
    "label": "Items",
    "oldfieldtype": "Section Break",
-   "options": "fa fa-shopping-cart",
-   "show_days": 1,
-   "show_seconds": 1
+   "options": "fa fa-shopping-cart"
   },
   {
    "default": "0",
@@ -783,18 +687,15 @@
    "label": "Update Stock",
    "oldfieldname": "update_stock",
    "oldfieldtype": "Check",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "scan_barcode",
    "fieldtype": "Data",
+   "options": "Barcode",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Scan Barcode",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Scan Barcode"
   },
   {
    "allow_bulk_edit": 1,
@@ -806,18 +707,14 @@
    "oldfieldname": "entries",
    "oldfieldtype": "Table",
    "options": "Sales Invoice Item",
-   "reqd": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "reqd": 1
   },
   {
    "fieldname": "pricing_rule_details",
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Pricing Rules",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Pricing Rules"
   },
   {
    "fieldname": "pricing_rules",
@@ -826,9 +723,7 @@
    "hide_seconds": 1,
    "label": "Pricing Rule Detail",
    "options": "Pricing Rule Detail",
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "packing_list",
@@ -837,9 +732,7 @@
    "hide_seconds": 1,
    "label": "Packing List",
    "options": "fa fa-suitcase",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "packed_items",
@@ -848,9 +741,7 @@
    "hide_seconds": 1,
    "label": "Packed Items",
    "options": "Packed Item",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "product_bundle_help",
@@ -858,9 +749,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Product Bundle Help",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "collapsible": 1,
@@ -870,9 +759,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Time Sheet List",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Time Sheet List"
   },
   {
    "fieldname": "timesheets",
@@ -881,9 +768,7 @@
    "hide_seconds": 1,
    "label": "Time Sheets",
    "options": "Sales Invoice Timesheet",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "default": "0",
@@ -894,17 +779,13 @@
    "label": "Total Billing Amount",
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "section_break_30",
    "fieldtype": "Section Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "fieldname": "total_qty",
@@ -912,9 +793,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Total Quantity",
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "base_total",
@@ -924,9 +803,7 @@
    "label": "Total (Company Currency)",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "base_net_total",
@@ -939,17 +816,13 @@
    "options": "Company:company:default_currency",
    "print_hide": 1,
    "read_only": 1,
-   "reqd": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "reqd": 1
   },
   {
    "fieldname": "column_break_32",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "fieldname": "total",
@@ -958,9 +831,7 @@
    "hide_seconds": 1,
    "label": "Total",
    "options": "currency",
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "net_total",
@@ -970,9 +841,7 @@
    "label": "Net Total",
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "total_net_weight",
@@ -981,9 +850,7 @@
    "hide_seconds": 1,
    "label": "Total Net Weight",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "taxes_section",
@@ -991,9 +858,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "oldfieldtype": "Section Break",
-   "options": "fa fa-money",
-   "show_days": 1,
-   "show_seconds": 1
+   "options": "fa fa-money"
   },
   {
    "fieldname": "taxes_and_charges",
@@ -1004,17 +869,13 @@
    "oldfieldname": "charge",
    "oldfieldtype": "Link",
    "options": "Sales Taxes and Charges Template",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "column_break_38",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "fieldname": "shipping_rule",
@@ -1024,9 +885,7 @@
    "label": "Shipping Rule",
    "oldfieldtype": "Button",
    "options": "Shipping Rule",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "tax_category",
@@ -1035,17 +894,13 @@
    "hide_seconds": 1,
    "label": "Tax Category",
    "options": "Tax Category",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "section_break_40",
    "fieldtype": "Section Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "fieldname": "taxes",
@@ -1055,9 +910,7 @@
    "label": "Sales Taxes and Charges",
    "oldfieldname": "other_charges",
    "oldfieldtype": "Table",
-   "options": "Sales Taxes and Charges",
-   "show_days": 1,
-   "show_seconds": 1
+   "options": "Sales Taxes and Charges"
   },
   {
    "collapsible": 1,
@@ -1065,9 +918,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Tax Breakup",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Tax Breakup"
   },
   {
    "fieldname": "other_charges_calculation",
@@ -1078,17 +929,13 @@
    "no_copy": 1,
    "oldfieldtype": "HTML",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "section_break_43",
    "fieldtype": "Section Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "fieldname": "base_total_taxes_and_charges",
@@ -1100,17 +947,13 @@
    "oldfieldtype": "Currency",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "column_break_47",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "fieldname": "total_taxes_and_charges",
@@ -1120,9 +963,7 @@
    "label": "Total Taxes and Charges",
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "collapsible": 1,
@@ -1130,9 +971,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Loyalty Points Redemption",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Loyalty Points Redemption"
   },
   {
    "depends_on": "redeem_loyalty_points",
@@ -1142,9 +981,7 @@
    "hide_seconds": 1,
    "label": "Loyalty Points",
    "no_copy": 1,
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "depends_on": "redeem_loyalty_points",
@@ -1156,9 +993,7 @@
    "no_copy": 1,
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "default": "0",
@@ -1168,17 +1003,13 @@
    "hide_seconds": 1,
    "label": "Redeem Loyalty Points",
    "no_copy": 1,
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "column_break_77",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "fetch_from": "customer.loyalty_program",
@@ -1190,9 +1021,7 @@
    "no_copy": 1,
    "options": "Loyalty Program",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "depends_on": "redeem_loyalty_points",
@@ -1202,9 +1031,7 @@
    "hide_seconds": 1,
    "label": "Redemption Account",
    "no_copy": 1,
-   "options": "Account",
-   "show_days": 1,
-   "show_seconds": 1
+   "options": "Account"
   },
   {
    "depends_on": "redeem_loyalty_points",
@@ -1214,9 +1041,7 @@
    "hide_seconds": 1,
    "label": "Redemption Cost Center",
    "no_copy": 1,
-   "options": "Cost Center",
-   "show_days": 1,
-   "show_seconds": 1
+   "options": "Cost Center"
   },
   {
    "collapsible": 1,
@@ -1225,9 +1050,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Additional Discount",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Additional Discount"
   },
   {
    "default": "Grand Total",
@@ -1237,9 +1060,7 @@
    "hide_seconds": 1,
    "label": "Apply Additional Discount On",
    "options": "\nGrand Total\nNet Total",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "base_discount_amount",
@@ -1249,17 +1070,13 @@
    "label": "Additional Discount Amount (Company Currency)",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "column_break_51",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "fieldname": "additional_discount_percentage",
@@ -1267,9 +1084,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Additional Discount Percentage",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "discount_amount",
@@ -1278,9 +1093,7 @@
    "hide_seconds": 1,
    "label": "Additional Discount Amount",
    "options": "currency",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "totals",
@@ -1289,9 +1102,7 @@
    "hide_seconds": 1,
    "oldfieldtype": "Section Break",
    "options": "fa fa-money",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "base_grand_total",
@@ -1304,9 +1115,7 @@
    "options": "Company:company:default_currency",
    "print_hide": 1,
    "read_only": 1,
-   "reqd": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "reqd": 1
   },
   {
    "depends_on": "eval:!doc.disable_rounded_total",
@@ -1318,9 +1127,7 @@
    "no_copy": 1,
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "depends_on": "eval:!doc.disable_rounded_total",
@@ -1333,9 +1140,7 @@
    "oldfieldtype": "Currency",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "description": "In Words will be visible once you save the Sales Invoice.",
@@ -1348,9 +1153,7 @@
    "oldfieldname": "in_words",
    "oldfieldtype": "Data",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "column_break5",
@@ -1359,8 +1162,6 @@
    "hide_seconds": 1,
    "oldfieldtype": "Column Break",
    "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1,
    "width": "50%"
   },
   {
@@ -1375,9 +1176,7 @@
    "oldfieldtype": "Currency",
    "options": "currency",
    "read_only": 1,
-   "reqd": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "reqd": 1
   },
   {
    "depends_on": "eval:!doc.disable_rounded_total",
@@ -1389,9 +1188,7 @@
    "no_copy": 1,
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "bold": 1,
@@ -1404,9 +1201,7 @@
    "oldfieldname": "rounded_total_export",
    "oldfieldtype": "Currency",
    "options": "currency",
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "in_words",
@@ -1418,9 +1213,7 @@
    "oldfieldname": "in_words_export",
    "oldfieldtype": "Data",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "total_advance",
@@ -1432,9 +1225,7 @@
    "oldfieldtype": "Currency",
    "options": "party_account_currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "outstanding_amount",
@@ -1447,9 +1238,7 @@
    "oldfieldtype": "Currency",
    "options": "party_account_currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "collapsible": 1,
@@ -1461,9 +1250,7 @@
    "label": "Advance Payments",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "default": "0",
@@ -1471,9 +1258,7 @@
    "fieldtype": "Check",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Allocate Advances Automatically (FIFO)",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Allocate Advances Automatically (FIFO)"
   },
   {
    "depends_on": "eval:!doc.allocate_advances_automatically",
@@ -1482,9 +1267,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Get Advances Received",
-   "options": "set_advances",
-   "show_days": 1,
-   "show_seconds": 1
+   "options": "set_advances"
   },
   {
    "fieldname": "advances",
@@ -1495,9 +1278,7 @@
    "oldfieldname": "advance_adjustment_details",
    "oldfieldtype": "Table",
    "options": "Sales Invoice Advance",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "collapsible": 1,
@@ -1506,9 +1287,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Payment Terms",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Payment Terms"
   },
   {
    "depends_on": "eval:(!doc.is_pos && !doc.is_return)",
@@ -1519,9 +1298,7 @@
    "label": "Payment Terms Template",
    "no_copy": 1,
    "options": "Payment Terms Template",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "depends_on": "eval:(!doc.is_pos && !doc.is_return)",
@@ -1532,9 +1309,7 @@
    "label": "Payment Schedule",
    "no_copy": 1,
    "options": "Payment Schedule",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)",
@@ -1543,9 +1318,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Payments",
-   "options": "fa fa-money",
-   "show_days": 1,
-   "show_seconds": 1
+   "options": "fa fa-money"
   },
   {
    "depends_on": "is_pos",
@@ -1558,9 +1331,7 @@
    "oldfieldname": "cash_bank_account",
    "oldfieldtype": "Link",
    "options": "Account",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "depends_on": "eval:doc.is_pos===1",
@@ -1570,17 +1341,13 @@
    "hide_seconds": 1,
    "label": "Sales Invoice Payment",
    "options": "Sales Invoice Payment",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "section_break_84",
    "fieldtype": "Section Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "fieldname": "base_paid_amount",
@@ -1591,17 +1358,13 @@
    "no_copy": 1,
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "column_break_86",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "depends_on": "eval: doc.is_pos || doc.redeem_loyalty_points",
@@ -1615,17 +1378,13 @@
    "oldfieldtype": "Currency",
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "section_break_88",
    "fieldtype": "Section Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "depends_on": "is_pos",
@@ -1637,17 +1396,13 @@
    "no_copy": 1,
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "column_break_90",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "depends_on": "is_pos",
@@ -1658,9 +1413,7 @@
    "label": "Change Amount",
    "no_copy": 1,
    "options": "currency",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "depends_on": "is_pos",
@@ -1670,9 +1423,7 @@
    "hide_seconds": 1,
    "label": "Account for Change Amount",
    "options": "Account",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "collapsible": 1,
@@ -1683,8 +1434,6 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Write Off",
-   "show_days": 1,
-   "show_seconds": 1,
    "width": "50%"
   },
   {
@@ -1696,8 +1445,7 @@
    "no_copy": 1,
    "options": "currency",
    "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only_depends_on": "eval:doc.write_off_outstanding_amount_automatically"
   },
   {
    "fieldname": "base_write_off_amount",
@@ -1708,9 +1456,7 @@
    "no_copy": 1,
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "default": "0",
@@ -1720,17 +1466,13 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Write Off Outstanding Amount",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "column_break_74",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "fieldname": "write_off_account",
@@ -1739,9 +1481,7 @@
    "hide_seconds": 1,
    "label": "Write Off Account",
    "options": "Account",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "write_off_cost_center",
@@ -1750,9 +1490,7 @@
    "hide_seconds": 1,
    "label": "Write Off Cost Center",
    "options": "Cost Center",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "collapsible": 1,
@@ -1762,9 +1500,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Terms and Conditions",
-   "oldfieldtype": "Section Break",
-   "show_days": 1,
-   "show_seconds": 1
+   "oldfieldtype": "Section Break"
   },
   {
    "fieldname": "tc_name",
@@ -1775,9 +1511,7 @@
    "oldfieldname": "tc_name",
    "oldfieldtype": "Link",
    "options": "Terms and Conditions",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "terms",
@@ -1786,9 +1520,7 @@
    "hide_seconds": 1,
    "label": "Terms and Conditions Details",
    "oldfieldname": "terms",
-   "oldfieldtype": "Text Editor",
-   "show_days": 1,
-   "show_seconds": 1
+   "oldfieldtype": "Text Editor"
   },
   {
    "collapsible": 1,
@@ -1796,9 +1528,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Printing Settings",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Printing Settings"
   },
   {
    "allow_on_submit": 1,
@@ -1810,9 +1540,7 @@
    "oldfieldname": "letter_head",
    "oldfieldtype": "Select",
    "options": "Letter Head",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "allow_on_submit": 1,
@@ -1822,9 +1550,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Group same items",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "language",
@@ -1833,17 +1559,13 @@
    "hide_seconds": 1,
    "label": "Print Language",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "column_break_84",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -1857,9 +1579,7 @@
    "oldfieldtype": "Link",
    "options": "Print Heading",
    "print_hide": 1,
-   "report_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "report_hide": 1
   },
   {
    "collapsible": 1,
@@ -1868,9 +1588,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "More Information",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "More Information"
   },
   {
    "fieldname": "inter_company_invoice_reference",
@@ -1879,9 +1597,7 @@
    "hide_seconds": 1,
    "label": "Inter Company Invoice Reference",
    "options": "Purchase Invoice",
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "customer_group",
@@ -1891,9 +1607,7 @@
    "hide_seconds": 1,
    "label": "Customer Group",
    "options": "Customer Group",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "campaign",
@@ -1904,9 +1618,7 @@
    "oldfieldname": "campaign",
    "oldfieldtype": "Link",
    "options": "Campaign",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "default": "0",
@@ -1916,17 +1628,13 @@
    "hide_seconds": 1,
    "label": "Is Discounted",
    "no_copy": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "col_break23",
    "fieldtype": "Column Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1,
    "width": "50%"
   },
   {
@@ -1940,9 +1648,7 @@
    "no_copy": 1,
    "options": "\nDraft\nReturn\nCredit Note Issued\nSubmitted\nPaid\nUnpaid\nUnpaid and Discounted\nOverdue and Discounted\nOverdue\nCancelled\nInternal Transfer",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "source",
@@ -1953,9 +1659,7 @@
    "oldfieldname": "source",
    "oldfieldtype": "Select",
    "options": "Lead Source",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "collapsible": 1,
@@ -1966,9 +1670,7 @@
    "label": "Accounting Details",
    "oldfieldtype": "Section Break",
    "options": "fa fa-file-text",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "debit_to",
@@ -1981,9 +1683,7 @@
    "options": "Account",
    "print_hide": 1,
    "reqd": 1,
-   "search_index": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "search_index": 1
   },
   {
    "fieldname": "party_account_currency",
@@ -1995,9 +1695,7 @@
    "no_copy": 1,
    "options": "Currency",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "default": "No",
@@ -2009,9 +1707,7 @@
    "oldfieldname": "is_opening",
    "oldfieldtype": "Select",
    "options": "No\nYes",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "c_form_applicable",
@@ -2021,9 +1717,7 @@
    "label": "C-Form Applicable",
    "no_copy": 1,
    "options": "No\nYes",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "c_form_no",
@@ -2034,9 +1728,7 @@
    "no_copy": 1,
    "options": "C-Form",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "column_break8",
@@ -2044,9 +1736,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "oldfieldtype": "Column Break",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "remarks",
@@ -2057,9 +1747,7 @@
    "no_copy": 1,
    "oldfieldname": "remarks",
    "oldfieldtype": "Text",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "collapsible": 1,
@@ -2071,9 +1759,7 @@
    "label": "Commission",
    "oldfieldtype": "Section Break",
    "options": "fa fa-group",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "sales_partner",
@@ -2084,9 +1770,7 @@
    "oldfieldname": "sales_partner",
    "oldfieldtype": "Link",
    "options": "Sales Partner",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "column_break10",
@@ -2095,8 +1779,6 @@
    "hide_seconds": 1,
    "oldfieldtype": "Column Break",
    "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1,
    "width": "50%"
   },
   {
@@ -2107,9 +1789,7 @@
    "label": "Commission Rate (%)",
    "oldfieldname": "commission_rate",
    "oldfieldtype": "Currency",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "total_commission",
@@ -2120,9 +1800,7 @@
    "oldfieldname": "total_commission",
    "oldfieldtype": "Currency",
    "options": "Company:company:default_currency",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "collapsible": 1,
@@ -2132,9 +1810,7 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Sales Team",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "allow_on_submit": 1,
@@ -2146,9 +1822,7 @@
    "oldfieldname": "sales_team",
    "oldfieldtype": "Table",
    "options": "Sales Team",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "collapsible": 1,
@@ -2156,9 +1830,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Subscription Section",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Subscription Section"
   },
   {
    "allow_on_submit": 1,
@@ -2168,9 +1840,7 @@
    "hide_seconds": 1,
    "label": "From Date",
    "no_copy": 1,
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "allow_on_submit": 1,
@@ -2180,17 +1850,13 @@
    "hide_seconds": 1,
    "label": "To Date",
    "no_copy": 1,
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "column_break_140",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -2202,9 +1868,7 @@
    "no_copy": 1,
    "options": "Auto Repeat",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "allow_on_submit": 1,
@@ -2213,9 +1877,7 @@
    "fieldtype": "Button",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Update Auto Repeat Reference",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Update Auto Repeat Reference"
   },
   {
    "fieldname": "against_income_account",
@@ -2228,9 +1890,7 @@
    "oldfieldname": "against_income_account",
    "oldfieldtype": "Small Text",
    "print_hide": 1,
-   "report_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "report_hide": 1
   },
   {
    "collapsible": 1,
@@ -2238,17 +1898,13 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Accounting Dimensions",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Accounting Dimensions"
   },
   {
    "fieldname": "dimension_col_break",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "hide_seconds": 1
   },
   {
    "default": "0",
@@ -2256,9 +1912,7 @@
    "fieldname": "is_consolidated",
    "fieldtype": "Check",
    "label": "Is Consolidated",
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "default": "0",
@@ -2268,28 +1922,23 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Is Internal Customer",
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fetch_from": "company.tax_id",
    "fieldname": "company_tax_id",
    "fieldtype": "Data",
    "label": "Company Tax ID",
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "depends_on": "eval:doc.is_internal_customer",
    "description": "Unrealized Profit / Loss account for intra-company transfers",
    "fieldname": "unrealized_profit_loss_account",
    "fieldtype": "Link",
+   "ignore_user_permissions": 1,
    "label": "Unrealized Profit / Loss Account",
-   "options": "Account",
-   "show_days": 1,
-   "show_seconds": 1
+   "options": "Account"
   },
   {
    "depends_on": "eval:doc.is_internal_customer",
@@ -2299,41 +1948,32 @@
    "fieldtype": "Link",
    "label": "Represents Company",
    "options": "Company",
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "column_break_55",
-   "fieldtype": "Column Break",
-   "show_days": 1,
-   "show_seconds": 1
+   "fieldtype": "Column Break"
   },
   {
    "depends_on": "eval: doc.is_internal_customer && doc.update_stock",
    "fieldname": "set_target_warehouse",
    "fieldtype": "Link",
+   "ignore_user_permissions": 1,
    "label": "Set Target Warehouse",
-   "options": "Warehouse",
-   "show_days": 1,
-   "show_seconds": 1
+   "options": "Warehouse"
   },
   {
    "default": "0",
    "fieldname": "is_debit_note",
    "fieldtype": "Check",
-   "label": "Is Debit Note",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Is Debit Note"
   },
   {
    "default": "0",
    "depends_on": "grand_total",
    "fieldname": "disable_rounded_total",
    "fieldtype": "Check",
-   "label": "Disable Rounded Total",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Disable Rounded Total"
   },
   {
    "fieldname": "additional_discount_account",
@@ -2362,9 +2002,7 @@
    "fieldtype": "Check",
    "hidden": 1,
    "label": "Ignore Default Payment Terms Template",
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   }
  ],
  "icon": "fa fa-file-text",
@@ -2377,7 +2015,7 @@
    "link_fieldname": "consolidated_invoice"
   }
  ],
- "modified": "2021-08-07 23:02:20.445127",
+ "modified": "2021-08-18 16:07:45.122570",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Sales Invoice",
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 5424ef3..1cf0df0 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -285,8 +285,6 @@
 
 	def before_cancel(self):
 		self.check_if_consolidated_invoice()
-
-		super(SalesInvoice, self).before_cancel()
 		self.update_time_sheet(None)
 
 	def on_cancel(self):
@@ -478,6 +476,9 @@
 		if cint(self.is_pos) != 1:
 			return
 
+		if not self.account_for_change_amount:
+			self.account_for_change_amount = frappe.get_cached_value('Company',  self.company,  'default_cash_account')
+
 		from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile
 		if not self.pos_profile:
 			pos_profile = get_pos_profile(self.company) or {}
@@ -492,9 +493,6 @@
 		if not self.get('payments') and not for_validate:
 			update_multi_mode_option(self, pos)
 
-		if not self.account_for_change_amount:
-			self.account_for_change_amount = frappe.get_cached_value('Company',  self.company,  'default_cash_account')
-
 		if pos:
 			if not for_validate:
 				self.tax_category = pos.get("tax_category")
@@ -1463,7 +1461,7 @@
 
 		discounting_status = None
 		if self.is_discounted:
-			discountng_status = get_discounting_status(self.name)
+			discounting_status = get_discounting_status(self.name)
 
 		if not status:
 			if self.docstatus == 2:
@@ -1471,11 +1469,11 @@
 			elif self.docstatus == 1:
 				if self.is_internal_transfer():
 					self.status = 'Internal Transfer'
-				elif outstanding_amount > 0 and due_date < nowdate and self.is_discounted and discountng_status=='Disbursed':
+				elif outstanding_amount > 0 and due_date < nowdate and self.is_discounted and discounting_status=='Disbursed':
 					self.status = "Overdue and Discounted"
 				elif outstanding_amount > 0 and due_date < nowdate:
 					self.status = "Overdue"
-				elif outstanding_amount > 0 and due_date >= nowdate and self.is_discounted and discountng_status=='Disbursed':
+				elif outstanding_amount > 0 and due_date >= nowdate and self.is_discounted and discounting_status=='Disbursed':
 					self.status = "Unpaid and Discounted"
 				elif outstanding_amount > 0 and due_date >= nowdate:
 					self.status = "Unpaid"
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py
index f106928..3238ead 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py
@@ -33,4 +33,4 @@
 				'items': ['Auto Repeat']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 4d1e0c3..c3d83c7 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -26,6 +26,7 @@
 from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
 from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_invoice
 from erpnext.stock.utils import get_incoming_rate
+from erpnext.accounts.utils import PaymentEntryUnlinkError
 
 class TestSalesInvoice(unittest.TestCase):
 	def make(self):
@@ -136,7 +137,7 @@
 		pe.paid_to_account_currency = si.currency
 		pe.source_exchange_rate = 1
 		pe.target_exchange_rate = 1
-		pe.paid_amount = si.grand_total
+		pe.paid_amount = si.outstanding_amount
 		pe.insert()
 		pe.submit()
 
@@ -145,6 +146,42 @@
 		self.assertRaises(frappe.LinkExistsError, si.cancel)
 		unlink_payment_on_cancel_of_invoice()
 
+	def test_payment_entry_unlink_against_standalone_credit_note(self):
+		from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
+		si1 = create_sales_invoice(rate=1000)
+		si2 = create_sales_invoice(rate=300)
+		si3 = create_sales_invoice(qty=-1, rate=300, is_return=1)
+		
+
+		pe = get_payment_entry("Sales Invoice", si1.name, bank_account="_Test Bank - _TC")
+		pe.append('references', {
+			'reference_doctype': 'Sales Invoice',
+			'reference_name': si2.name,
+			'total_amount': si2.grand_total,
+			'outstanding_amount': si2.outstanding_amount,
+			'allocated_amount': si2.outstanding_amount
+		})
+
+		pe.append('references', {
+			'reference_doctype': 'Sales Invoice',
+			'reference_name': si3.name,
+			'total_amount': si3.grand_total,
+			'outstanding_amount': si3.outstanding_amount,
+			'allocated_amount': si3.outstanding_amount
+		})
+
+		pe.reference_no = 'Test001'
+		pe.reference_date = nowdate()
+		pe.save()
+		pe.submit()
+
+		si2.load_from_db()
+		si2.cancel()
+
+		si1.load_from_db()
+		self.assertRaises(PaymentEntryUnlinkError, si1.cancel)
+
+
 	def test_sales_invoice_calculation_export_currency(self):
 		si = frappe.copy_doc(test_records[2])
 		si.currency = "USD"
@@ -2014,7 +2051,7 @@
 
 		data = get_ewb_data("Sales Invoice", [si.name])
 
-		self.assertEqual(data['version'], '1.0.1118')
+		self.assertEqual(data['version'], '1.0.0421')
 		self.assertEqual(data['billLists'][0]['fromGstin'], '27AAECE4835E1ZR')
 		self.assertEqual(data['billLists'][0]['fromTrdName'], '_Test Company')
 		self.assertEqual(data['billLists'][0]['toTrdName'], '_Test Customer')
@@ -2027,54 +2064,6 @@
 		self.assertEqual(data['billLists'][0]['actualFromStateCode'],7)
 		self.assertEqual(data['billLists'][0]['fromStateCode'],27)
 
-	def test_einvoice_submission_without_irn(self):
-		# init
-		einvoice_settings = frappe.get_doc('E Invoice Settings')
-		einvoice_settings.enable = 1
-		einvoice_settings.applicable_from = nowdate()
-		einvoice_settings.append('credentials', {
-			'company': '_Test Company',
-			'gstin': '27AAECE4835E1ZR',
-			'username': 'test',
-			'password': 'test'
-		})
-		einvoice_settings.save()
-
-		country = frappe.flags.country
-		frappe.flags.country = 'India'
-
-		si = make_sales_invoice_for_ewaybill()
-		self.assertRaises(frappe.ValidationError, si.submit)
-
-		si.irn = 'test_irn'
-		si.submit()
-
-		# reset
-		einvoice_settings = frappe.get_doc('E Invoice Settings')
-		einvoice_settings.enable = 0
-		frappe.flags.country = country
-
-	def test_einvoice_json(self):
-		from erpnext.regional.india.e_invoice.utils import make_einvoice, validate_totals
-
-		si = get_sales_invoice_for_e_invoice()
-		si.discount_amount = 100
-		si.save()
-
-		einvoice = make_einvoice(si)
-		self.assertTrue(einvoice['EwbDtls'])
-		validate_totals(einvoice)
-
-		si.apply_discount_on = 'Net Total'
-		si.save()
-		einvoice = make_einvoice(si)
-		validate_totals(einvoice)
-
-		[d.set('included_in_print_rate', 1) for d in si.taxes]
-		si.save()
-		einvoice = make_einvoice(si)
-		validate_totals(einvoice)
-
 	def test_item_tax_net_range(self):
 		item = create_item("T Shirt")
 
diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice.js
index e12ac03..61d78e1 100644
--- a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice.js
@@ -40,4 +40,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js
index f1cb22a..cf2d0fb 100644
--- a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js
+++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js
@@ -33,4 +33,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js
index 651bf0a..45d9a14 100644
--- a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js
+++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js
@@ -54,4 +54,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment_request.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment_request.js
index b959cf9..0464e45 100644
--- a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment_request.js
+++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment_request.js
@@ -49,4 +49,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js
index 2697758..af484d7 100644
--- a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js
+++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js
@@ -42,4 +42,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.py b/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.py
index 1ec5179..28aeef4 100644
--- a/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.py
+++ b/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class SalesInvoiceAdvance(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.py b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.py
index 8d1df5c..b1de9d8 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.py
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class SalesTaxesandCharges(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py
index d825c6f..522e282 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py
@@ -21,4 +21,4 @@
 				'items': ['POS Profile', 'Subscription', 'Restaurant', 'Tax Rule']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.js b/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.js
index d02e70b..8cd42f6 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.js
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.js
@@ -26,4 +26,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/accounts/doctype/share_transfer/share_transfer.js b/erpnext/accounts/doctype/share_transfer/share_transfer.js
index 1cad4df..6317c9c 100644
--- a/erpnext/accounts/doctype/share_transfer/share_transfer.js
+++ b/erpnext/accounts/doctype/share_transfer/share_transfer.js
@@ -115,4 +115,4 @@
 			frappe.set_route("Form", doc.doctype, doc.name);
 		}
 	});
-};
\ No newline at end of file
+};
diff --git a/erpnext/accounts/doctype/share_transfer/share_transfer.py b/erpnext/accounts/doctype/share_transfer/share_transfer.py
index 4024b81..3d4543f 100644
--- a/erpnext/accounts/doctype/share_transfer/share_transfer.py
+++ b/erpnext/accounts/doctype/share_transfer/share_transfer.py
@@ -299,4 +299,4 @@
 		"party": credit_applicant,
 		})
 	journal_entry.set("accounts", account_amt_list)
-	return journal_entry.as_dict()
\ No newline at end of file
+	return journal_entry.as_dict()
diff --git a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.js b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.js
index 0201f76..63ea1bf 100644
--- a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.js
+++ b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.js
@@ -34,4 +34,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/accounts/doctype/shipping_rule/tests/test_shipping_rule_for_buying.js b/erpnext/accounts/doctype/shipping_rule/tests/test_shipping_rule_for_buying.js
index ab1b77c..f3668b8 100644
--- a/erpnext/accounts/doctype/shipping_rule/tests/test_shipping_rule_for_buying.js
+++ b/erpnext/accounts/doctype/shipping_rule/tests/test_shipping_rule_for_buying.js
@@ -34,4 +34,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.py b/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.py
index dab59db..db6ef11 100644
--- a/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.py
+++ b/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.py
@@ -9,4 +9,4 @@
 from frappe.model.document import Document
 
 class ShippingRuleCondition(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/accounts/doctype/subscription/subscription_list.js b/erpnext/accounts/doctype/subscription/subscription_list.js
index c7325fb..6490ff3 100644
--- a/erpnext/accounts/doctype/subscription/subscription_list.js
+++ b/erpnext/accounts/doctype/subscription/subscription_list.js
@@ -14,4 +14,4 @@
 			return [__("Cancelled"), "gray"];
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/accounts/doctype/subscription/test_subscription.py b/erpnext/accounts/doctype/subscription/test_subscription.py
index 7c58e98..4f2cf48 100644
--- a/erpnext/accounts/doctype/subscription/test_subscription.py
+++ b/erpnext/accounts/doctype/subscription/test_subscription.py
@@ -630,5 +630,3 @@
 
 		subscription.process()
 		self.assertEqual(len(subscription.invoices), 1)
-
-
diff --git a/erpnext/accounts/doctype/subscription_plan/subscription_plan.js b/erpnext/accounts/doctype/subscription_plan/subscription_plan.js
index aaa32cf..7d6f2ae 100644
--- a/erpnext/accounts/doctype/subscription_plan/subscription_plan.js
+++ b/erpnext/accounts/doctype/subscription_plan/subscription_plan.js
@@ -6,4 +6,4 @@
 		frm.toggle_reqd("cost", frm.doc.price_determination === 'Fixed rate');
 		frm.toggle_reqd("price_list", frm.doc.price_determination === 'Based on price list');
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/subscription_plan/subscription_plan.py b/erpnext/accounts/doctype/subscription_plan/subscription_plan.py
index 1ca442a..a341c2a 100644
--- a/erpnext/accounts/doctype/subscription_plan/subscription_plan.py
+++ b/erpnext/accounts/doctype/subscription_plan/subscription_plan.py
@@ -54,4 +54,4 @@
 
 			cost -= (plan.cost * prorate_factor)
 
-		return cost
\ No newline at end of file
+		return cost
diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.py b/erpnext/accounts/doctype/tax_rule/tax_rule.py
index e4ebc6d..5814231 100644
--- a/erpnext/accounts/doctype/tax_rule/tax_rule.py
+++ b/erpnext/accounts/doctype/tax_rule/tax_rule.py
@@ -188,4 +188,4 @@
 	customer_groups = ["%s"%(frappe.db.escape(d.name)) for d in get_parent_customer_groups(customer_group)]
 	if customer_groups:
 		condition = ",".join(['%s'] * len(customer_groups))%(tuple(customer_groups))
-	return condition
\ No newline at end of file
+	return condition
diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
index 481ef28..1536a23 100644
--- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
+++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
@@ -240,7 +240,7 @@
 def get_tds_amount(ldc, parties, inv, tax_details, fiscal_year_details, tax_deducted, vouchers):
 	tds_amount = 0
 	invoice_filters = {
-		'name': ('in', vouchers), 
+		'name': ('in', vouchers),
 		'docstatus': 1
 	}
 
@@ -282,7 +282,7 @@
 			tds_amount = get_ltds_amount(supp_credit_amt, 0, ldc.certificate_limit, ldc.rate, tax_details)
 		else:
 			tds_amount = supp_credit_amt * tax_details.rate / 100 if supp_credit_amt > 0 else 0
-	
+
 	if cint(tax_details.round_off_tax_amount):
 		tds_amount = round(tds_amount)
 
diff --git a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py
index 2ba22ca..1c687e5 100644
--- a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py
+++ b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py
@@ -97,7 +97,7 @@
 		pi.save()
 		pi.submit()
 		invoices.append(pi)
-		
+
 		# Second Invoice will apply TDS checked
 		pi1 = create_purchase_invoice(supplier = "Test TDS Supplier3", rate = 20000)
 		pi1.submit()
diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py
index 4c7c567..3126138 100644
--- a/erpnext/accounts/general_ledger.py
+++ b/erpnext/accounts/general_ledger.py
@@ -101,7 +101,7 @@
 
 def check_if_in_list(gle, gl_map, dimensions=None):
 	account_head_fieldnames = ['voucher_detail_no', 'party', 'against_voucher',
-			'cost_center', 'against_voucher_type', 'party_type', 'project']
+			'cost_center', 'against_voucher_type', 'party_type', 'project', 'finance_book']
 
 	if dimensions:
 		account_head_fieldnames = account_head_fieldnames + dimensions
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 329f9a9..de7dde9 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -286,6 +286,7 @@
 			.format(frappe.bold(party_type), frappe.bold(party), frappe.bold(existing_gle_currency), frappe.bold(company)), InvalidAccountCurrency)
 
 def validate_party_accounts(doc):
+
 	companies = []
 
 	for account in doc.get("accounts"):
@@ -446,6 +447,10 @@
 	return template
 
 def validate_party_frozen_disabled(party_type, party_name):
+
+	if frappe.flags.ignore_party_validation:
+		return
+
 	if party_type and party_name:
 		if party_type in ("Customer", "Supplier"):
 			party = frappe.get_cached_value(party_type, party_name, ["is_frozen", "disabled"], as_dict=True)
diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html
index e588ed6..4ac657d 100644
--- a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html
+++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html
@@ -73,4 +73,4 @@
             </tr>
         </table>
     <div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json
index e3afaec..9e126ba 100644
--- a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json
+++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json
@@ -16,7 +16,7 @@
  "name": "Bank and Cash Payment Voucher", 
  "owner": "Administrator", 
  "print_format_builder": 0, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/cheque_printing_format/cheque_printing_format.json b/erpnext/accounts/print_format/cheque_printing_format/cheque_printing_format.json
index 8c9c266..08b8ef8 100755
--- a/erpnext/accounts/print_format/cheque_printing_format/cheque_printing_format.json
+++ b/erpnext/accounts/print_format/cheque_printing_format/cheque_printing_format.json
@@ -10,6 +10,6 @@
  "modified_by": "Administrator", 
  "name": "Cheque Printing Format", 
  "owner": "Administrator", 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/credit_note/credit_note.json b/erpnext/accounts/print_format/credit_note/credit_note.json
index c5a11cf..d12b872 100644
--- a/erpnext/accounts/print_format/credit_note/credit_note.json
+++ b/erpnext/accounts/print_format/credit_note/credit_note.json
@@ -17,7 +17,7 @@
  "owner": "Administrator",
  "parentfield": "__print_formats",
  "print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
  "show_section_headings": 0,
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/gst_e_invoice/__init__.py b/erpnext/accounts/print_format/gst_e_invoice/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/print_format/gst_e_invoice/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/print_format/gst_e_invoice/gst_e_invoice.html b/erpnext/accounts/print_format/gst_e_invoice/gst_e_invoice.html
deleted file mode 100644
index 71c26e8..0000000
--- a/erpnext/accounts/print_format/gst_e_invoice/gst_e_invoice.html
+++ /dev/null
@@ -1,162 +0,0 @@
-{%- from "templates/print_formats/standard_macros.html" import add_header, render_field, print_value -%}
-{%- set einvoice = json.loads(doc.signed_einvoice) -%}
-
-<div class="page-break">
-	<div {% if print_settings.repeat_header_footer %} id="header-html" class="hidden-pdf" {% endif %}>
-		{% if letter_head and not no_letterhead %}
-			<div class="letter-head">{{ letter_head }}</div>
-		{% endif %}
-		<div class="print-heading">
-			<h2>E Invoice<br><small>{{ doc.name }}</small></h2>
-		</div>
-	</div>
-	{% if print_settings.repeat_header_footer %}
-	<div id="footer-html" class="visible-pdf">
-		{% if not no_letterhead and footer %}
-		<div class="letter-head-footer">
-			{{ footer }}
-		</div>
-		{% endif %}
-		<p class="text-center small page-number visible-pdf">
-			{{ _("Page {0} of {1}").format('<span class="page"></span>', '<span class="topage"></span>') }}
-		</p>
-	</div>
-	{% endif %}
-	<h5 class="font-bold" style="margin-top: 0px;">1. Transaction Details</h5>
-	<div class="row section-break" style="border-bottom: 1px solid #d1d8dd; padding-bottom: 10px;">
-		<div class="col-xs-8 column-break">
-			<div class="row data-field">
-				<div class="col-xs-4"><label>IRN</label></div>
-				<div class="col-xs-8 value">{{ einvoice.Irn }}</div>
-			</div>
-			<div class="row data-field">
-				<div class="col-xs-4"><label>Ack. No</label></div>
-				<div class="col-xs-8 value">{{ einvoice.AckNo }}</div>
-			</div>
-			<div class="row data-field">
-				<div class="col-xs-4"><label>Ack. Date</label></div>
-				<div class="col-xs-8 value">{{ frappe.utils.format_datetime(einvoice.AckDt, "dd/MM/yyyy hh:mm:ss") }}</div>
-			</div>
-			<div class="row data-field">
-				<div class="col-xs-4"><label>Category</label></div>
-				<div class="col-xs-8 value">{{ einvoice.TranDtls.SupTyp }}</div>
-			</div>
-			<div class="row data-field">
-				<div class="col-xs-4"><label>Document Type</label></div>
-				<div class="col-xs-8 value">{{ einvoice.DocDtls.Typ }}</div>
-			</div>
-			<div class="row data-field">
-				<div class="col-xs-4"><label>Document No</label></div>
-				<div class="col-xs-8 value">{{ einvoice.DocDtls.No }}</div>
-			</div>
-		</div>
-		<div class="col-xs-4 column-break">
-			<img src="{{ doc.qrcode_image }}" width="175px" style="float: right;">
-		</div>
-	</div>
-	<h5 class="font-bold" style="margin-top: 15px; margin-bottom: 10px;">2. Party Details</h5>
-	<div class="row section-break" style="border-bottom: 1px solid #d1d8dd; padding-bottom: 10px;">
-		{%- set seller = einvoice.SellerDtls -%}
-		<div class="col-xs-6 column-break">
-			<h5 style="margin-bottom: 5px;">Seller</h5>
-			<p>{{ seller.Gstin }}</p>
-			<p>{{ seller.LglNm }}</p>
-			<p>{{ seller.Addr1 }}</p>
-			{%- if seller.Addr2 -%} <p>{{ seller.Addr2 }}</p> {% endif %}
-			<p>{{ seller.Loc }}</p>
-			<p>{{ frappe.db.get_value("Address", doc.company_address, "gst_state") }} - {{ seller.Pin }}</p>
-
-			{%- if einvoice.ShipDtls -%}
-				{%- set shipping = einvoice.ShipDtls -%}
-				<h5 style="margin-bottom: 5px;">Shipping</h5>
-				<p>{{ shipping.Gstin }}</p>
-				<p>{{ shipping.LglNm }}</p>
-				<p>{{ shipping.Addr1 }}</p>
-				{%- if shipping.Addr2 -%} <p>{{ shipping.Addr2 }}</p> {% endif %}
-				<p>{{ shipping.Loc }}</p>
-				<p>{{ frappe.db.get_value("Address", doc.shipping_address_name, "gst_state") }} - {{ shipping.Pin }}</p>
-			{% endif %}
-		</div>
-		{%- set buyer = einvoice.BuyerDtls -%}
-		<div class="col-xs-6 column-break">
-			<h5 style="margin-bottom: 5px;">Buyer</h5>
-			<p>{{ buyer.Gstin }}</p>
-			<p>{{ buyer.LglNm }}</p>
-			<p>{{ buyer.Addr1 }}</p>
-			{%- if buyer.Addr2 -%} <p>{{ buyer.Addr2 }}</p> {% endif %}
-			<p>{{ buyer.Loc }}</p>
-			<p>{{ frappe.db.get_value("Address", doc.customer_address, "gst_state") }} - {{ buyer.Pin }}</p>
-		</div>
-	</div>
-	<div style="overflow-x: auto;">
-		<h5 class="font-bold" style="margin-top: 15px; margin-bottom: 10px;">3. Item Details</h5>
-		<table class="table table-bordered">
-			<thead>
-				<tr>
-					<th class="text-left" style="width: 3%;">Sr. No.</th>
-					<th class="text-left">Item</th>
-					<th class="text-left" style="width: 10%;">HSN Code</th>
-					<th class="text-left" style="width: 5%;">Qty</th>
-					<th class="text-left" style="width: 5%;">UOM</th>
-					<th class="text-left">Rate</th>
-					<th class="text-left" style="width: 5%;">Discount</th>
-					<th class="text-left">Taxable Amount</th>
-					<th class="text-left" style="width: 7%;">Tax Rate</th>
-					<th class="text-left" style="width: 5%;">Other Charges</th>
-					<th class="text-left">Total</th>
-				</tr>
-			</thead>
-			<tbody>
-				{% for item in einvoice.ItemList %}
-					<tr>
-						<td class="text-left" style="width: 3%;">{{ item.SlNo }}</td>
-						<td class="text-left">{{ item.PrdDesc }}</td>
-						<td class="text-left" style="width: 10%;">{{ item.HsnCd }}</td>
-						<td class="text-right" style="width: 5%;">{{ item.Qty }}</td>
-						<td class="text-left" style="width: 5%;">{{ item.Unit }}</td>
-						<td class="text-right">{{ frappe.utils.fmt_money(item.UnitPrice, None, "INR") }}</td>
-						<td class="text-right" style="width: 5%;">{{ frappe.utils.fmt_money(item.Discount, None, "INR") }}</td>
-						<td class="text-right">{{ frappe.utils.fmt_money(item.AssAmt, None, "INR") }}</td>
-						<td class="text-right" style="width: 7%;">{{ item.GstRt + item.CesRt }} %</td>
-						<td class="text-right" style="width: 5%;">{{ frappe.utils.fmt_money(0, None, "INR") }}</td>
-						<td class="text-right">{{ frappe.utils.fmt_money(item.TotItemVal, None, "INR") }}</td>
-					</tr>
-				{% endfor %}
-			</tbody>
-		</table>
-	</div>
-	<div style="overflow-x: auto;">
-		<h5 class="font-bold" style="margin-bottom: 0px;">4. Value Details</h5>
-		<table class="table table-bordered">
-			<thead>
-				<tr>
-					<th class="text-left">Taxable Amount</th>
-					<th class="text-left">CGST</th>
-					<th class="text-left"">SGST</th>
-					<th class="text-left">IGST</th>
-					<th class="text-left">CESS</th>
-					<th class="text-left" style="width: 10%;">State CESS</th>
-					<th class="text-left">Discount</th>
-					<th class="text-left" style="width: 10%;">Other Charges</th>
-					<th class="text-left" style="width: 10%;">Round Off</th>
-					<th class="text-left">Total Value</th>
-				</tr>
-			</thead>
-			<tbody>
-				{%- set value_details = einvoice.ValDtls -%}
-				<tr>
-					<td class="text-right">{{ frappe.utils.fmt_money(value_details.AssVal, None, "INR") }}</td>
-					<td class="text-right">{{ frappe.utils.fmt_money(value_details.CgstVal, None, "INR") }}</td>
-					<td class="text-right">{{ frappe.utils.fmt_money(value_details.SgstVal, None, "INR") }}</td>
-					<td class="text-right">{{ frappe.utils.fmt_money(value_details.IgstVal, None, "INR") }}</td>
-					<td class="text-right">{{ frappe.utils.fmt_money(value_details.CesVal, None, "INR") }}</td>
-					<td class="text-right">{{ frappe.utils.fmt_money(0, None, "INR") }}</td>
-					<td class="text-right">{{ frappe.utils.fmt_money(value_details.Discount, None, "INR") }}</td>
-					<td class="text-right">{{ frappe.utils.fmt_money(value_details.OthChrg, None, "INR") }}</td>
-					<td class="text-right">{{ frappe.utils.fmt_money(value_details.RndOffAmt, None, "INR") }}</td>
-					<td class="text-right">{{ frappe.utils.fmt_money(value_details.TotInvVal, None, "INR") }}</td>
-				</tr>
-			</tbody>
-		</table>
-	</div>
-</div>
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/gst_e_invoice/gst_e_invoice.json b/erpnext/accounts/print_format/gst_e_invoice/gst_e_invoice.json
deleted file mode 100644
index 1001199..0000000
--- a/erpnext/accounts/print_format/gst_e_invoice/gst_e_invoice.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "align_labels_right": 1,
- "creation": "2020-10-10 18:01:21.032914",
- "custom_format": 0,
- "default_print_language": "en-US",
- "disabled": 1,
- "doc_type": "Sales Invoice",
- "docstatus": 0,
- "doctype": "Print Format",
- "font": "Default",
- "html": "",
- "idx": 0,
- "line_breaks": 1,
- "modified": "2020-10-23 19:54:40.634936",
- "modified_by": "Administrator",
- "module": "Accounts",
- "name": "GST E-Invoice",
- "owner": "Administrator",
- "print_format_builder": 0,
- "print_format_type": "Jinja",
- "raw_printing": 0,
- "show_section_headings": 1,
- "standard": "Yes"
-}
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json b/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json
index 6d7c3d3..1467f27 100644
--- a/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json
+++ b/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json
@@ -16,7 +16,7 @@
  "name": "GST Purchase Invoice", 
  "owner": "Administrator", 
  "print_format_builder": 1, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html
index 0ca940f8..c1c611e 100644
--- a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html
+++ b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html
@@ -68,4 +68,4 @@
             </tr>
         </table>
     <div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json
index 927e818..e45295d 100644
--- a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json
+++ b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json
@@ -16,7 +16,7 @@
  "name": "Journal Auditing Voucher", 
  "owner": "Administrator", 
  "print_format_builder": 0, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html b/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html
index 283d505..ae07582 100644
--- a/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html
+++ b/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html
@@ -27,4 +27,3 @@
         {{ _("Authorized Signatory") }}
     </p>
 </div>
-
diff --git a/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.json b/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.json
index f1de448..c52eeb2 100755
--- a/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.json
+++ b/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.json
@@ -12,6 +12,6 @@
  "name": "Payment Receipt Voucher", 
  "owner": "Administrator", 
  "print_format_builder": 0, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html
index 043ac25..8696bff 100644
--- a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html
+++ b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html
@@ -103,4 +103,4 @@
             </tr>
         </table>
     </div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json
index 73779d4..3398117 100644
--- a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json
+++ b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json
@@ -16,7 +16,7 @@
  "name": "Purchase Auditing Voucher", 
  "owner": "Administrator", 
  "print_format_builder": 0, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html
index a53b593..efb2d00 100644
--- a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html
+++ b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html
@@ -93,4 +93,4 @@
             </tr>
         </table>
     </div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json
index 0544e0b..289e184 100644
--- a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json
+++ b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json
@@ -16,7 +16,7 @@
  "name": "Sales Auditing Voucher", 
  "owner": "Administrator", 
  "print_format_builder": 0, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/report/account_balance/test_account_balance.py b/erpnext/accounts/report/account_balance/test_account_balance.py
index 14ddf4a..f5c9449 100644
--- a/erpnext/accounts/report/account_balance/test_account_balance.py
+++ b/erpnext/accounts/report/account_balance/test_account_balance.py
@@ -62,8 +62,3 @@
 		income_account = 'Sales - _TC2',
 		expense_account = 'Cost of Goods Sold - _TC2',
 		cost_center = 'Main - _TC2')
-
-
-
-
-
diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js
index 6abd6e5..b6c6689 100644
--- a/erpnext/accounts/report/accounts_payable/accounts_payable.js
+++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js
@@ -136,4 +136,3 @@
 }
 
 erpnext.utils.add_dimensions('Accounts Payable', 9);
-
diff --git a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js
index 9c6b063..ea20072 100644
--- a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js
+++ b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js
@@ -105,4 +105,3 @@
 }
 
 erpnext.utils.add_dimensions('Accounts Payable Summary', 9);
-
diff --git a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.py b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.py
index 729eda9..c08582b 100644
--- a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.py
+++ b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.py
@@ -12,4 +12,3 @@
 		"naming_by": ["Buying Settings", "supp_master_name"],
 	}
 	return AccountsReceivableSummary(filters).run(args)
-
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
index 29c4f7d..1a32e2a 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
@@ -200,4 +200,3 @@
 }
 
 erpnext.utils.add_dimensions('Accounts Receivable', 9);
-
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
index b54646f..cedfc0f 100755
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
@@ -535,6 +535,8 @@
 		if getdate(entry_date) > getdate(self.filters.report_date):
 			row.range1 = row.range2 = row.range3 = row.range4 = row.range5 = 0.0
 
+		row.total_due = row.range1 + row.range2 + row.range3 + row.range4 + row.range5
+
 	def get_ageing_data(self, entry_date, row):
 		# [0-30, 30-60, 60-90, 90-120, 120-above]
 		row.range1 = row.range2 = row.range3 = row.range4 = row.range5 = 0.0
diff --git a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py
index 2ff5b53..cca6760 100644
--- a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py
@@ -93,4 +93,3 @@
 		cost_center = 'Main - _TC2',
 		is_return = 1,
 		return_against = docname)
-
diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
index 657b3e8..4bfb022 100644
--- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
+++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
@@ -82,6 +82,7 @@
 			"range3": 0.0,
 			"range4": 0.0,
 			"range5": 0.0,
+			"total_due": 0.0,
 			"sales_person": []
 		}))
 
@@ -134,4 +135,7 @@
 			"{range2}-{range3}".format(range2=cint(self.filters["range2"])+ 1, range3=self.filters["range3"]),
 			"{range3}-{range4}".format(range3=cint(self.filters["range3"])+ 1, range4=self.filters["range4"]),
 			"{range4}-{above}".format(range4=cint(self.filters["range4"])+ 1, above=_("Above"))]):
-				self.add_column(label=label, fieldname='range' + str(i+1))
\ No newline at end of file
+				self.add_column(label=label, fieldname='range' + str(i+1))
+
+		# Add column for total due amount
+		self.add_column(label="Total Amount Due", fieldname='total_due')
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py
index 26bb44f..7838385 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.py
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py
@@ -209,4 +209,4 @@
 	else:
 		chart["type"] = "line"
 
-	return chart
\ No newline at end of file
+	return chart
diff --git a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js
index dbee022..f0b6c6b 100644
--- a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js
+++ b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js
@@ -22,7 +22,7 @@
 			"fieldtype": "Link",
 			"options": "Account",
 			"reqd": 1,
-			"default": frappe.defaults.get_user_default("Company")? 
+			"default": frappe.defaults.get_user_default("Company")?
 				locals[":Company"][frappe.defaults.get_user_default("Company")]["default_bank_account"]: "",
 			"get_query": function() {
 				return {
diff --git a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
index 79b0a6f..95f724c 100644
--- a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
+++ b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
@@ -74,19 +74,19 @@
 	journal_entries =  frappe.db.sql("""SELECT
 			"Journal Entry", jv.name, jv.posting_date, jv.cheque_no,
 			jv.clearance_date, jvd.against_account, jvd.debit - jvd.credit
-		FROM 
+		FROM
 			`tabJournal Entry Account` jvd, `tabJournal Entry` jv
-		WHERE 
+		WHERE
 			jvd.parent = jv.name and jv.docstatus=1 and jvd.account = %(account)s {0}
 			order by posting_date DESC, jv.name DESC""".format(conditions), filters, as_list=1)
 
 	payment_entries =  frappe.db.sql("""SELECT
-			"Payment Entry", name, posting_date, reference_no, clearance_date, party, 
+			"Payment Entry", name, posting_date, reference_no, clearance_date, party,
 			if(paid_from=%(account)s, paid_amount * -1, received_amount)
-		FROM 
+		FROM
 			`tabPayment Entry`
-		WHERE 
+		WHERE
 			docstatus=1 and (paid_from = %(account)s or paid_to = %(account)s) {0}
 			order by posting_date DESC, name DESC""".format(conditions), filters, as_list=1)
 
-	return sorted(journal_entries + payment_entries, key=lambda k: k[2] or getdate(nowdate()))
\ No newline at end of file
+	return sorted(journal_entries + payment_entries, key=lambda k: k[2] or getdate(nowdate()))
diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
index 8f02849..9bb6a14 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
@@ -16,7 +16,7 @@
 			"label": __("Bank Account"),
 			"fieldtype": "Link",
 			"options": "Account",
-			"default": frappe.defaults.get_user_default("Company")? 
+			"default": frappe.defaults.get_user_default("Company")?
 				locals[":Company"][frappe.defaults.get_user_default("Company")]["default_bank_account"]: "",
 			"reqd": 1,
 			"get_query": function() {
diff --git a/erpnext/accounts/report/billed_items_to_be_received/billed_items_to_be_received.py b/erpnext/accounts/report/billed_items_to_be_received/billed_items_to_be_received.py
index 2ce5d50..2dcea22 100644
--- a/erpnext/accounts/report/billed_items_to_be_received/billed_items_to_be_received.py
+++ b/erpnext/accounts/report/billed_items_to_be_received/billed_items_to_be_received.py
@@ -104,4 +104,4 @@
 			'fieldtype': 'Currency',
 			'width': 100
 		}
-	]
\ No newline at end of file
+	]
diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
index f547ca6..718b6e2 100644
--- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
+++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
@@ -92,4 +92,3 @@
 erpnext.dimension_filters.forEach((dimension) => {
 	frappe.query_reports["Budget Variance Report"].filters[4].options.push(dimension["document_type"]);
 });
-
diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
index 9f0eee8..443126e 100644
--- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
+++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
@@ -78,7 +78,7 @@
 		if filters["period"] != "Yearly" :
 			row += totals
 		data.append(row)
-		
+
 	return data
 
 
@@ -388,7 +388,7 @@
 			budget_values[i] += values[index]
 			actual_values[i] += values[index+1]
 			index += 3
-			
+
 	return {
 		'data': {
 			'labels': labels,
@@ -399,4 +399,3 @@
 		},
 		'type' : 'bar'
 	}
-
diff --git a/erpnext/accounts/report/cash_flow/cash_flow.html b/erpnext/accounts/report/cash_flow/cash_flow.html
index 40ba20c..d4ae54d 100644
--- a/erpnext/accounts/report/cash_flow/cash_flow.html
+++ b/erpnext/accounts/report/cash_flow/cash_flow.html
@@ -1 +1 @@
-{% include "accounts/report/financial_statements.html" %}
\ No newline at end of file
+{% include "accounts/report/financial_statements.html" %}
diff --git a/erpnext/accounts/report/cash_flow/cash_flow.js b/erpnext/accounts/report/cash_flow/cash_flow.js
index a984bf4..a2c34c6 100644
--- a/erpnext/accounts/report/cash_flow/cash_flow.js
+++ b/erpnext/accounts/report/cash_flow/cash_flow.js
@@ -21,4 +21,4 @@
 			"default": 1
 		}
 	);
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.js b/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.js
index 1363b53..6a8301a 100644
--- a/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.js
+++ b/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.js
@@ -94,10 +94,10 @@
 				"default": 1
 			}
 		],
-		"formatter": function(value, row, column, data, default_formatter) {			
+		"formatter": function(value, row, column, data, default_formatter) {
 			if (data && column.fieldname=="account") {
 				value = data.account_name || value;
-				
+
 				column.link_onclick =
 				"erpnext.financial_statements.open_general_ledger(" + JSON.stringify(data) + ")";
 				column.is_tree = true;
@@ -126,4 +126,4 @@
 			});
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py b/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py
index 56a67bb..fc42127 100644
--- a/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py
+++ b/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py
@@ -210,10 +210,10 @@
 	company_currency = get_company_currency(filters)
 
 	if filters.filter_based_on == 'Fiscal Year':
-		start_date = fiscal_year.year_start_date
+		start_date = fiscal_year.year_start_date if filters.report != 'Balance Sheet' else None
 		end_date = fiscal_year.year_end_date
 	else:
-		start_date = filters.period_start_date
+		start_date = filters.period_start_date if filters.report != 'Balance Sheet' else None
 		end_date = filters.period_end_date
 
 	gl_entries_by_account = {}
diff --git a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py
index 515fd99..9953d8f 100644
--- a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py
+++ b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py
@@ -105,4 +105,4 @@
 
 def get_args():
 	return {'doctype': 'Delivery Note', 'party': 'customer',
-		'date': 'posting_date', 'order': 'name', 'order_by': 'desc'}
\ No newline at end of file
+		'date': 'posting_date', 'order': 'name', 'order_by': 'desc'}
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.js b/erpnext/accounts/report/general_ledger/general_ledger.js
index 4a551b8..095f5ed 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.js
+++ b/erpnext/accounts/report/general_ledger/general_ledger.js
@@ -176,4 +176,3 @@
 }
 
 erpnext.utils.add_dimensions('General Ledger', 15)
-
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py
index 1759fa3..5d8d49d 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.py
+++ b/erpnext/accounts/report/general_ledger/general_ledger.py
@@ -48,7 +48,7 @@
 
 	if not filters.get("from_date") and not filters.get("to_date"):
 		frappe.throw(_("{0} and {1} are mandatory").format(frappe.bold(_("From Date")), frappe.bold(_("To Date"))))
-			
+
 	if filters.get('account'):
 		filters.account = frappe.parse_json(filters.get('account'))
 		for account in filters.account:
@@ -92,7 +92,7 @@
 		account_currency = None
 
 		if filters.get("account"):
-			if len(filters.get("account")) == 1:	
+			if len(filters.get("account")) == 1:
 				account_currency = get_account_currency(filters.account[0])
 			else:
 				currency = get_account_currency(filters.account[0])
diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.html b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.html
index 40ba20c..d4ae54d 100644
--- a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.html
+++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.html
@@ -1 +1 @@
-{% include "accounts/report/financial_statements.html" %}
\ No newline at end of file
+{% include "accounts/report/financial_statements.html" %}
diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py
index 714e48d..8e33af7 100644
--- a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py
+++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py
@@ -165,4 +165,4 @@
 			has_value=True
 
 	if has_value:
-		return profit_loss
\ No newline at end of file
+		return profit_loss
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.json b/erpnext/accounts/report/gross_profit/gross_profit.json
index cd6bac2..5fff3fd 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.json
+++ b/erpnext/accounts/report/gross_profit/gross_profit.json
@@ -1,16 +1,20 @@
 {
- "add_total_row": 1,
+ "add_total_row": 0,
+ "columns": [],
  "creation": "2013-02-25 17:03:34",
+ "disable_prepared_report": 0,
  "disabled": 0,
  "docstatus": 0,
  "doctype": "Report",
+ "filters": [],
  "idx": 3,
  "is_standard": "Yes",
- "modified": "2020-08-13 11:26:39.112352",
+ "modified": "2021-08-19 18:57:07.468202",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Gross Profit",
  "owner": "Administrator",
+ "prepared_report": 0,
  "ref_doctype": "Sales Invoice",
  "report_name": "Gross Profit",
  "report_type": "Script Report",
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index 6d8623c..c949d9b 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -41,12 +41,14 @@
 
 	columns = get_columns(group_wise_columns, filters)
 
-	for src in gross_profit_data.grouped_data:
+	for idx, src in enumerate(gross_profit_data.grouped_data):
 		row = []
 		for col in group_wise_columns.get(scrub(filters.group_by)):
 			row.append(src.get(col))
 
 		row.append(filters.currency)
+		if idx == len(gross_profit_data.grouped_data)-1:
+			row[0] = frappe.bold("Total")
 		data.append(row)
 
 	return columns, data
@@ -154,6 +156,15 @@
 
 	def get_average_rate_based_on_group_by(self):
 		# sum buying / selling totals for group
+		self.totals = frappe._dict(
+			qty=0,
+			base_amount=0,
+			buying_amount=0,
+			gross_profit=0,
+			gross_profit_percent=0,
+			base_rate=0,
+			buying_rate=0
+		)
 		for key in list(self.grouped):
 			if self.filters.get("group_by") != "Invoice":
 				for i, row in enumerate(self.grouped[key]):
@@ -165,6 +176,7 @@
 						new_row.base_amount += flt(row.base_amount, self.currency_precision)
 				new_row = self.set_average_rate(new_row)
 				self.grouped_data.append(new_row)
+				self.add_to_totals(new_row)
 			else:
 				for i, row in enumerate(self.grouped[key]):
 					if row.parent in self.returned_invoices \
@@ -177,15 +189,25 @@
 					if row.qty or row.base_amount:
 						row = self.set_average_rate(row)
 						self.grouped_data.append(row)
+					self.add_to_totals(row)
+		self.set_average_gross_profit(self.totals)
+		self.grouped_data.append(self.totals)
 
 	def set_average_rate(self, new_row):
+		self.set_average_gross_profit(new_row)
+		new_row.buying_rate = flt(new_row.buying_amount / new_row.qty, self.float_precision) if new_row.qty else 0
+		new_row.base_rate = flt(new_row.base_amount / new_row.qty, self.float_precision) if new_row.qty else 0
+		return new_row
+
+	def set_average_gross_profit(self, new_row):
 		new_row.gross_profit = flt(new_row.base_amount - new_row.buying_amount, self.currency_precision)
 		new_row.gross_profit_percent = flt(((new_row.gross_profit / new_row.base_amount) * 100.0), self.currency_precision) \
 			if new_row.base_amount else 0
-		new_row.buying_rate = flt(new_row.buying_amount / new_row.qty, self.float_precision) if new_row.qty else 0
-		new_row.base_rate = flt(new_row.base_amount / new_row.qty, self.float_precision) if new_row.qty else 0
 
-		return new_row
+	def add_to_totals(self, new_row):
+		for key in self.totals:
+			if new_row.get(key):
+				self.totals[key] += new_row[key]
 
 	def get_returned_invoice_items(self):
 		returned_invoices = frappe.db.sql("""
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
index 2e794da..c9c22c2 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
@@ -76,7 +76,7 @@
 			'company': d.company,
 			'sales_order': d.sales_order,
 			'delivery_note': d.delivery_note,
-			'income_account': d.unrealized_profit_loss_account or d.income_account,
+			'income_account': d.unrealized_profit_loss_account if d.is_internal_customer == 1 else d.income_account,
 			'cost_center': d.cost_center,
 			'stock_qty': d.stock_qty,
 			'stock_uom': d.stock_uom
@@ -380,6 +380,7 @@
 			`tabSales Invoice Item`.name, `tabSales Invoice Item`.parent,
 			`tabSales Invoice`.posting_date, `tabSales Invoice`.debit_to,
 			`tabSales Invoice`.unrealized_profit_loss_account,
+			`tabSales Invoice`.is_internal_customer,
 			`tabSales Invoice`.project, `tabSales Invoice`.customer, `tabSales Invoice`.remarks,
 			`tabSales Invoice`.territory, `tabSales Invoice`.company, `tabSales Invoice`.base_net_total,
 			`tabSales Invoice Item`.item_code, `tabSales Invoice Item`.description,
@@ -625,7 +626,3 @@
 	for tax in tax_columns:
 		total_row.setdefault(frappe.scrub(tax + ' Amount'), 0.0)
 		total_row[frappe.scrub(tax + ' Amount')] += flt(item[frappe.scrub(tax + ' Amount')])
-
-
-
-
diff --git a/erpnext/accounts/report/non_billed_report.py b/erpnext/accounts/report/non_billed_report.py
index 2e18ce1..5173505 100644
--- a/erpnext/accounts/report/non_billed_report.py
+++ b/erpnext/accounts/report/non_billed_report.py
@@ -44,4 +44,4 @@
 
 def get_project_field(doctype, party):
 	if party == "supplier": doctype = doctype + ' Item'
-	return "`tab%s`.project"%(doctype)
\ No newline at end of file
+	return "`tab%s`.project"%(doctype)
diff --git a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py
index 7195c7e..556f5ad 100644
--- a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py
+++ b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py
@@ -40,7 +40,7 @@
 
 		row = [
 			d.voucher_type, d.voucher_no, d.party_type, d.party, d.posting_date, d.against_voucher,
-			invoice.posting_date, invoice.due_date, d.debit, d.credit, d.remarks, 
+			invoice.posting_date, invoice.due_date, d.debit, d.credit, d.remarks,
 			d.age, d.range1, d.range2, d.range3, d.range4
 		]
 
diff --git a/erpnext/accounts/report/pos_register/pos_register.py b/erpnext/accounts/report/pos_register/pos_register.py
index 6a42bb4..b7e112c 100644
--- a/erpnext/accounts/report/pos_register/pos_register.py
+++ b/erpnext/accounts/report/pos_register/pos_register.py
@@ -10,7 +10,7 @@
 def execute(filters=None):
 	if not filters:
 		return [], []
-	
+
 	validate_filters(filters)
 
 	columns = get_columns(filters)
@@ -29,7 +29,7 @@
 	invoice_map, grouped_data = {}, []
 	for d in pos_entries:
 		invoice_map.setdefault(d[group_by_field], []).append(d)
-	
+
 	for key in invoice_map:
 		invoices = invoice_map[key]
 		grouped_data += invoices
@@ -56,7 +56,7 @@
 
 	return frappe.db.sql(
 		"""
-		SELECT 
+		SELECT
 			p.posting_date, p.name as pos_invoice, p.pos_profile,
 			p.owner, p.base_grand_total as grand_total, p.base_paid_amount as paid_amount,
 			p.customer, p.is_return {select_mop_field}
@@ -96,22 +96,22 @@
 def validate_filters(filters):
 	if not filters.get("company"):
 		frappe.throw(_("{0} is mandatory").format(_("Company")))
-	
+
 	if not filters.get("from_date") and not filters.get("to_date"):
 		frappe.throw(_("{0} and {1} are mandatory").format(frappe.bold(_("From Date")), frappe.bold(_("To Date"))))
-	
+
 	if filters.from_date > filters.to_date:
 		frappe.throw(_("From Date must be before To Date"))
 
 	if (filters.get("pos_profile") and filters.get("group_by") == _('POS Profile')):
 		frappe.throw(_("Can not filter based on POS Profile, if grouped by POS Profile"))
-	
+
 	if (filters.get("customer") and filters.get("group_by") == _('Customer')):
 		frappe.throw(_("Can not filter based on Customer, if grouped by Customer"))
-	
+
 	if (filters.get("owner") and filters.get("group_by") == _('Cashier')):
 		frappe.throw(_("Can not filter based on Cashier, if grouped by Cashier"))
-	
+
 	if (filters.get("mode_of_payment") and filters.get("group_by") == _('Payment Method')):
 		frappe.throw(_("Can not filter based on Payment Method, if grouped by Payment Method"))
 
@@ -120,23 +120,23 @@
 
 	if filters.get("pos_profile"):
 		conditions += " AND pos_profile = %(pos_profile)s"
-	
+
 	if filters.get("owner"):
 		conditions += " AND owner = %(owner)s"
-	
+
 	if filters.get("customer"):
 		conditions += " AND customer = %(customer)s"
-	
+
 	if filters.get("is_return"):
 		conditions += " AND is_return = %(is_return)s"
-	
+
 	if filters.get("mode_of_payment"):
 		conditions += """
 			AND EXISTS(
 					SELECT name FROM `tabSales Invoice Payment` sip
 					WHERE parent=p.name AND ifnull(sip.mode_of_payment, '') = %(mode_of_payment)s
 				)"""
-	
+
 	return conditions
 
 def get_group_by_field(group_by):
@@ -150,7 +150,7 @@
 		group_by_field = "customer"
 	elif group_by == "Payment Method":
 		group_by_field = "mode_of_payment"
-	
+
 	return group_by_field
 
 def get_columns(filters):
@@ -217,4 +217,4 @@
 		},
 	]
 
-	return columns
\ No newline at end of file
+	return columns
diff --git a/erpnext/accounts/report/profitability_analysis/profitability_analysis.html b/erpnext/accounts/report/profitability_analysis/profitability_analysis.html
index 40ba20c..d4ae54d 100644
--- a/erpnext/accounts/report/profitability_analysis/profitability_analysis.html
+++ b/erpnext/accounts/report/profitability_analysis/profitability_analysis.html
@@ -1 +1 @@
-{% include "accounts/report/financial_statements.html" %}
\ No newline at end of file
+{% include "accounts/report/financial_statements.html" %}
diff --git a/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js b/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js
index a95cfac..feab96f 100644
--- a/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js
+++ b/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js
@@ -5,4 +5,4 @@
 	frappe.query_reports["Purchase Invoice Trends"] = {
 		filters: erpnext.get_purchase_trends_filters()
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py b/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py
index ad3783f..ba236b9 100644
--- a/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py
+++ b/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py
@@ -11,4 +11,4 @@
 	conditions = get_columns(filters, "Purchase Invoice")
 	data = get_data(filters, conditions)
 
-	return conditions["columns"], data 
\ No newline at end of file
+	return conditions["columns"], data
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.js b/erpnext/accounts/report/purchase_register/purchase_register.js
index f34ea57..aaf76c4 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.js
+++ b/erpnext/accounts/report/purchase_register/purchase_register.js
@@ -56,4 +56,4 @@
 	]
 }
 
-erpnext.utils.add_dimensions('Purchase Register', 7);
\ No newline at end of file
+erpnext.utils.add_dimensions('Purchase Register', 7);
diff --git a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py
index e9e9c9c..a5eced5 100644
--- a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py
+++ b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py
@@ -105,4 +105,4 @@
 
 def get_args():
 	return {'doctype': 'Purchase Receipt', 'party': 'supplier',
-		'date': 'posting_date', 'order': 'name', 'order_by': 'desc'}
\ No newline at end of file
+		'date': 'posting_date', 'order': 'name', 'order_by': 'desc'}
diff --git a/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js b/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js
index 2d320f5..e3d43a7 100644
--- a/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js
+++ b/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js
@@ -5,4 +5,4 @@
 	frappe.query_reports["Sales Invoice Trends"] = {
 		filters: erpnext.get_sales_trends_filters()
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js
index 068926b..44e20e8 100644
--- a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js
+++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js
@@ -42,4 +42,4 @@
 			"fieldtype": "Check"
 		},
 	]
-};
\ No newline at end of file
+};
diff --git a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py
index a51c427..e4a3d35 100644
--- a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py
+++ b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py
@@ -162,4 +162,4 @@
 		"price_list": "Standard Selling",
 		"item_code": item.item_code,
 		"price_list_rate": 10000
-	}).insert()
\ No newline at end of file
+	}).insert()
diff --git a/erpnext/accounts/report/sales_register/sales_register.js b/erpnext/accounts/report/sales_register/sales_register.js
index 85bbcea..2c9b01b 100644
--- a/erpnext/accounts/report/sales_register/sales_register.js
+++ b/erpnext/accounts/report/sales_register/sales_register.js
@@ -69,4 +69,3 @@
 }
 
 erpnext.utils.add_dimensions('Sales Register', 7);
-
diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py
index 9099593..f38bd78 100644
--- a/erpnext/accounts/report/sales_register/sales_register.py
+++ b/erpnext/accounts/report/sales_register/sales_register.py
@@ -84,7 +84,7 @@
 		# Add amount in unrealized account
 		for account in unrealized_profit_loss_accounts:
 			row.update({
-				frappe.scrub(account): flt(internal_invoice_map.get((inv.name, account)))
+				frappe.scrub(account+"_unrealized"): flt(internal_invoice_map.get((inv.name, account)))
 			})
 
 		# net total
@@ -258,6 +258,7 @@
 
 		unrealized_profit_loss_accounts = frappe.db.sql_list("""SELECT distinct unrealized_profit_loss_account
 			from `tabSales Invoice` where docstatus = 1 and name in (%s)
+			and is_internal_customer = 1
 			and ifnull(unrealized_profit_loss_account, '') != ''
 			order by unrealized_profit_loss_account""" %
 			', '.join(['%s']*len(invoice_list)), tuple(inv.name for inv in invoice_list))
@@ -284,7 +285,7 @@
 	for account in unrealized_profit_loss_accounts:
 		unrealized_profit_loss_account_columns.append({
 			"label": account,
-			"fieldname": frappe.scrub(account),
+			"fieldname": frappe.scrub(account+"_unrealized"),
 			"fieldtype": "Currency",
 			"options": "currency",
 			"width": 120
diff --git a/erpnext/accounts/report/supplier_ledger_summary/supplier_ledger_summary.py b/erpnext/accounts/report/supplier_ledger_summary/supplier_ledger_summary.py
index d2c23ee..fbd25b1 100644
--- a/erpnext/accounts/report/supplier_ledger_summary/supplier_ledger_summary.py
+++ b/erpnext/accounts/report/supplier_ledger_summary/supplier_ledger_summary.py
@@ -10,4 +10,4 @@
 		"party_type": "Supplier",
 		"naming_by": ["Buying Settings", "supp_master_name"],
 	}
-	return PartyLedgerSummaryReport(filters).run(args)
\ No newline at end of file
+	return PartyLedgerSummaryReport(filters).run(args)
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.js b/erpnext/accounts/report/trial_balance/trial_balance.js
index 8645d55..078b065 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.js
+++ b/erpnext/accounts/report/trial_balance/trial_balance.js
@@ -110,6 +110,3 @@
 
 	erpnext.utils.add_dimensions('Trial Balance', 6);
 });
-
-
-
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py
index 33360e2..1fc0faa 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.py
+++ b/erpnext/accounts/report/trial_balance/trial_balance.py
@@ -321,4 +321,4 @@
 			row[reverse_col] = abs(row[valid_col])
 			row[valid_col] = 0.0
 		else:
-			row[reverse_col] = 0.0
\ No newline at end of file
+			row[reverse_col] = 0.0
diff --git a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
index 78c7e43..f034e74 100644
--- a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
+++ b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
@@ -242,4 +242,4 @@
 	else:
 		show_party_name = True
 
-	return show_party_name
\ No newline at end of file
+	return show_party_name
diff --git a/erpnext/accounts/report/unpaid_expense_claim/unpaid_expense_claim.py b/erpnext/accounts/report/unpaid_expense_claim/unpaid_expense_claim.py
index eee620b..1250d67 100644
--- a/erpnext/accounts/report/unpaid_expense_claim/unpaid_expense_claim.py
+++ b/erpnext/accounts/report/unpaid_expense_claim/unpaid_expense_claim.py
@@ -20,11 +20,11 @@
 	if filters.get("employee"):
 		cond = "ec.employee = %(employee)s"
 
-	return frappe.db.sql(""" 
+	return frappe.db.sql("""
 		select
 			ec.employee, ec.employee_name, ec.name, ec.total_sanctioned_amount, ec.total_amount_reimbursed,
 			sum(gle.credit_in_account_currency - gle.debit_in_account_currency) as outstanding_amt
-		from 
+		from
 			`tabExpense Claim` ec, `tabGL Entry` gle
 		where
 			gle.against_voucher_type = "Expense Claim" and gle.against_voucher = ec.name
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 5b58e87..118f628 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -19,6 +19,7 @@
 
 class StockValueAndAccountBalanceOutOfSync(frappe.ValidationError): pass
 class FiscalYearError(frappe.ValidationError): pass
+class PaymentEntryUnlinkError(frappe.ValidationError): pass
 
 @frappe.whitelist()
 def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1, company=None, as_dict=False):
@@ -350,6 +351,7 @@
 		# cancel advance entry
 		doc = frappe.get_doc(d.voucher_type, d.voucher_no)
 
+		frappe.flags.ignore_party_validation = True
 		doc.make_gl_entries(cancel=1, adv_adj=1)
 
 		# update ref in advance entry
@@ -361,6 +363,7 @@
 		# re-submit advance entry
 		doc = frappe.get_doc(d.voucher_type, d.voucher_no)
 		doc.make_gl_entries(cancel = 0, adv_adj =1)
+		frappe.flags.ignore_party_validation = False
 
 		if d.voucher_type in ('Payment Entry', 'Journal Entry'):
 			doc.update_expense_claim()
@@ -553,10 +556,16 @@
 			and docstatus < 2""", (now(), frappe.session.user, ref_type, ref_no))
 
 		for pe in linked_pe:
-			pe_doc = frappe.get_doc("Payment Entry", pe)
-			pe_doc.set_total_allocated_amount()
-			pe_doc.set_unallocated_amount()
-			pe_doc.clear_unallocated_reference_document_rows()
+			try:
+				pe_doc = frappe.get_doc("Payment Entry", pe)
+				pe_doc.set_amounts()
+				pe_doc.clear_unallocated_reference_document_rows()
+				pe_doc.validate_payment_type_with_outstanding()
+			except Exception as e:
+				msg = _("There were issues unlinking payment entry {0}.").format(pe_doc.name)
+				msg += '<br>'
+				msg += _("Please cancel payment entry manually first")
+				frappe.throw(msg, exc=PaymentEntryUnlinkError, title=_("Payment Unlink Error"))
 
 			frappe.db.sql("""update `tabPayment Entry` set total_allocated_amount=%s,
 				base_total_allocated_amount=%s, unallocated_amount=%s, modified=%s, modified_by=%s
diff --git a/erpnext/agriculture/doctype/crop/crop.js b/erpnext/agriculture/doctype/crop/crop.js
index afd84fd..5508246 100644
--- a/erpnext/agriculture/doctype/crop/crop.js
+++ b/erpnext/agriculture/doctype/crop/crop.js
@@ -52,4 +52,4 @@
 			}
 		});
 	});
-};
\ No newline at end of file
+};
diff --git a/erpnext/agriculture/doctype/crop/crop_dashboard.py b/erpnext/agriculture/doctype/crop/crop_dashboard.py
index 9a8f26f..8f37735 100644
--- a/erpnext/agriculture/doctype/crop/crop_dashboard.py
+++ b/erpnext/agriculture/doctype/crop/crop_dashboard.py
@@ -9,4 +9,4 @@
 				'items': ['Crop Cycle']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/agriculture/doctype/crop/test_crop.js b/erpnext/agriculture/doctype/crop/test_crop.js
index 138acbf..4055563 100644
--- a/erpnext/agriculture/doctype/crop/test_crop.js
+++ b/erpnext/agriculture/doctype/crop/test_crop.js
@@ -105,7 +105,7 @@
 				]
 			]}
 		]),
-		// agriculture task list 
+		// agriculture task list
 		() => {
 			assert.equal(cur_frm.doc.name, 'Basil from seed');
 			assert.equal(cur_frm.doc.period, 15);
diff --git a/erpnext/agriculture/doctype/crop/test_crop.py b/erpnext/agriculture/doctype/crop/test_crop.py
index c2e4917..b307983 100644
--- a/erpnext/agriculture/doctype/crop/test_crop.py
+++ b/erpnext/agriculture/doctype/crop/test_crop.py
@@ -11,4 +11,4 @@
 class TestCrop(unittest.TestCase):
 	def test_crop_period(self):
 		basil = frappe.get_doc('Crop', 'Basil from seed')
-		self.assertEqual(basil.period, 15)
\ No newline at end of file
+		self.assertEqual(basil.period, 15)
diff --git a/erpnext/agriculture/doctype/crop_cycle/test_crop_cycle.js b/erpnext/agriculture/doctype/crop_cycle/test_crop_cycle.js
index 464a368..87184da 100644
--- a/erpnext/agriculture/doctype/crop_cycle/test_crop_cycle.js
+++ b/erpnext/agriculture/doctype/crop_cycle/test_crop_cycle.js
@@ -19,7 +19,7 @@
 					{disease: 'Aphids'}
 				]
 			]},
-			{linked_land_unit: [ 
+			{linked_land_unit: [
 				[
 					{land_unit: 'Basil Farm'}
 				]
diff --git a/erpnext/agriculture/doctype/disease/disease.py b/erpnext/agriculture/doctype/disease/disease.py
index c7707a5..affa570 100644
--- a/erpnext/agriculture/doctype/disease/disease.py
+++ b/erpnext/agriculture/doctype/disease/disease.py
@@ -17,4 +17,4 @@
 				frappe.throw(_("Start day is greater than end day in task '{0}'").format(task.task_name))
 			# to calculate the period of the Crop Cycle
 			if task.end_day > max_period: max_period = task.end_day
-		self.treatment_period = max_period
\ No newline at end of file
+		self.treatment_period = max_period
diff --git a/erpnext/agriculture/doctype/disease/test_disease.js b/erpnext/agriculture/doctype/disease/test_disease.js
index 57d62c1..33f60c4 100644
--- a/erpnext/agriculture/doctype/disease/test_disease.js
+++ b/erpnext/agriculture/doctype/disease/test_disease.js
@@ -36,4 +36,3 @@
 	]);
 
 });
-
diff --git a/erpnext/agriculture/doctype/disease/test_disease.py b/erpnext/agriculture/doctype/disease/test_disease.py
index 54788a2..8086177 100644
--- a/erpnext/agriculture/doctype/disease/test_disease.py
+++ b/erpnext/agriculture/doctype/disease/test_disease.py
@@ -9,4 +9,4 @@
 class TestDisease(unittest.TestCase):
 	def test_treatment_period(self):
 		disease = frappe.get_doc('Disease', 'Aphids')
-		self.assertEqual(disease.treatment_period, 3)
\ No newline at end of file
+		self.assertEqual(disease.treatment_period, 3)
diff --git a/erpnext/agriculture/doctype/fertilizer/fertilizer.py b/erpnext/agriculture/doctype/fertilizer/fertilizer.py
index 9cb492a..c475f00 100644
--- a/erpnext/agriculture/doctype/fertilizer/fertilizer.py
+++ b/erpnext/agriculture/doctype/fertilizer/fertilizer.py
@@ -11,4 +11,4 @@
 	def load_contents(self):
 		docs = frappe.get_all("Agriculture Analysis Criteria", filters={'linked_doctype':'Fertilizer'})
 		for doc in docs:
-			self.append('fertilizer_contents', {'title': str(doc.name)})
\ No newline at end of file
+			self.append('fertilizer_contents', {'title': str(doc.name)})
diff --git a/erpnext/agriculture/doctype/fertilizer/test_fertilizer.py b/erpnext/agriculture/doctype/fertilizer/test_fertilizer.py
index 3a25b3f..4c71d33 100644
--- a/erpnext/agriculture/doctype/fertilizer/test_fertilizer.py
+++ b/erpnext/agriculture/doctype/fertilizer/test_fertilizer.py
@@ -8,4 +8,4 @@
 
 class TestFertilizer(unittest.TestCase):
 	def test_fertilizer_creation(self):
-		self.assertEqual(frappe.db.exists('Fertilizer', 'Urea'), 'Urea')
\ No newline at end of file
+		self.assertEqual(frappe.db.exists('Fertilizer', 'Urea'), 'Urea')
diff --git a/erpnext/agriculture/doctype/plant_analysis/plant_analysis.py b/erpnext/agriculture/doctype/plant_analysis/plant_analysis.py
index 2806cc6..b65f93d 100644
--- a/erpnext/agriculture/doctype/plant_analysis/plant_analysis.py
+++ b/erpnext/agriculture/doctype/plant_analysis/plant_analysis.py
@@ -12,4 +12,4 @@
 	def load_contents(self):
 		docs = frappe.get_all("Agriculture Analysis Criteria", filters={'linked_doctype':'Plant Analysis'})
 		for doc in docs:
-			self.append('plant_analysis_criteria', {'title': str(doc.name)})
\ No newline at end of file
+			self.append('plant_analysis_criteria', {'title': str(doc.name)})
diff --git a/erpnext/agriculture/doctype/soil_analysis/soil_analysis.py b/erpnext/agriculture/doctype/soil_analysis/soil_analysis.py
index 37835f8..234d0d4 100644
--- a/erpnext/agriculture/doctype/soil_analysis/soil_analysis.py
+++ b/erpnext/agriculture/doctype/soil_analysis/soil_analysis.py
@@ -11,4 +11,4 @@
 	def load_contents(self):
 		docs = frappe.get_all("Agriculture Analysis Criteria", filters={'linked_doctype':'Soil Analysis'})
 		for doc in docs:
-			self.append('soil_analysis_criteria', {'title': str(doc.name)})
\ No newline at end of file
+			self.append('soil_analysis_criteria', {'title': str(doc.name)})
diff --git a/erpnext/agriculture/doctype/soil_texture/test_soil_texture.py b/erpnext/agriculture/doctype/soil_texture/test_soil_texture.py
index 937c06c..16d105c 100644
--- a/erpnext/agriculture/doctype/soil_texture/test_soil_texture.py
+++ b/erpnext/agriculture/doctype/soil_texture/test_soil_texture.py
@@ -11,4 +11,4 @@
 		soil_tex = frappe.get_all('Soil Texture', fields=['name'], filters={'collection_datetime': '2017-11-08'})
 		doc = frappe.get_doc('Soil Texture', soil_tex[0].name)
 		self.assertEqual(doc.silt_composition, 50)
-		self.assertEqual(doc.soil_type, 'Silt Loam')
\ No newline at end of file
+		self.assertEqual(doc.soil_type, 'Silt Loam')
diff --git a/erpnext/agriculture/doctype/water_analysis/water_analysis.py b/erpnext/agriculture/doctype/water_analysis/water_analysis.py
index d9f007c..cb2691d 100644
--- a/erpnext/agriculture/doctype/water_analysis/water_analysis.py
+++ b/erpnext/agriculture/doctype/water_analysis/water_analysis.py
@@ -24,4 +24,4 @@
 		if self.collection_datetime > self.laboratory_testing_datetime:
 			frappe.throw(_('Lab testing datetime cannot be before collection datetime'))
 		if self.laboratory_testing_datetime > self.result_datetime:
-			frappe.throw(_('Lab result datetime cannot be before testing datetime'))
\ No newline at end of file
+			frappe.throw(_('Lab result datetime cannot be before testing datetime'))
diff --git a/erpnext/agriculture/setup.py b/erpnext/agriculture/setup.py
index ab91343..75f07be 100644
--- a/erpnext/agriculture/setup.py
+++ b/erpnext/agriculture/setup.py
@@ -426,5 +426,5 @@
 			title='Degree Days',
 			standard=1,
 			linked_doctype='Weather')
-	] 
+	]
 	insert_record(records)
diff --git a/erpnext/assets/dashboard_fixtures.py b/erpnext/assets/dashboard_fixtures.py
index 7f3c1de..2c70179 100644
--- a/erpnext/assets/dashboard_fixtures.py
+++ b/erpnext/assets/dashboard_fixtures.py
@@ -176,4 +176,4 @@
 			"filters_json": "[]",
 			"doctype": "Number Card"
 		}
-	]
\ No newline at end of file
+	]
diff --git a/erpnext/assets/doctype/asset/asset.js b/erpnext/assets/doctype/asset/asset.js
index 922cc4a..da5778e 100644
--- a/erpnext/assets/doctype/asset/asset.js
+++ b/erpnext/assets/doctype/asset/asset.js
@@ -103,11 +103,11 @@
 					frm.trigger("create_asset_maintenance");
 				}, __("Manage"));
 			}
-		
+
 			frm.add_custom_button(__("Repair Asset"), function() {
 				frm.trigger("create_asset_repair");
 			}, __("Manage"));
-			
+
 			if (frm.doc.status != 'Fully Depreciated') {
 				frm.add_custom_button(__("Adjust Asset Value"), function() {
 					frm.trigger("create_asset_adjustment");
diff --git a/erpnext/assets/doctype/asset/asset_dashboard.py b/erpnext/assets/doctype/asset/asset_dashboard.py
index a5cf238..62bb4be 100644
--- a/erpnext/assets/doctype/asset/asset_dashboard.py
+++ b/erpnext/assets/doctype/asset/asset_dashboard.py
@@ -11,4 +11,4 @@
 				'items': ['Asset Movement']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/assets/doctype/asset/asset_list.js b/erpnext/assets/doctype/asset/asset_list.js
index 02f39e0..4302cb2 100644
--- a/erpnext/assets/doctype/asset/asset_list.js
+++ b/erpnext/assets/doctype/asset/asset_list.js
@@ -50,4 +50,4 @@
 			});
 		});
 	},
-}
\ No newline at end of file
+}
diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py
index e23a715..605ce2e 100644
--- a/erpnext/assets/doctype/asset/test_asset.py
+++ b/erpnext/assets/doctype/asset/test_asset.py
@@ -763,4 +763,4 @@
 	company.save()
 
 	# Enable booking asset depreciation entry automatically
-	frappe.db.set_value("Accounts Settings", None, "book_asset_depreciation_entry_automatically", 1)
\ No newline at end of file
+	frappe.db.set_value("Accounts Settings", None, "book_asset_depreciation_entry_automatically", 1)
diff --git a/erpnext/assets/doctype/asset_category/asset_category.py b/erpnext/assets/doctype/asset_category/asset_category.py
index 46620d5..39032d6 100644
--- a/erpnext/assets/doctype/asset_category/asset_category.py
+++ b/erpnext/assets/doctype/asset_category/asset_category.py
@@ -20,7 +20,7 @@
 			for field in ("Total Number of Depreciations", "Frequency of Depreciation"):
 				if cint(d.get(frappe.scrub(field)))<1:
 					frappe.throw(_("Row {0}: {1} must be greater than 0").format(d.idx, field), frappe.MandatoryError)
-	
+
 	def validate_account_currency(self):
 		account_types = [
 			'fixed_asset_account', 'accumulated_depreciation_account', 'depreciation_expense_account', 'capital_work_in_progress_account'
@@ -33,13 +33,13 @@
 					account_currency = frappe.get_value("Account", d.get(type_of_account), "account_currency")
 					if account_currency != company_currency:
 						invalid_accounts.append(frappe._dict({ 'type': type_of_account, 'idx': d.idx, 'account': d.get(type_of_account) }))
-	
+
 		for d in invalid_accounts:
 			frappe.throw(_("Row #{}: Currency of {} - {} doesn't matches company currency.")
 				.format(d.idx, frappe.bold(frappe.unscrub(d.type)), frappe.bold(d.account)),
 				title=_("Invalid Account"))
 
-	
+
 	def validate_account_types(self):
 		account_type_map = {
 			'fixed_asset_account': { 'account_type': 'Fixed Asset' },
@@ -59,12 +59,12 @@
 						frappe.throw(_("Row #{}: {} of {} should be {}. Please modify the account or select a different account.")
 							.format(d.idx, frappe.unscrub(key_to_match), frappe.bold(selected_account), frappe.bold(expected_key_type)),
 							title=_("Invalid Account"))
-	
+
 	def valide_cwip_account(self):
 		if self.enable_cwip_accounting:
 			missing_cwip_accounts_for_company = []
 			for d in self.accounts:
-				if (not d.capital_work_in_progress_account and 
+				if (not d.capital_work_in_progress_account and
 					not frappe.db.get_value("Company", d.company_name, "capital_work_in_progress_account")):
 					missing_cwip_accounts_for_company.append(get_link_to_form("Company", d.company_name))
 
@@ -93,4 +93,4 @@
 	account = frappe.db.get_value("Asset Category Account",
 		filters={"parent": asset_category, "company_name": company}, fieldname=fieldname)
 
-	return account
\ No newline at end of file
+	return account
diff --git a/erpnext/assets/doctype/asset_category/test_asset_category.py b/erpnext/assets/doctype/asset_category/test_asset_category.py
index 39b79d6..9f7ada6 100644
--- a/erpnext/assets/doctype/asset_category/test_asset_category.py
+++ b/erpnext/assets/doctype/asset_category/test_asset_category.py
@@ -10,9 +10,9 @@
 	def test_mandatory_fields(self):
 		asset_category = frappe.new_doc("Asset Category")
 		asset_category.asset_category_name = "Computers"
-		
+
 		self.assertRaises(frappe.MandatoryError, asset_category.insert)
-		
+
 		asset_category.total_number_of_depreciations = 3
 		asset_category.frequency_of_depreciation = 3
 		asset_category.append("accounts", {
@@ -21,7 +21,7 @@
 			"accumulated_depreciation_account": "_Test Accumulated Depreciations - _TC",
 			"depreciation_expense_account": "_Test Depreciations - _TC"
 		})
-		
+
 		try:
 			asset_category.insert()
 		except frappe.DuplicateEntryError:
@@ -44,4 +44,4 @@
 			"depreciation_expense_account": "_Test Depreciations - _TC"
 		})
 
-		self.assertRaises(frappe.ValidationError, asset_category.insert)
\ No newline at end of file
+		self.assertRaises(frappe.ValidationError, asset_category.insert)
diff --git a/erpnext/assets/doctype/asset_maintenance/asset_maintenance.js b/erpnext/assets/doctype/asset_maintenance/asset_maintenance.js
index 70b8654..52996e9 100644
--- a/erpnext/assets/doctype/asset_maintenance/asset_maintenance.js
+++ b/erpnext/assets/doctype/asset_maintenance/asset_maintenance.js
@@ -97,4 +97,4 @@
 			}
 		});
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/assets/doctype/asset_maintenance/asset_maintenance.py b/erpnext/assets/doctype/asset_maintenance/asset_maintenance.py
index a506dee..e14f1d8 100644
--- a/erpnext/assets/doctype/asset_maintenance/asset_maintenance.py
+++ b/erpnext/assets/doctype/asset_maintenance/asset_maintenance.py
@@ -116,4 +116,4 @@
         select maintenance_status, count(asset_name) as count, asset_name
         from `tabAsset Maintenance Log`
         where asset_name=%s group by maintenance_status""",
-        (asset_name), as_dict=1)
\ No newline at end of file
+        (asset_name), as_dict=1)
diff --git a/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py b/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py
index 392fbdd..7610152 100644
--- a/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py
+++ b/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py
@@ -73,7 +73,7 @@
 			'doctype': 'Location',
 			'location_name': 'Test Location'
 		}).insert()
-	
+
 	if not frappe.db.exists("Item", "Photocopier"):
 		meta = frappe.get_meta('Asset')
 		naming_series = meta.get_field("naming_series").options
@@ -157,6 +157,6 @@
 	company.disposal_account = "_Test Gain/Loss on Asset Disposal - _TC"
 	company.depreciation_cost_center = "_Test Cost Center - _TC"
 	company.save()
-	
+
 	# Enable booking asset depreciation entry automatically
-	frappe.db.set_value("Accounts Settings", None, "book_asset_depreciation_entry_automatically", 1)	
\ No newline at end of file
+	frappe.db.set_value("Accounts Settings", None, "book_asset_depreciation_entry_automatically", 1)
diff --git a/erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.js b/erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.js
index c5db90a..bcdc3ac 100644
--- a/erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.js
+++ b/erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.js
@@ -12,4 +12,4 @@
 			};
 		});
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/assets/doctype/asset_movement/asset_movement.js b/erpnext/assets/doctype/asset_movement/asset_movement.js
index 06d8879..2df7db9 100644
--- a/erpnext/assets/doctype/asset_movement/asset_movement.js
+++ b/erpnext/assets/doctype/asset_movement/asset_movement.js
@@ -99,4 +99,4 @@
 			});
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/assets/doctype/asset_movement/asset_movement.py b/erpnext/assets/doctype/asset_movement/asset_movement.py
index b2de250..1771e27 100644
--- a/erpnext/assets/doctype/asset_movement/asset_movement.py
+++ b/erpnext/assets/doctype/asset_movement/asset_movement.py
@@ -40,14 +40,14 @@
 					if current_location != d.source_location:
 						frappe.throw(_("Asset {0} does not belongs to the location {1}").
 							format(d.asset, d.source_location))
-			
+
 			if self.purpose == 'Issue':
 				if d.target_location:
 					frappe.throw(_("Issuing cannot be done to a location. \
 						Please enter employee who has issued Asset {0}").format(d.asset), title="Incorrect Movement Purpose")
 				if not d.to_employee:
 					frappe.throw(_("Employee is required while issuing Asset {0}").format(d.asset))
-			
+
 			if self.purpose == 'Transfer':
 				if d.to_employee:
 					frappe.throw(_("Transferring cannot be done to an Employee. \
@@ -57,7 +57,7 @@
 					frappe.throw(_("Target Location is required while transferring Asset {0}").format(d.asset))
 				if d.source_location == d.target_location:
 					frappe.throw(_("Source and Target Location cannot be same"))
-			
+
 			if self.purpose == 'Receipt':
 				# only when asset is bought and first entry is made
 				if not d.source_location and not (d.target_location or d.to_employee):
@@ -80,14 +80,14 @@
 					if current_custodian != d.from_employee:
 						frappe.throw(_("Asset {0} does not belongs to the custodian {1}").
 							format(d.asset, d.from_employee))
-			
+
 			if d.to_employee and frappe.db.get_value("Employee", d.to_employee, "company") != self.company:
 				frappe.throw(_("Employee {0} does not belongs to the company {1}").
 							format(d.to_employee, self.company))
 
 	def on_submit(self):
 		self.set_latest_location_in_asset()
-		
+
 	def on_cancel(self):
 		self.set_latest_location_in_asset()
 
@@ -105,12 +105,12 @@
 			# In case of cancellation it corresponds to previous latest document's location, employee
 			latest_movement_entry = frappe.db.sql(
 				"""
-				SELECT asm_item.target_location, asm_item.to_employee 
+				SELECT asm_item.target_location, asm_item.to_employee
 				FROM `tabAsset Movement Item` asm_item, `tabAsset Movement` asm
-				WHERE 
+				WHERE
 					asm_item.parent=asm.name and
 					asm_item.asset=%(asset)s and
-					asm.company=%(company)s and 
+					asm.company=%(company)s and
 					asm.docstatus=1 and {0}
 				ORDER BY
 					asm.transaction_date desc limit 1
diff --git a/erpnext/assets/doctype/asset_repair/asset_repair.js b/erpnext/assets/doctype/asset_repair/asset_repair.js
index 1cebfff..18a56d3 100644
--- a/erpnext/assets/doctype/asset_repair/asset_repair.js
+++ b/erpnext/assets/doctype/asset_repair/asset_repair.js
@@ -59,7 +59,7 @@
 
 		if (frm.doc.repair_status == "Completed") {
 			frm.set_value('completion_date', frappe.datetime.now_datetime());
-		}				
+		}
 	}
 });
 
@@ -68,4 +68,4 @@
 		var row = locals[cdt][cdn];
 		frappe.model.set_value(cdt, cdn, 'total_value', row.consumed_quantity * row.valuation_rate);
 	},
-});
\ No newline at end of file
+});
diff --git a/erpnext/assets/doctype/asset_repair/asset_repair.py b/erpnext/assets/doctype/asset_repair/asset_repair.py
index d32fdf7..746f582 100644
--- a/erpnext/assets/doctype/asset_repair/asset_repair.py
+++ b/erpnext/assets/doctype/asset_repair/asset_repair.py
@@ -18,7 +18,7 @@
 		if self.get('stock_items'):
 			self.set_total_value()
 		self.calculate_total_repair_cost()
-		
+
 	def update_status(self):
 		if self.repair_status == 'Pending':
 			frappe.db.set_value('Asset', self.asset, 'status', 'Out of Order')
@@ -98,7 +98,7 @@
 
 				if self.capitalize_repair_cost:
 					row.value_after_depreciation -= self.repair_cost
-		
+
 	def get_total_value_of_stock_consumed(self):
 		total_value_of_stock_consumed = 0
 		if self.get('stock_consumption'):
@@ -141,7 +141,7 @@
 		gl_entries = []
 		repair_and_maintenance_account = frappe.db.get_value('Company', self.company, 'repair_and_maintenance_account')
 		fixed_asset_account = get_asset_account("fixed_asset_account", asset=self.asset, company=self.company)
-		expense_account = frappe.get_doc('Purchase Invoice', self.purchase_invoice).items[0].expense_account	
+		expense_account = frappe.get_doc('Purchase Invoice', self.purchase_invoice).items[0].expense_account
 
 		gl_entries.append(
 			self.get_gl_dict({
@@ -149,7 +149,7 @@
 				"credit": self.repair_cost,
 				"credit_in_account_currency": self.repair_cost,
 				"against": repair_and_maintenance_account,
-				"voucher_type": self.doctype,		
+				"voucher_type": self.doctype,
 				"voucher_no": self.name,
 				"cost_center": self.cost_center,
 				"posting_date": getdate(),
@@ -167,7 +167,7 @@
 						"credit": item.amount,
 						"credit_in_account_currency": item.amount,
 						"against": repair_and_maintenance_account,
-						"voucher_type": self.doctype,		
+						"voucher_type": self.doctype,
 						"voucher_no": self.name,
 						"cost_center": self.cost_center,
 						"posting_date": getdate(),
diff --git a/erpnext/assets/doctype/asset_repair/asset_repair_list.js b/erpnext/assets/doctype/asset_repair/asset_repair_list.js
index f36fd2f..86376f4 100644
--- a/erpnext/assets/doctype/asset_repair/asset_repair_list.js
+++ b/erpnext/assets/doctype/asset_repair/asset_repair_list.js
@@ -10,4 +10,3 @@
 		}
 	}
 };
-
diff --git a/erpnext/assets/doctype/asset_repair/test_asset_repair.py b/erpnext/assets/doctype/asset_repair/test_asset_repair.py
index 30bbb37..5e727d0 100644
--- a/erpnext/assets/doctype/asset_repair/test_asset_repair.py
+++ b/erpnext/assets/doctype/asset_repair/test_asset_repair.py
@@ -41,7 +41,7 @@
 		self.assertEqual(total_repair_cost, asset_repair.repair_cost)
 		for item in asset_repair.stock_items:
 			total_repair_cost += item.total_value
-			
+
 		self.assertEqual(total_repair_cost, asset_repair.total_repair_cost)
 
 	def test_repair_status_after_submit(self):
@@ -99,7 +99,7 @@
 		initial_num_of_depreciations = num_of_depreciations(asset)
 		create_asset_repair(asset= asset, capitalize_repair_cost = 1, submit = 1)
 		asset.reload()
-	
+
 		self.assertEqual((initial_num_of_depreciations + 1), num_of_depreciations(asset))
 		self.assertEqual(asset.schedules[-1].accumulated_depreciation_amount, asset.finance_books[0].value_after_depreciation)
 
@@ -139,7 +139,7 @@
 		})
 
 	asset_repair.insert(ignore_if_duplicate=True)
-	
+
 	if args.submit:
 		asset_repair.repair_status = "Completed"
 		asset_repair.cost_center = "_Test Cost Center - _TC"
@@ -165,4 +165,4 @@
 			asset_repair.purchase_invoice = make_purchase_invoice().name
 
 		asset_repair.submit()
-	return asset_repair
\ No newline at end of file
+	return asset_repair
diff --git a/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py b/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py
index 03dc47b..a9dc979 100644
--- a/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py
+++ b/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py
@@ -91,4 +91,4 @@
 		"cost_center": args.cost_center or "Main - _TC"
 	}).insert()
 
-	return doc
\ No newline at end of file
+	return doc
diff --git a/erpnext/assets/doctype/location/location_tree.js b/erpnext/assets/doctype/location/location_tree.js
index b405afd..3e105f6 100644
--- a/erpnext/assets/doctype/location/location_tree.js
+++ b/erpnext/assets/doctype/location/location_tree.js
@@ -30,4 +30,4 @@
 	onload: function (treeview) {
 		treeview.make_tree();
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.js b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.js
index 1a6ef54..75f42a9 100644
--- a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.js
+++ b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.js
@@ -76,7 +76,7 @@
 			fieldtype: "Link",
 			options: "Asset Category"
 		},
-		{	
+		{
 			fieldname:"finance_book",
 			label: __("Finance Book"),
 			fieldtype: "Link",
diff --git a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py
index d1457b9..7d07397 100644
--- a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py
+++ b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py
@@ -99,7 +99,7 @@
 	labels_values_map = {}
 	date_field = frappe.scrub(filters.date_based_on)
 
-	period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, 
+	period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
 		filters.from_date, filters.to_date, filters.filter_based_on, "Monthly", company=filters.company)
 
 	for d in period_list:
@@ -293,4 +293,4 @@
 			"options": "Location",
 			"width": 100
 		},
-	]
\ No newline at end of file
+	]
diff --git a/erpnext/buying/doctype/buying_settings/buying_settings.js b/erpnext/buying/doctype/buying_settings/buying_settings.js
index e496e96..944bb61 100644
--- a/erpnext/buying/doctype/buying_settings/buying_settings.js
+++ b/erpnext/buying/doctype/buying_settings/buying_settings.js
@@ -28,4 +28,4 @@
 		title: "Purchase Receipt Required for Purchase Invoice Creation",
 		description: __("If this option is configured 'Yes', ERPNext will prevent you from creating a Purchase Invoice without creating a Purchase Receipt first. This configuration can be overridden for a particular supplier by enabling the 'Allow Purchase Invoice Creation Without Purchase Receipt' checkbox in the Supplier master.")
 	}
-];
\ No newline at end of file
+];
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index bb0ad60..a55a0b7 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -565,6 +565,7 @@
    "fieldname": "scan_barcode",
    "fieldtype": "Data",
    "label": "Scan Barcode",
+   "options": "Barcode",
    "show_days": 1,
    "show_seconds": 1
   },
@@ -1378,7 +1379,7 @@
  "idx": 105,
  "is_submittable": 1,
  "links": [],
- "modified": "2021-05-30 15:17:53.663648",
+ "modified": "2021-08-17 20:16:12.737743",
  "modified_by": "Administrator",
  "module": "Buying",
  "name": "Purchase Order",
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index a0b1e07..ca3bd90 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -635,4 +635,4 @@
 		'item_code': row.item_details['rm_item_code'],
 		'subcontracted_item': row.item_details['main_item_code'],
 		'serial_no': '\n'.join(row.serial_no) if row.serial_no else ''
-	})
\ No newline at end of file
+	})
diff --git a/erpnext/buying/doctype/purchase_order/regional/india.js b/erpnext/buying/doctype/purchase_order/regional/india.js
index 42d3995..ef83f20 100644
--- a/erpnext/buying/doctype/purchase_order/regional/india.js
+++ b/erpnext/buying/doctype/purchase_order/regional/india.js
@@ -1,3 +1,3 @@
 {% include "erpnext/regional/india/taxes.js" %}
 
-erpnext.setup_auto_gst_taxation('Purchase Order');
\ No newline at end of file
+erpnext.setup_auto_gst_taxation('Purchase Order');
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index d668c76..fa174ba 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -485,7 +485,7 @@
 
 	def test_make_purchase_invoice_with_terms(self):
 		from erpnext.selling.doctype.sales_order.test_sales_order import automatically_fetch_payment_terms, compare_payment_schedules
-		
+
 		automatically_fetch_payment_terms()
 		po = create_purchase_order(do_not_save=True)
 
diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js
index 5d19687..012b061 100644
--- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js
@@ -77,4 +77,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_get_items.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_get_items.js
index 8c0c144..bc3d767 100644
--- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_get_items.js
+++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_get_items.js
@@ -58,4 +58,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_discount_on_grand_total.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_discount_on_grand_total.js
index 4e73ab8..83eb295 100644
--- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_discount_on_grand_total.js
+++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_discount_on_grand_total.js
@@ -44,4 +44,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_item_wise_discount.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_item_wise_discount.js
index 1e54e50..a729dd9 100644
--- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_item_wise_discount.js
+++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_item_wise_discount.js
@@ -41,4 +41,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_multi_uom.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_multi_uom.js
index bf2dfeb..b605e76 100644
--- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_multi_uom.js
+++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_multi_uom.js
@@ -36,4 +36,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_shipping_rule.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_shipping_rule.js
index 96775eb..c258756 100644
--- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_shipping_rule.js
+++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_shipping_rule.js
@@ -40,4 +40,4 @@
 		() => frappe.timeout(0.3),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_taxes_and_charges.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_taxes_and_charges.js
index 39716ed..ccc383f 100644
--- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_taxes_and_charges.js
+++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_taxes_and_charges.js
@@ -41,4 +41,4 @@
 		() => frappe.timeout(0.3),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py
index 8bdcd47..b6e28b6 100644
--- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py
+++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py
@@ -10,4 +10,4 @@
 	pass
 
 def on_doctype_update():
-	frappe.db.add_index("Purchase Order Item", ["item_code", "warehouse"])
\ No newline at end of file
+	frappe.db.add_index("Purchase Order Item", ["item_code", "warehouse"])
diff --git a/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.py b/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.py
index 6caffbd..c85ca2f 100644
--- a/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.py
+++ b/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class PurchaseOrderItemSupplied(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.py b/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.py
index 1a76f0e..00c93ed 100644
--- a/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.py
+++ b/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class PurchaseReceiptItemSupplied(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
index a4ce84e..8ed6c9e 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
@@ -425,4 +425,4 @@
 		.format(filters.get("supplier"), filters.get("company"), conditions),
 			{"page_len": page_len, "start": start}, as_dict=1)
 
-	return rfq_data
\ No newline at end of file
+	return rfq_data
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py
index 6efbc78..751336d 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py
@@ -10,4 +10,4 @@
 				'items': ['Supplier Quotation']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation.js
index 1fcfe75..75f85f8 100644
--- a/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation.js
+++ b/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation.js
@@ -73,4 +73,4 @@
 		() => frappe.click_button('Close'),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation_for_status.js b/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation_for_status.js
index 2e1652d..f06c3f3 100644
--- a/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation_for_status.js
+++ b/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation_for_status.js
@@ -125,4 +125,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/buying/doctype/supplier/regional/india.js b/erpnext/buying/doctype/supplier/regional/india.js
index bd710e0..5f49a47 100644
--- a/erpnext/buying/doctype/supplier/regional/india.js
+++ b/erpnext/buying/doctype/supplier/regional/india.js
@@ -1,3 +1,3 @@
 {% include "erpnext/regional/india/party.js" %}
 
-erpnext.setup_gst_reminder_button('Supplier');
\ No newline at end of file
+erpnext.setup_gst_reminder_button('Supplier');
diff --git a/erpnext/buying/doctype/supplier/test_supplier.js b/erpnext/buying/doctype/supplier/test_supplier.js
index bf7c192..eaa4d09 100644
--- a/erpnext/buying/doctype/supplier/test_supplier.js
+++ b/erpnext/buying/doctype/supplier/test_supplier.js
@@ -74,4 +74,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/buying/doctype/supplier_item_group/supplier_item_group.py b/erpnext/buying/doctype/supplier_item_group/supplier_item_group.py
index 3a2e5d6..4473dde 100644
--- a/erpnext/buying/doctype/supplier_item_group/supplier_item_group.py
+++ b/erpnext/buying/doctype/supplier_item_group/supplier_item_group.py
@@ -15,4 +15,4 @@
 			'item_group': self.item_group
 		})
 		if exists:
-			frappe.throw(_("Item Group has already been linked to this supplier."))
\ No newline at end of file
+			frappe.throw(_("Item Group has already been linked to this supplier."))
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
index 6a4c02c..25e4e2a 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
@@ -166,4 +166,4 @@
 			`tabSupplier Quotation` SET `status` = 'Expired'
 		WHERE
 			`status` not in ('Cancelled', 'Stopped') AND `valid_till` < %s
-		""", (nowdate()))
\ No newline at end of file
+		""", (nowdate()))
diff --git a/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js
index 2d2b29c..20fb430 100644
--- a/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js
+++ b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js
@@ -71,4 +71,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_item_wise_discount.js b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_item_wise_discount.js
index b151824..0a51565 100644
--- a/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_item_wise_discount.js
+++ b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_item_wise_discount.js
@@ -31,4 +31,4 @@
 		() => frappe.timeout(0.3),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js
index e37731e..7ea3e60 100644
--- a/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js
+++ b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js
@@ -34,4 +34,4 @@
 		() => frappe.timeout(0.3),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.js b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.js
index 5f5f54b..b4cd852 100644
--- a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.js
+++ b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.js
@@ -93,5 +93,3 @@
 		}
 	});
 };
-
-
diff --git a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard_dashboard.py b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard_dashboard.py
index 3d2305e..8e5cce5 100644
--- a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard_dashboard.py
+++ b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard_dashboard.py
@@ -13,4 +13,4 @@
 				'items': ['Supplier Scorecard Period']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py b/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py
index 2528240..a5f05ea 100644
--- a/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py
+++ b/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py
@@ -128,4 +128,3 @@
 		"weighting_function":"{total_score} * max( 0, min ( 1 , (12 - {period_number}) / 12) )"
 	}
 ]
-
diff --git a/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py b/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py
index 4eef4b4..3babfc8 100644
--- a/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py
+++ b/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py
@@ -72,4 +72,4 @@
 		"criteria_name":"Fake Criteria 3",
 		"max_score":100.0
 	},
-]
\ No newline at end of file
+]
diff --git a/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.py b/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.py
index 9938710..cc345e9 100644
--- a/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.py
+++ b/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.py
@@ -109,4 +109,3 @@
 	}, target_doc, post_process, ignore_permissions=True)
 
 	return doc
-
diff --git a/erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.py b/erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.py
index 1ba5d06..678855a 100644
--- a/erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.py
+++ b/erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.py
@@ -26,4 +26,4 @@
 			`tabSupplier Scorecard Standing` scs""",
 			{}, as_dict=1)
 
-	return standings
\ No newline at end of file
+	return standings
diff --git a/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py b/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py
index 37fdc57..89a6459 100644
--- a/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py
+++ b/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py
@@ -493,4 +493,4 @@
 		total_sq_days = 0
 
 
-	return total_sq_days
\ No newline at end of file
+	return total_sq_days
diff --git a/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py b/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py
index fe6dde5..14b8710 100644
--- a/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py
+++ b/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py
@@ -54,4 +54,4 @@
 		"variable_label":"Fake Variable 1",
 		"path":"get_fake_variable1"
 	},
-]
\ No newline at end of file
+]
diff --git a/erpnext/buying/print_format/drop_shipping_format/drop_shipping_format.json b/erpnext/buying/print_format/drop_shipping_format/drop_shipping_format.json
index 0c7cad6..2e2a048 100644
--- a/erpnext/buying/print_format/drop_shipping_format/drop_shipping_format.json
+++ b/erpnext/buying/print_format/drop_shipping_format/drop_shipping_format.json
@@ -13,6 +13,6 @@
  "name": "Drop Shipping Format", 
  "owner": "Administrator", 
  "print_format_builder": 0, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/buying/report/procurement_tracker/procurement_tracker.py b/erpnext/buying/report/procurement_tracker/procurement_tracker.py
index beeca09..99bcbe6 100644
--- a/erpnext/buying/report/procurement_tracker/procurement_tracker.py
+++ b/erpnext/buying/report/procurement_tracker/procurement_tracker.py
@@ -296,4 +296,4 @@
 			{conditions}
 		GROUP BY
 			parent.name, child.item_code
-		""".format(conditions=conditions), as_dict=1) #nosec
\ No newline at end of file
+		""".format(conditions=conditions), as_dict=1) #nosec
diff --git a/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py b/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py
index 44ab767..c36083f 100644
--- a/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py
+++ b/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py
@@ -68,4 +68,4 @@
 			"actual_delivery_date": date_obj
 		}
 
-		return expected_data
\ No newline at end of file
+		return expected_data
diff --git a/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py b/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py
index 89be622..bda1727 100644
--- a/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py
+++ b/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py
@@ -268,4 +268,3 @@
 	])
 
 	return columns
-
diff --git a/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js b/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js
index 83d25d8..90919dc 100644
--- a/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js
+++ b/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js
@@ -5,4 +5,4 @@
 	frappe.query_reports["Purchase Order Trends"] = {
 		filters: erpnext.get_purchase_trends_filters()
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/buying/report/purchase_order_trends/purchase_order_trends.py b/erpnext/buying/report/purchase_order_trends/purchase_order_trends.py
index 1ed6cad..095a443 100644
--- a/erpnext/buying/report/purchase_order_trends/purchase_order_trends.py
+++ b/erpnext/buying/report/purchase_order_trends/purchase_order_trends.py
@@ -55,4 +55,4 @@
 		"lineOptions": {
 			"regionFill": 1
 		}
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/buying/report/subcontract_order_summary/subcontract_order_summary.py b/erpnext/buying/report/subcontract_order_summary/subcontract_order_summary.py
index 0c0d4f0..9a45972 100644
--- a/erpnext/buying/report/subcontract_order_summary/subcontract_order_summary.py
+++ b/erpnext/buying/report/subcontract_order_summary/subcontract_order_summary.py
@@ -149,4 +149,4 @@
 			"fieldtype": "Float",
 			"width": 110
 		}
-	]
\ No newline at end of file
+	]
diff --git a/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py b/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py
index d8de701..cb304a1 100644
--- a/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py
+++ b/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py
@@ -33,4 +33,4 @@
 	pr.items[0].qty = quantity
 	pr.supplier_warehouse = '_Test Warehouse 1 - _TC'
 	pr.insert()
-	pr.submit()
\ No newline at end of file
+	pr.submit()
diff --git a/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py b/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py
index 68426ab..96cacb6 100644
--- a/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py
+++ b/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py
@@ -94,4 +94,4 @@
 			["Purchase Order", "transaction_date", ">=", filters.from_date],
 			["Purchase Order", "docstatus", "=", 1]
 		]
-	)
\ No newline at end of file
+	)
diff --git a/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.html b/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.html
index 098214d..015b31c 100644
--- a/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.html
+++ b/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.html
@@ -129,4 +129,4 @@
 
 
 
-<p class="text-right text-muted">Printed On {%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}</p>
\ No newline at end of file
+<p class="text-right text-muted">Printed On {%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}</p>
diff --git a/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.js b/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.js
index 80e521a..7a8d08d 100644
--- a/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.js
+++ b/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.js
@@ -174,4 +174,4 @@
 		});
 		dialog.show();
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.py b/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.py
index 2b37191..a5a3105 100644
--- a/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.py
+++ b/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.py
@@ -263,4 +263,4 @@
 		&nbsp;&nbsp;
 		<span class="indicator red">
 		Expires today / Already Expired
-		</span>"""
\ No newline at end of file
+		</span>"""
diff --git a/erpnext/buying/utils.py b/erpnext/buying/utils.py
index a73cb0d..1792863 100644
--- a/erpnext/buying/utils.py
+++ b/erpnext/buying/utils.py
@@ -102,4 +102,3 @@
 			mr_list.append(material_request)
 
 	return mr_list
-
diff --git a/erpnext/commands/__init__.py b/erpnext/commands/__init__.py
index a991cf9..2276c73 100644
--- a/erpnext/commands/__init__.py
+++ b/erpnext/commands/__init__.py
@@ -46,4 +46,4 @@
 
 commands = [
 	make_demo
-]
\ No newline at end of file
+]
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 4c79a5c..01d354d 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -135,14 +135,9 @@
 
 		validate_regional(self)
 
-		validate_einvoice_fields(self)
-
 		if self.doctype != 'Material Request':
 			apply_pricing_rule_on_transaction(self)
 
-	def before_cancel(self):
-		validate_einvoice_fields(self)
-
 	def on_trash(self):
 		# delete sl and gl entries on deletion of transaction
 		if frappe.db.get_single_value('Accounts Settings', 'delete_linked_ledger_entries'):
@@ -842,7 +837,7 @@
 				dr_or_cr = "credit"
 				rev_dr_cr = "debit"
 				supplier_or_customer = self.supplier
-	
+
 			else:
 				dr_or_cr = "debit"
 				rev_dr_cr = "credit"
@@ -853,11 +848,11 @@
 					discount_amount = item.discount_amount * item.qty
 					if self.doctype == "Purchase Invoice":
 						income_or_expense_account = (item.expense_account
-							if (not item.enable_deferred_expense or self.is_return) 
+							if (not item.enable_deferred_expense or self.is_return)
 							else item.deferred_expense_account)
 					else:
 						income_or_expense_account = (item.income_account
-							if (not item.enable_deferred_revenue or self.is_return) 
+							if (not item.enable_deferred_revenue or self.is_return)
 							else item.deferred_revenue_account)
 
 					account_currency = get_account_currency(item.discount_account)
@@ -866,7 +861,7 @@
 							"account": item.discount_account,
 							"against": supplier_or_customer,
 							dr_or_cr: flt(discount_amount, item.precision('discount_amount')),
-							dr_or_cr + "_in_account_currency": flt(discount_amount * self.get('conversion_rate'), 
+							dr_or_cr + "_in_account_currency": flt(discount_amount * self.get('conversion_rate'),
 								item.precision('discount_amount')),
 							"cost_center": item.cost_center,
 							"project": item.project
@@ -879,7 +874,7 @@
 							"account": income_or_expense_account,
 							"against": supplier_or_customer,
 							rev_dr_cr: flt(discount_amount, item.precision('discount_amount')),
-							rev_dr_cr + "_in_account_currency": flt(discount_amount * self.get('conversion_rate'), 
+							rev_dr_cr + "_in_account_currency": flt(discount_amount * self.get('conversion_rate'),
 								item.precision('discount_amount')),
 							"cost_center": item.cost_center,
 							"project": item.project or self.project
@@ -894,8 +889,8 @@
 						dr_or_cr: self.discount_amount,
 						"cost_center": self.cost_center
 					}, item=self)
-				)		
-										
+				)
+
 	def allocate_advance_taxes(self, gl_entries):
 		tax_map = self.get_tax_map()
 		for pe in self.get("advances"):
@@ -1223,7 +1218,7 @@
 			po_or_so = self.get('items')[0].get('purchase_order')
 			po_or_so_doctype = "Purchase Order"
 			po_or_so_doctype_name = "purchase_order"
-		
+
 		return po_or_so, po_or_so_doctype, po_or_so_doctype_name
 
 	def linked_order_has_payment_terms(self, po_or_so, fieldname, doctype):
@@ -1232,14 +1227,14 @@
 				return True
 			elif self.linked_order_has_payment_schedule(po_or_so):
 				return True
-		
+
 		return False
 
 	def all_items_have_same_po_or_so(self, po_or_so, fieldname):
 		for item in self.get('items'):
 			if item.get(fieldname) != po_or_so:
 				return False
-		
+
 		return True
 
 	def linked_order_has_payment_terms_template(self, po_or_so, doctype):
@@ -1841,6 +1836,11 @@
 
 	for d in data:
 		new_child_flag = False
+
+		if not d.get("item_code"):
+			# ignore empty rows
+			continue
+
 		if not d.get("docname"):
 			new_child_flag = True
 			check_doc_permissions(parent, 'create')
@@ -1863,7 +1863,7 @@
 			qty_unchanged = prev_qty == new_qty
 			uom_unchanged = prev_uom == new_uom
 			conversion_factor_unchanged = prev_con_fac == new_con_fac
-			date_unchanged = prev_date == new_date if prev_date and new_date else False # in case of delivery note etc
+			date_unchanged = prev_date == getdate(new_date) if prev_date and new_date else False # in case of delivery note etc
 			if rate_unchanged and qty_unchanged and conversion_factor_unchanged and uom_unchanged and date_unchanged:
 				continue
 
@@ -1975,7 +1975,3 @@
 @erpnext.allow_regional
 def validate_regional(doc):
 	pass
-
-@erpnext.allow_regional
-def validate_einvoice_fields(doc):
-	pass
\ No newline at end of file
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index 051481f..8c361a2 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -344,4 +344,3 @@
 			variant.name = variant.item_code
 			validate_item_variant_attributes(variant, args)
 	return variant.as_dict()
-
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index 21c052a..4b4c8be 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -526,6 +526,9 @@
 	if meta.is_tree:
 		query_filters.append(['is_group', '=', 0])
 
+	if meta.has_field('disabled'):
+		query_filters.append(['disabled', '!=', 1])
+
 	if meta.has_field('company'):
 		query_filters.append(['company', '=', filters.get('company')])
 
diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py
index 80ccc6d..5ee1f2f 100644
--- a/erpnext/controllers/sales_and_purchase_return.py
+++ b/erpnext/controllers/sales_and_purchase_return.py
@@ -329,7 +329,6 @@
 			target_doc.po_detail = source_doc.po_detail
 			target_doc.pr_detail = source_doc.pr_detail
 			target_doc.purchase_invoice_item = source_doc.name
-			target_doc.price_list_rate = 0
 
 		elif doctype == "Delivery Note":
 			returned_qty_map = get_returned_qty_map_for_row(source_doc.name, doctype)
@@ -360,7 +359,6 @@
 			else:
 				target_doc.pos_invoice_item = source_doc.name
 
-			target_doc.price_list_rate = 0
 			if default_warehouse_for_sales_return:
 				target_doc.warehouse = default_warehouse_for_sales_return
 
diff --git a/erpnext/controllers/subcontracting.py b/erpnext/controllers/subcontracting.py
index 36ae110..969829f 100644
--- a/erpnext/controllers/subcontracting.py
+++ b/erpnext/controllers/subcontracting.py
@@ -390,4 +390,4 @@
 				incorrect_sn = "\n".join(incorrect_sn)
 				link = get_link_to_form('Purchase Order', row.purchase_order)
 				msg = f'The Serial Nos {incorrect_sn} has not supplied against the Purchase Order {link}'
-				frappe.throw(_(msg), title=_("Incorrect Serial Number Consumed"))
\ No newline at end of file
+				frappe.throw(_(msg), title=_("Incorrect Serial Number Consumed"))
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index 05edb25..7c6d355 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -595,7 +595,8 @@
 				self.doc.precision("outstanding_amount"))
 
 			if self.doc.doctype == 'Sales Invoice' and self.doc.get('is_pos') and self.doc.get('is_return'):
-			 	self.update_paid_amount_for_return(total_amount_to_pay)
+				self.set_total_amount_to_default_mop(total_amount_to_pay)
+				self.calculate_paid_amount()
 
 	def calculate_paid_amount(self):
 
@@ -675,7 +676,7 @@
 	def set_item_wise_tax_breakup(self):
 		self.doc.other_charges_calculation = get_itemised_tax_breakup_html(self.doc)
 
-	def update_paid_amount_for_return(self, total_amount_to_pay):
+	def set_total_amount_to_default_mop(self, total_amount_to_pay):
 		default_mode_of_payment = frappe.db.get_value('POS Payment Method',
 			{'parent': self.doc.pos_profile, 'default': 1}, ['mode_of_payment'], as_dict=1)
 
@@ -685,9 +686,7 @@
 				'mode_of_payment': default_mode_of_payment.mode_of_payment,
 				'amount': total_amount_to_pay,
 				'default': 1
-			})
-
-		self.calculate_paid_amount()
+			})	
 
 def get_itemised_tax_breakup_html(doc):
 	if not doc.taxes:
diff --git a/erpnext/crm/doctype/appointment/appointment.py b/erpnext/crm/doctype/appointment/appointment.py
index df73f09..f7c6b6c 100644
--- a/erpnext/crm/doctype/appointment/appointment.py
+++ b/erpnext/crm/doctype/appointment/appointment.py
@@ -235,4 +235,3 @@
 		# frappe.db.exists returns a tuple of a tuple
 		return frappe.get_doc('Employee', employee_docname[0][0])
 	return None
-
diff --git a/erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.js b/erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.js
index dc3ae8b..0c64eb8 100644
--- a/erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.js
+++ b/erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.js
@@ -7,4 +7,4 @@
 			frappe.throw(__('In row {0} of Appointment Booking Slots: "To Time" must be later than "From Time".', [i + 1]));
 		}
 	});
-}
\ No newline at end of file
+}
diff --git a/erpnext/crm/doctype/contract/contract.js b/erpnext/crm/doctype/contract/contract.js
index 9968855..7848de7 100644
--- a/erpnext/crm/doctype/contract/contract.js
+++ b/erpnext/crm/doctype/contract/contract.js
@@ -15,7 +15,7 @@
 						let contract_template = r.message.contract_template;
 						frm.set_value("contract_terms", r.message.contract_terms);
 						frm.set_value("requires_fulfilment", contract_template.requires_fulfilment);
-						
+
 						if (frm.doc.requires_fulfilment) {
 							// Populate the fulfilment terms table from a contract template, if any
 							r.message.contract_template.fulfilment_terms.forEach(element => {
@@ -23,7 +23,7 @@
 								d.requirement = element.requirement;
 							});
 							frm.refresh_field("fulfilment_terms");
-						}		
+						}
 					}
 				}
 			});
diff --git a/erpnext/crm/doctype/contract/contract_list.js b/erpnext/crm/doctype/contract/contract_list.js
index 26a2907..7d56096 100644
--- a/erpnext/crm/doctype/contract/contract_list.js
+++ b/erpnext/crm/doctype/contract/contract_list.js
@@ -9,4 +9,4 @@
 			return [__(doc.status), "gray", "status,=," + doc.status];
 		}
 	},
-};
\ No newline at end of file
+};
diff --git a/erpnext/crm/doctype/contract_template/contract_template.py b/erpnext/crm/doctype/contract_template/contract_template.py
index 69fd86f..9281220 100644
--- a/erpnext/crm/doctype/contract_template/contract_template.py
+++ b/erpnext/crm/doctype/contract_template/contract_template.py
@@ -24,8 +24,8 @@
 
 	if contract_template.contract_terms:
 		contract_terms = frappe.render_template(contract_template.contract_terms, doc)
-	
+
 	return {
-		'contract_template': contract_template, 
+		'contract_template': contract_template,
 		'contract_terms': contract_terms
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py
index 7f028cb..cad17a3 100644
--- a/erpnext/crm/doctype/lead/lead.py
+++ b/erpnext/crm/doctype/lead/lead.py
@@ -34,9 +34,10 @@
 			"ends_on": frappe.db.get_value("Lead", self.name, "ends_on") if (not cint(self.is_new())) else None,
 			"contact_by": frappe.db.get_value("Lead", self.name, "contact_by") if (not cint(self.is_new())) else None,
 		})
-		
+
 	def set_full_name(self):
-		self.lead_name = " ".join(filter(None, [self.first_name, self.middle_name, self.last_name]))
+		if self.first_name:
+			self.lead_name = " ".join(filter(None, [self.first_name, self.middle_name, self.last_name]))
 
 	def validate_email_id(self):
 		if self.email_id:
diff --git a/erpnext/crm/doctype/lead/lead_dashboard.py b/erpnext/crm/doctype/lead/lead_dashboard.py
index 69d8ca7..3950d06 100644
--- a/erpnext/crm/doctype/lead/lead_dashboard.py
+++ b/erpnext/crm/doctype/lead/lead_dashboard.py
@@ -16,4 +16,4 @@
 				'items': ['Opportunity', 'Quotation']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/crm/doctype/lead/test_lead.py b/erpnext/crm/doctype/lead/test_lead.py
index d4886d3..d7bc461 100644
--- a/erpnext/crm/doctype/lead/test_lead.py
+++ b/erpnext/crm/doctype/lead/test_lead.py
@@ -82,4 +82,4 @@
 		"email_id": args.email_id or "new_lead_{}@example.com".format(random_string(5)),
 	}).insert()
 
-	return lead_doc
\ No newline at end of file
+	return lead_doc
diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js
index e9a7a95..632012b 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.js
+++ b/erpnext/crm/doctype/opportunity/opportunity.js
@@ -57,7 +57,7 @@
 		if (frm.doc.status == "Lost"){
 			frm.trigger('set_as_lost_dialog');
 		}
-	
+
 	},
 
 	customer_address: function(frm, cdt, cdn) {
diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py
index 23ad98a..8ce482a 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.py
+++ b/erpnext/crm/doctype/opportunity/opportunity.py
@@ -372,4 +372,4 @@
 			"start": start,
 			"end": end
 		}, as_dict=True, update={"allDay": 0})
-	return data
\ No newline at end of file
+	return data
diff --git a/erpnext/crm/doctype/opportunity/opportunity_dashboard.py b/erpnext/crm/doctype/opportunity/opportunity_dashboard.py
index 68f0104..b8c53f0 100644
--- a/erpnext/crm/doctype/opportunity/opportunity_dashboard.py
+++ b/erpnext/crm/doctype/opportunity/opportunity_dashboard.py
@@ -9,4 +9,4 @@
 				'items': ['Quotation', 'Supplier Quotation']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py
index 04cd8a2..52aa0b0 100644
--- a/erpnext/crm/doctype/opportunity/test_opportunity.py
+++ b/erpnext/crm/doctype/opportunity/test_opportunity.py
@@ -87,4 +87,4 @@
 		})
 
 	opp_doc.insert()
-	return opp_doc
\ No newline at end of file
+	return opp_doc
diff --git a/erpnext/crm/doctype/social_media_post/social_media_post.js b/erpnext/crm/doctype/social_media_post/social_media_post.js
index 0ce8b44..6fb0f97 100644
--- a/erpnext/crm/doctype/social_media_post/social_media_post.js
+++ b/erpnext/crm/doctype/social_media_post/social_media_post.js
@@ -19,7 +19,7 @@
 	refresh: function(frm){
         if (frm.doc.docstatus === 1){
             if (frm.doc.post_status != "Posted"){
-                add_post_btn(frm); 
+                add_post_btn(frm);
             }
             else if (frm.doc.post_status == "Posted"){
                 frm.set_df_property('sheduled_time', 'read_only', 1);
@@ -63,5 +63,5 @@
             frappe.dom.unfreeze();
         }
     })
-    
-}
\ No newline at end of file
+
+}
diff --git a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js
index 0bc77a3..f29c2c6 100644
--- a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js
+++ b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js
@@ -16,4 +16,3 @@
 		}
 	]
 };
-
diff --git a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py
index ec49883..238884b 100644
--- a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py
+++ b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py
@@ -132,4 +132,4 @@
 		where prevdoc_docname in (
 			select name from `tabQuotation` where status = 'Ordered'
 			and quotation_to = 'Lead' and party_name in (%s)
-		)""" % ', '.join(["%s"]*len(leads)), tuple(leads))[0][0]
\ No newline at end of file
+		)""" % ', '.join(["%s"]*len(leads)), tuple(leads))[0][0]
diff --git a/erpnext/crm/report/lead_conversion_time/lead_conversion_time.js b/erpnext/crm/report/lead_conversion_time/lead_conversion_time.js
index 0325de9..eeb8984 100644
--- a/erpnext/crm/report/lead_conversion_time/lead_conversion_time.js
+++ b/erpnext/crm/report/lead_conversion_time/lead_conversion_time.js
@@ -20,5 +20,3 @@
 		},
 	]
 };
-
-
diff --git a/erpnext/crm/report/lead_details/lead_details.js b/erpnext/crm/report/lead_details/lead_details.js
index f92070d..2f6d242 100644
--- a/erpnext/crm/report/lead_details/lead_details.js
+++ b/erpnext/crm/report/lead_details/lead_details.js
@@ -49,4 +49,4 @@
 			"options": "Territory",
 		}
 	]
-};
\ No newline at end of file
+};
diff --git a/erpnext/crm/report/lead_details/lead_details.py b/erpnext/crm/report/lead_details/lead_details.py
index eeaaec2..072a476 100644
--- a/erpnext/crm/report/lead_details/lead_details.py
+++ b/erpnext/crm/report/lead_details/lead_details.py
@@ -107,7 +107,7 @@
 			"options": "Country",
 			"width": 100
 		},
-		
+
 	]
 	return columns
 
@@ -142,7 +142,7 @@
 			company = %(company)s
 			AND `tabLead`.creation BETWEEN %(from_date)s AND %(to_date)s
 			{conditions}
-		ORDER BY 
+		ORDER BY
 			`tabLead`.creation asc """.format(conditions=get_conditions(filters)), filters, as_dict=1)
 
 def get_conditions(filters) :
@@ -153,6 +153,5 @@
 
 	if filters.get("status"):
 		conditions.append(" and `tabLead`.status=%(status)s")
-	
-	return " ".join(conditions) if conditions else ""
 
+	return " ".join(conditions) if conditions else ""
diff --git a/erpnext/crm/report/lost_opportunity/lost_opportunity.js b/erpnext/crm/report/lost_opportunity/lost_opportunity.js
index d79f8c8..97c56f8 100644
--- a/erpnext/crm/report/lost_opportunity/lost_opportunity.js
+++ b/erpnext/crm/report/lost_opportunity/lost_opportunity.js
@@ -64,4 +64,4 @@
 			"options": "User"
 		},
 	]
-};
\ No newline at end of file
+};
diff --git a/erpnext/crm/report/lost_opportunity/lost_opportunity.py b/erpnext/crm/report/lost_opportunity/lost_opportunity.py
index 1aa4afe..858dcc4 100644
--- a/erpnext/crm/report/lost_opportunity/lost_opportunity.py
+++ b/erpnext/crm/report/lost_opportunity/lost_opportunity.py
@@ -87,17 +87,17 @@
 			`tabOpportunity`.sales_stage,
 			`tabOpportunity`.territory
 		FROM
-			`tabOpportunity` 
+			`tabOpportunity`
 			{join}
 		WHERE
 			`tabOpportunity`.status = 'Lost' and `tabOpportunity`.company = %(company)s
-			AND `tabOpportunity`.modified BETWEEN %(from_date)s AND %(to_date)s 
-			{conditions} 
-		GROUP BY 
-			`tabOpportunity`.name 
-		ORDER BY 
+			AND `tabOpportunity`.modified BETWEEN %(from_date)s AND %(to_date)s
+			{conditions}
+		GROUP BY
+			`tabOpportunity`.name
+		ORDER BY
 			`tabOpportunity`.creation asc  """.format(conditions=get_conditions(filters), join=get_join(filters)), filters, as_dict=1)
-		
+
 
 def get_conditions(filters):
 	conditions = []
@@ -117,15 +117,15 @@
 	return " ".join(conditions) if conditions else ""
 
 def get_join(filters):
-	join = """LEFT JOIN `tabOpportunity Lost Reason Detail` 
-			ON `tabOpportunity Lost Reason Detail`.parenttype = 'Opportunity' and 
+	join = """LEFT JOIN `tabOpportunity Lost Reason Detail`
+			ON `tabOpportunity Lost Reason Detail`.parenttype = 'Opportunity' and
 			`tabOpportunity Lost Reason Detail`.parent = `tabOpportunity`.name"""
 
 	if filters.get("lost_reason"):
-		join = """JOIN `tabOpportunity Lost Reason Detail` 
-			ON `tabOpportunity Lost Reason Detail`.parenttype = 'Opportunity' and 
+		join = """JOIN `tabOpportunity Lost Reason Detail`
+			ON `tabOpportunity Lost Reason Detail`.parenttype = 'Opportunity' and
 			`tabOpportunity Lost Reason Detail`.parent = `tabOpportunity`.name and
 			`tabOpportunity Lost Reason Detail`.lost_reason = '{0}'
 			""".format(filters.get("lost_reason"))
-	
-	return join
\ No newline at end of file
+
+	return join
diff --git a/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py b/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py
index 3a9d57d..425b7a8 100644
--- a/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py
+++ b/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py
@@ -106,4 +106,4 @@
 	return lead_filters
 
 def get_creation_date_based_on_lead_age(filters):
-	return add_days(now(), (filters.get('lead_age') * -1))
\ No newline at end of file
+	return add_days(now(), (filters.get('lead_age') * -1))
diff --git a/erpnext/demo/domains.py b/erpnext/demo/domains.py
index d5c2bfd..b1db7b5 100644
--- a/erpnext/demo/domains.py
+++ b/erpnext/demo/domains.py
@@ -25,4 +25,4 @@
 	'Non Profit': {
 		'company_name': 'Erpnext Foundation'
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/demo/user/education.py b/erpnext/demo/user/education.py
index fc31176..883a6d8 100644
--- a/erpnext/demo/user/education.py
+++ b/erpnext/demo/user/education.py
@@ -19,7 +19,7 @@
 		approve_random_student_applicant()
 		enroll_random_student(frappe.flags.current_date)
 	# if frappe.flags.current_date.weekday()== 0:
-	# 	make_course_schedule(frappe.flags.current_date, frappe.utils.add_days(frappe.flags.current_date, 5))	
+	# 	make_course_schedule(frappe.flags.current_date, frappe.utils.add_days(frappe.flags.current_date, 5))
 	mark_student_attendance(frappe.flags.current_date)
 	# make_assessment_plan()
 	make_fees()
@@ -48,7 +48,7 @@
 		frappe.db.commit()
 		assign_student_group(enrollment.student, enrollment.student_name, enrollment.program,
 			enrolled_courses, enrollment.student_batch_name)
-		
+
 def assign_student_group(student, student_name, program, courses, batch):
 	course_list = [d["course"] for d in courses]
 	for d in frappe.get_list("Student Group", fields=("name"), filters={"program": program, "course":("in", course_list), "disabled": 0}):
@@ -69,11 +69,11 @@
 		students = get_student_group_students(d.name)
 		for stud in students:
 			make_attendance_records(stud.student, stud.student_name, status[weighted_choice([9,4])], None, d.name, current_date)
-			
+
 def make_fees():
 	for d in range(1,10):
 		random_fee = get_random("Fees", {"paid_amount": 0})
-		collect_fees(random_fee, frappe.db.get_value("Fees", random_fee, "outstanding_amount"))	
+		collect_fees(random_fee, frappe.db.get_value("Fees", random_fee, "outstanding_amount"))
 
 def make_assessment_plan(date):
 	for d in range(1,4):
@@ -84,7 +84,7 @@
 		doc.assessment_group = get_random("Assessment Group", {"is_group": 0, "parent": "2017-18 (Semester 2)"})
 		doc.grading_scale = get_random("Grading Scale")
 		doc.maximum_assessment_score = 100
-		
+
 def make_course_schedule(start_date, end_date):
 	for d in frappe.db.get_list("Student Group"):
 		cs = frappe.new_doc("Scheduling Tool")
@@ -114,4 +114,4 @@
 	rnd = random.random() * running_total
 	for i, total in enumerate(totals):
 		if rnd < total:
-			return i
\ No newline at end of file
+			return i
diff --git a/erpnext/domains/agriculture.py b/erpnext/domains/agriculture.py
index 8c7427a..9212d2e 100644
--- a/erpnext/domains/agriculture.py
+++ b/erpnext/domains/agriculture.py
@@ -25,4 +25,4 @@
 	],
 	'default_portal_role': 'System Manager',
 	'on_setup': 'erpnext.agriculture.setup.setup_agriculture'
-}
\ No newline at end of file
+}
diff --git a/erpnext/domains/education.py b/erpnext/domains/education.py
index bbaa6e5..870624a 100644
--- a/erpnext/domains/education.py
+++ b/erpnext/domains/education.py
@@ -26,4 +26,4 @@
 	],
 	'on_setup': 'erpnext.education.setup.setup_education'
 
-}
\ No newline at end of file
+}
diff --git a/erpnext/domains/manufacturing.py b/erpnext/domains/manufacturing.py
index 259ee92..b9ad49e 100644
--- a/erpnext/domains/manufacturing.py
+++ b/erpnext/domains/manufacturing.py
@@ -21,4 +21,4 @@
 		['Stock Settings', None, 'show_barcode_field', 1]
 	],
 	'default_portal_role': 'Customer'
-}
\ No newline at end of file
+}
diff --git a/erpnext/domains/non_profit.py b/erpnext/domains/non_profit.py
index b6772c5..7c4f6b1 100644
--- a/erpnext/domains/non_profit.py
+++ b/erpnext/domains/non_profit.py
@@ -21,4 +21,4 @@
 		'Non Profit'
 	],
 	'default_portal_role': 'Non Profit Manager'
-}
\ No newline at end of file
+}
diff --git a/erpnext/domains/services.py b/erpnext/domains/services.py
index 7a4ffc4..8921372 100644
--- a/erpnext/domains/services.py
+++ b/erpnext/domains/services.py
@@ -18,4 +18,4 @@
 		['Stock Settings', None, 'show_barcode_field', 0]
 	],
 	'default_portal_role': 'Customer'
-}
\ No newline at end of file
+}
diff --git a/erpnext/education/doctype/academic_term/academic_term.py b/erpnext/education/doctype/academic_term/academic_term.py
index 3aa0be15..fa7f289 100644
--- a/erpnext/education/doctype/academic_term/academic_term.py
+++ b/erpnext/education/doctype/academic_term/academic_term.py
@@ -22,9 +22,9 @@
 				and getdate(self.term_start_date) > getdate(self.term_end_date):
             frappe.throw(_("The Term End Date cannot be earlier than the Term Start Date. Please correct the dates and try again."))
 
-        # Check that the start of the term is not before the start of the academic year 
+        # Check that the start of the term is not before the start of the academic year
 		# and end of term is not after the end of the academic year"""
-			
+
         year = frappe.get_doc("Academic Year",self.academic_year)
         if self.term_start_date and getdate(year.year_start_date) and (getdate(self.term_start_date) < getdate(year.year_start_date)):
             frappe.throw(_("The Term Start Date cannot be earlier than the Year Start Date of the Academic Year to which the term is linked (Academic Year {}). Please correct the dates and try again.").format(self.academic_year))
diff --git a/erpnext/education/doctype/academic_term/academic_term_dashboard.py b/erpnext/education/doctype/academic_term/academic_term_dashboard.py
index 871e0f3..eb2f907 100644
--- a/erpnext/education/doctype/academic_term/academic_term_dashboard.py
+++ b/erpnext/education/doctype/academic_term/academic_term_dashboard.py
@@ -22,4 +22,4 @@
 				'items': ['Assessment Plan', 'Assessment Result']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/academic_term/test_academic_term.js b/erpnext/education/doctype/academic_term/test_academic_term.js
index 6d91e97..383b65a 100644
--- a/erpnext/education/doctype/academic_term/test_academic_term.js
+++ b/erpnext/education/doctype/academic_term/test_academic_term.js
@@ -21,4 +21,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/academic_year/academic_year.js b/erpnext/education/doctype/academic_year/academic_year.js
index 0e86198..20e2528 100644
--- a/erpnext/education/doctype/academic_year/academic_year.js
+++ b/erpnext/education/doctype/academic_year/academic_year.js
@@ -1,2 +1,2 @@
 frappe.ui.form.on("Academic Year", {
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/academic_year/academic_year_dashboard.py b/erpnext/education/doctype/academic_year/academic_year_dashboard.py
index f27f7d1..d3734df 100644
--- a/erpnext/education/doctype/academic_year/academic_year_dashboard.py
+++ b/erpnext/education/doctype/academic_year/academic_year_dashboard.py
@@ -22,4 +22,4 @@
 				'items': ['Assessment Plan', 'Assessment Result']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/academic_year/test_academic_year.js b/erpnext/education/doctype/academic_year/test_academic_year.js
index ec2f49c..51e9cf3 100644
--- a/erpnext/education/doctype/academic_year/test_academic_year.js
+++ b/erpnext/education/doctype/academic_year/test_academic_year.js
@@ -20,4 +20,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/article/article.js b/erpnext/education/doctype/article/article.js
index edfec26..85b387f 100644
--- a/erpnext/education/doctype/article/article.js
+++ b/erpnext/education/doctype/article/article.js
@@ -53,4 +53,4 @@
 		method: 'erpnext.education.doctype.article.article.get_topics_without_article',
 		args: {'article': article}
 	});
-};
\ No newline at end of file
+};
diff --git a/erpnext/education/doctype/article/article.py b/erpnext/education/doctype/article/article.py
index 8ba367d..b5cc5cb 100644
--- a/erpnext/education/doctype/article/article.py
+++ b/erpnext/education/doctype/article/article.py
@@ -18,4 +18,4 @@
 		topic_contents = [tc.content for tc in topic.topic_content]
 		if not topic_contents or article not in topic_contents:
 			data.append(topic.name)
-	return data
\ No newline at end of file
+	return data
diff --git a/erpnext/education/doctype/assessment_criteria/assessment_criteria.py b/erpnext/education/doctype/assessment_criteria/assessment_criteria.py
index 1ea3702..bfbf26c 100644
--- a/erpnext/education/doctype/assessment_criteria/assessment_criteria.py
+++ b/erpnext/education/doctype/assessment_criteria/assessment_criteria.py
@@ -12,4 +12,4 @@
 class AssessmentCriteria(Document):
 	def validate(self):
 		if self.assessment_criteria.lower() in STD_CRITERIA:
-			frappe.throw(_("Can't create standard criteria. Please rename the criteria"))
\ No newline at end of file
+			frappe.throw(_("Can't create standard criteria. Please rename the criteria"))
diff --git a/erpnext/education/doctype/assessment_criteria/test_assessment_criteria.js b/erpnext/education/doctype/assessment_criteria/test_assessment_criteria.js
index db4a4cf..724c4da 100644
--- a/erpnext/education/doctype/assessment_criteria/test_assessment_criteria.js
+++ b/erpnext/education/doctype/assessment_criteria/test_assessment_criteria.js
@@ -13,4 +13,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/assessment_criteria_group/test_assessment_criteria_group.js b/erpnext/education/doctype/assessment_criteria_group/test_assessment_criteria_group.js
index bcfcaf8..ab27e63 100644
--- a/erpnext/education/doctype/assessment_criteria_group/test_assessment_criteria_group.js
+++ b/erpnext/education/doctype/assessment_criteria_group/test_assessment_criteria_group.js
@@ -12,4 +12,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/assessment_group/assessment_group_dashboard.py b/erpnext/education/doctype/assessment_group/assessment_group_dashboard.py
index 2649d4b..1a23606 100644
--- a/erpnext/education/doctype/assessment_group/assessment_group_dashboard.py
+++ b/erpnext/education/doctype/assessment_group/assessment_group_dashboard.py
@@ -12,4 +12,4 @@
 				'items': ['Assessment Plan', 'Assessment Result']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/assessment_group/assessment_group_tree.js b/erpnext/education/doctype/assessment_group/assessment_group_tree.js
index e467683..e0dfaa3 100644
--- a/erpnext/education/doctype/assessment_group/assessment_group_tree.js
+++ b/erpnext/education/doctype/assessment_group/assessment_group_tree.js
@@ -1,3 +1,3 @@
 frappe.treeview_settings["Assessment Group"] = {
-	
-}
\ No newline at end of file
+
+}
diff --git a/erpnext/education/doctype/assessment_group/test_assessment_group.js b/erpnext/education/doctype/assessment_group/test_assessment_group.js
index a127fd4..00e6309 100644
--- a/erpnext/education/doctype/assessment_group/test_assessment_group.js
+++ b/erpnext/education/doctype/assessment_group/test_assessment_group.js
@@ -62,4 +62,4 @@
 			() => frappe.click_button('Create New'),
 		]);
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/education/doctype/assessment_plan/assessment_plan.js b/erpnext/education/doctype/assessment_plan/assessment_plan.js
index 726c0fc..cf545c4 100644
--- a/erpnext/education/doctype/assessment_plan/assessment_plan.js
+++ b/erpnext/education/doctype/assessment_plan/assessment_plan.js
@@ -75,4 +75,4 @@
 	maximum_assessment_score: function(frm) {
 		frm.trigger('course');
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/assessment_plan/assessment_plan_dashboard.py b/erpnext/education/doctype/assessment_plan/assessment_plan_dashboard.py
index 5e6c29d..8ac3faf 100644
--- a/erpnext/education/doctype/assessment_plan/assessment_plan_dashboard.py
+++ b/erpnext/education/doctype/assessment_plan/assessment_plan_dashboard.py
@@ -18,4 +18,4 @@
 				'items': ['Assessment Plan Status']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/assessment_result/assessment_result.js b/erpnext/education/doctype/assessment_result/assessment_result.js
index c35f607..b6d2881 100644
--- a/erpnext/education/doctype/assessment_result/assessment_result.js
+++ b/erpnext/education/doctype/assessment_result/assessment_result.js
@@ -122,4 +122,4 @@
 			});
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/assessment_result/assessment_result.py b/erpnext/education/doctype/assessment_result/assessment_result.py
index 6b873ec..7dfe0cf 100644
--- a/erpnext/education/doctype/assessment_result/assessment_result.py
+++ b/erpnext/education/doctype/assessment_result/assessment_result.py
@@ -42,7 +42,3 @@
 			"student":self.student, "assessment_plan":self.assessment_plan, "docstatus":("!=", 2)})
 		if assessment_result:
 			frappe.throw(_("Assessment Result record {0} already exists.").format(getlink("Assessment Result",assessment_result[0].name)))
-
-
-
-
diff --git a/erpnext/education/doctype/assessment_result/assessment_result_dashboard.py b/erpnext/education/doctype/assessment_result/assessment_result_dashboard.py
index 438379d..2526076 100644
--- a/erpnext/education/doctype/assessment_result/assessment_result_dashboard.py
+++ b/erpnext/education/doctype/assessment_result/assessment_result_dashboard.py
@@ -11,4 +11,4 @@
 				'items': ['Final Assessment Grades', 'Course wise Assessment Report']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/assessment_result/test_assessment_result.js b/erpnext/education/doctype/assessment_result/test_assessment_result.js
index b7adfac..d4eb4b8 100644
--- a/erpnext/education/doctype/assessment_result/test_assessment_result.js
+++ b/erpnext/education/doctype/assessment_result/test_assessment_result.js
@@ -70,4 +70,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/assessment_result/test_assessment_result.py b/erpnext/education/doctype/assessment_result/test_assessment_result.py
index e5535d6..adce577 100644
--- a/erpnext/education/doctype/assessment_result/test_assessment_result.py
+++ b/erpnext/education/doctype/assessment_result/test_assessment_result.py
@@ -16,4 +16,3 @@
 
 		grade = get_grade("_Test Grading Scale", 70)
 		self.assertEqual("B", grade)
-		
\ No newline at end of file
diff --git a/erpnext/education/doctype/assessment_result_tool/assessment_result_tool.py b/erpnext/education/doctype/assessment_result_tool/assessment_result_tool.py
index 649f420..a0d286c 100644
--- a/erpnext/education/doctype/assessment_result_tool/assessment_result_tool.py
+++ b/erpnext/education/doctype/assessment_result_tool/assessment_result_tool.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class AssessmentResultTool(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/education/doctype/assessment_result_tool/test_assessment_result_tool.js b/erpnext/education/doctype/assessment_result_tool/test_assessment_result_tool.js
index 0bbe331..7ef5c68 100644
--- a/erpnext/education/doctype/assessment_result_tool/test_assessment_result_tool.js
+++ b/erpnext/education/doctype/assessment_result_tool/test_assessment_result_tool.js
@@ -26,4 +26,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/course/course.js b/erpnext/education/doctype/course/course.js
index 81e4a8c..bd8d62c 100644
--- a/erpnext/education/doctype/course/course.js
+++ b/erpnext/education/doctype/course/course.js
@@ -76,4 +76,4 @@
 		method: 'erpnext.education.doctype.course.course.get_programs_without_course',
 		args: {'course': course}
 	});
-}
\ No newline at end of file
+}
diff --git a/erpnext/education/doctype/course/course.py b/erpnext/education/doctype/course/course.py
index 06efa54..92f92ed 100644
--- a/erpnext/education/doctype/course/course.py
+++ b/erpnext/education/doctype/course/course.py
@@ -53,4 +53,4 @@
 		courses = [c.course for c in program.courses]
 		if not courses or course not in courses:
 			data.append(program.name)
-	return data
\ No newline at end of file
+	return data
diff --git a/erpnext/education/doctype/course/course_dashboard.py b/erpnext/education/doctype/course/course_dashboard.py
index 8a570bd..8de91b1 100644
--- a/erpnext/education/doctype/course/course_dashboard.py
+++ b/erpnext/education/doctype/course/course_dashboard.py
@@ -20,4 +20,4 @@
 				'items': ['Assessment Plan', 'Assessment Result']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/course/test_course.js b/erpnext/education/doctype/course/test_course.js
index 88fddc2..2b6860c 100644
--- a/erpnext/education/doctype/course/test_course.js
+++ b/erpnext/education/doctype/course/test_course.js
@@ -33,4 +33,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/course_activity/course_activity.py b/erpnext/education/doctype/course_activity/course_activity.py
index e7fc08a..3aa1ea0 100644
--- a/erpnext/education/doctype/course_activity/course_activity.py
+++ b/erpnext/education/doctype/course_activity/course_activity.py
@@ -16,4 +16,4 @@
 		if frappe.db.exists("Course Enrollment", self.enrollment):
 			return True
 		else:
-			frappe.throw(_("Course Enrollment {0} does not exists").format(self.enrollment))
\ No newline at end of file
+			frappe.throw(_("Course Enrollment {0} does not exists").format(self.enrollment))
diff --git a/erpnext/education/doctype/course_enrollment/course_enrollment_dashboard.py b/erpnext/education/doctype/course_enrollment/course_enrollment_dashboard.py
index b9dd457..37972fe 100644
--- a/erpnext/education/doctype/course_enrollment/course_enrollment_dashboard.py
+++ b/erpnext/education/doctype/course_enrollment/course_enrollment_dashboard.py
@@ -12,4 +12,4 @@
 				'items': ['Course Activity', 'Quiz Activity']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/course_enrollment/test_course_enrollment.py b/erpnext/education/doctype/course_enrollment/test_course_enrollment.py
index e22c7ce..874bf12 100644
--- a/erpnext/education/doctype/course_enrollment/test_course_enrollment.py
+++ b/erpnext/education/doctype/course_enrollment/test_course_enrollment.py
@@ -39,6 +39,3 @@
 			doc = frappe.get_doc("Program Enrollment", entry.name)
 			doc.cancel()
 			doc.delete()
-
-
-
diff --git a/erpnext/education/doctype/course_schedule/course_schedule.js b/erpnext/education/doctype/course_schedule/course_schedule.js
index 4275f6e..366bbd8 100644
--- a/erpnext/education/doctype/course_schedule/course_schedule.js
+++ b/erpnext/education/doctype/course_schedule/course_schedule.js
@@ -13,4 +13,4 @@
 			}).addClass("btn-primary");
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/course_schedule/course_schedule.py b/erpnext/education/doctype/course_schedule/course_schedule.py
index 5083ff6..748728d 100644
--- a/erpnext/education/doctype/course_schedule/course_schedule.py
+++ b/erpnext/education/doctype/course_schedule/course_schedule.py
@@ -14,11 +14,11 @@
 		self.validate_course()
 		self.validate_date()
 		self.validate_overlap()
-	
+
 	def set_title(self):
 		"""Set document Title"""
 		self.title = self.course + " by " + (self.instructor_name if self.instructor_name else self.instructor)
-	
+
 	def validate_course(self):
 		group_based_on, course = frappe.db.get_value("Student Group", self.student_group, ["group_based_on", "course"])
 		if group_based_on == "Course":
@@ -28,23 +28,22 @@
 		"""Validates if from_time is greater than to_time"""
 		if self.from_time > self.to_time:
 			frappe.throw(_("From Time cannot be greater than To Time."))
-	
+
 	def validate_overlap(self):
 		"""Validates overlap for Student Group, Instructor, Room"""
-		
+
 		from erpnext.education.utils import validate_overlap_for
 
 		#Validate overlapping course schedules.
 		if self.student_group:
 			validate_overlap_for(self, "Course Schedule", "student_group")
-		
+
 		validate_overlap_for(self, "Course Schedule", "instructor")
 		validate_overlap_for(self, "Course Schedule", "room")
 
 		#validate overlapping assessment schedules.
 		if self.student_group:
 			validate_overlap_for(self, "Assessment Plan", "student_group")
-		
+
 		validate_overlap_for(self, "Assessment Plan", "room")
 		validate_overlap_for(self, "Assessment Plan", "supervisor", self.instructor)
-
diff --git a/erpnext/education/doctype/course_schedule/course_schedule_dashboard.py b/erpnext/education/doctype/course_schedule/course_schedule_dashboard.py
index 0866cd6..22ce7e1 100644
--- a/erpnext/education/doctype/course_schedule/course_schedule_dashboard.py
+++ b/erpnext/education/doctype/course_schedule/course_schedule_dashboard.py
@@ -12,4 +12,4 @@
 				'items': ['Student Attendance']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/course_schedule/test_course_schedule.py b/erpnext/education/doctype/course_schedule/test_course_schedule.py
index a901f1e..5bb4de8 100644
--- a/erpnext/education/doctype/course_schedule/test_course_schedule.py
+++ b/erpnext/education/doctype/course_schedule/test_course_schedule.py
@@ -17,28 +17,28 @@
 	def test_student_group_conflict(self):
 		cs1 = make_course_schedule_test_record(simulate= True)
 
-		cs2 = make_course_schedule_test_record(schedule_date=cs1.schedule_date, from_time= cs1.from_time, 
+		cs2 = make_course_schedule_test_record(schedule_date=cs1.schedule_date, from_time= cs1.from_time,
 			to_time= cs1.to_time, instructor="_Test Instructor 2", room=frappe.get_all("Room")[1].name, do_not_save= 1)
 		self.assertRaises(OverlapError, cs2.save)
 
 	def test_instructor_conflict(self):
 		cs1 = make_course_schedule_test_record(simulate= True)
-		
-		cs2 = make_course_schedule_test_record(from_time= cs1.from_time, to_time= cs1.to_time, 
+
+		cs2 = make_course_schedule_test_record(from_time= cs1.from_time, to_time= cs1.to_time,
 			student_group="Course-TC101-2014-2015 (_Test Academic Term)", room=frappe.get_all("Room")[1].name, do_not_save= 1)
 		self.assertRaises(OverlapError, cs2.save)
 
 	def test_room_conflict(self):
 		cs1 = make_course_schedule_test_record(simulate= True)
-		
-		cs2 = make_course_schedule_test_record(from_time= cs1.from_time, to_time= cs1.to_time, 
+
+		cs2 = make_course_schedule_test_record(from_time= cs1.from_time, to_time= cs1.to_time,
 			student_group="Course-TC101-2014-2015 (_Test Academic Term)", instructor="_Test Instructor 2", do_not_save= 1)
 		self.assertRaises(OverlapError, cs2.save)
-		
+
 	def test_no_conflict(self):
 		cs1 = make_course_schedule_test_record(simulate= True)
-		
-		make_course_schedule_test_record(from_time= cs1.from_time, to_time= cs1.to_time, 
+
+		make_course_schedule_test_record(from_time= cs1.from_time, to_time= cs1.to_time,
 			student_group="Course-TC102-2014-2015 (_Test Academic Term)", instructor="_Test Instructor 2", room=frappe.get_all("Room")[1].name)
 
 def make_course_schedule_test_record(**args):
@@ -49,12 +49,12 @@
 	course_schedule.course = args.course or "TC101"
 	course_schedule.instructor = args.instructor or "_Test Instructor"
 	course_schedule.room = args.room or frappe.get_all("Room")[0].name
-	
+
 	course_schedule.schedule_date = args.schedule_date or today()
 	course_schedule.from_time = args.from_time or to_timedelta("01:00:00")
 	course_schedule.to_time = args.to_time or course_schedule.from_time + datetime.timedelta(hours= 1)
 
-	
+
 	if not args.do_not_save:
 		if args.simulate:
 			while True:
diff --git a/erpnext/education/doctype/course_scheduling_tool/course_scheduling_tool.js b/erpnext/education/doctype/course_scheduling_tool/course_scheduling_tool.js
index d57f46a..7b0e4ab 100644
--- a/erpnext/education/doctype/course_scheduling_tool/course_scheduling_tool.js
+++ b/erpnext/education/doctype/course_scheduling_tool/course_scheduling_tool.js
@@ -41,4 +41,4 @@
 				});
 		});
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/education_settings/education_settings.py b/erpnext/education/doctype/education_settings/education_settings.py
index 658380e..6c7e95c 100644
--- a/erpnext/education/doctype/education_settings/education_settings.py
+++ b/erpnext/education/doctype/education_settings/education_settings.py
@@ -36,4 +36,4 @@
 			make_property_setter('Instructor', "naming_series", "hidden", 1, "Check", validate_fields_for_doctype=False)
 
 def update_website_context(context):
-	context["lms_enabled"] = frappe.get_doc("Education Settings").enable_lms
\ No newline at end of file
+	context["lms_enabled"] = frappe.get_doc("Education Settings").enable_lms
diff --git a/erpnext/education/doctype/fee_schedule/fee_schedule.js b/erpnext/education/doctype/fee_schedule/fee_schedule.js
index 0089957..97691a5 100644
--- a/erpnext/education/doctype/fee_schedule/fee_schedule.js
+++ b/erpnext/education/doctype/fee_schedule/fee_schedule.js
@@ -130,4 +130,4 @@
 			});
 		}
 	}
-})
\ No newline at end of file
+})
diff --git a/erpnext/education/doctype/fee_schedule/fee_schedule_dashboard.py b/erpnext/education/doctype/fee_schedule/fee_schedule_dashboard.py
index acfe400..4d7da21 100644
--- a/erpnext/education/doctype/fee_schedule/fee_schedule_dashboard.py
+++ b/erpnext/education/doctype/fee_schedule/fee_schedule_dashboard.py
@@ -10,4 +10,4 @@
 				'items': ['Fees']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/fee_structure/fee_structure.js b/erpnext/education/doctype/fee_structure/fee_structure.js
index 310c410..d9ab99f 100644
--- a/erpnext/education/doctype/fee_structure/fee_structure.js
+++ b/erpnext/education/doctype/fee_structure/fee_structure.js
@@ -69,4 +69,4 @@
 		}
 		frm.set_value('total_amount', total_amount);
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/fee_structure/fee_structure.py b/erpnext/education/doctype/fee_structure/fee_structure.py
index 781382b..9755717 100644
--- a/erpnext/education/doctype/fee_structure/fee_structure.py
+++ b/erpnext/education/doctype/fee_structure/fee_structure.py
@@ -11,13 +11,13 @@
 class FeeStructure(Document):
 	def validate(self):
 		self.calculate_total()
-		
+
 	def calculate_total(self):
 		"""Calculates total amount."""
 		self.total_amount = 0
 		for d in self.components:
 			self.total_amount += d.amount
-	
+
 
 @frappe.whitelist()
 def make_fee_schedule(source_name, target_doc=None):
@@ -31,4 +31,4 @@
 		"Fee Component": {
 			"doctype": "Fee Component"
 		}
-	}, target_doc)
\ No newline at end of file
+	}, target_doc)
diff --git a/erpnext/education/doctype/fee_structure/fee_structure_dashboard.py b/erpnext/education/doctype/fee_structure/fee_structure_dashboard.py
index 73e314f..fdf7df7 100644
--- a/erpnext/education/doctype/fee_structure/fee_structure_dashboard.py
+++ b/erpnext/education/doctype/fee_structure/fee_structure_dashboard.py
@@ -12,4 +12,4 @@
 				'items': ['Fees', 'Fee Schedule']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/fees/fees.py b/erpnext/education/doctype/fees/fees.py
index 25d67d2..7e86704 100644
--- a/erpnext/education/doctype/fees/fees.py
+++ b/erpnext/education/doctype/fees/fees.py
@@ -132,4 +132,4 @@
 		"title": _("Fees"),
 		"get_list": get_fee_list,
 		"row_template": "templates/includes/fee/fee_row.html"
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/fees/fees_list.js b/erpnext/education/doctype/fees/fees_list.js
index 52e1c4b..ee8e1e3 100644
--- a/erpnext/education/doctype/fees/fees_list.js
+++ b/erpnext/education/doctype/fees/fees_list.js
@@ -9,4 +9,4 @@
 			return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<=,Today"];
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/education/doctype/grading_scale/grading_scale.py b/erpnext/education/doctype/grading_scale/grading_scale.py
index 6309d02..0e73297 100644
--- a/erpnext/education/doctype/grading_scale/grading_scale.py
+++ b/erpnext/education/doctype/grading_scale/grading_scale.py
@@ -17,4 +17,4 @@
 			else:
 				thresholds.append(cint(d.threshold))
 		if 0 not in thresholds:
-			frappe.throw(_("Please define grade for Threshold 0%"))
\ No newline at end of file
+			frappe.throw(_("Please define grade for Threshold 0%"))
diff --git a/erpnext/education/doctype/grading_scale/test_grading_scale.js b/erpnext/education/doctype/grading_scale/test_grading_scale.js
index e363545..fb56918 100644
--- a/erpnext/education/doctype/grading_scale/test_grading_scale.js
+++ b/erpnext/education/doctype/grading_scale/test_grading_scale.js
@@ -99,4 +99,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/guardian/test_guardian.js b/erpnext/education/doctype/guardian/test_guardian.js
index 9bbfacd..1ea6dc2 100644
--- a/erpnext/education/doctype/guardian/test_guardian.js
+++ b/erpnext/education/doctype/guardian/test_guardian.js
@@ -31,4 +31,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/instructor/instructor.js b/erpnext/education/doctype/instructor/instructor.js
index 24e80fa..034b0aa 100644
--- a/erpnext/education/doctype/instructor/instructor.js
+++ b/erpnext/education/doctype/instructor/instructor.js
@@ -61,4 +61,4 @@
 			};
 		});
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/instructor/instructor_dashboard.py b/erpnext/education/doctype/instructor/instructor_dashboard.py
index a404fc5..c19c859 100644
--- a/erpnext/education/doctype/instructor/instructor_dashboard.py
+++ b/erpnext/education/doctype/instructor/instructor_dashboard.py
@@ -21,4 +21,4 @@
 				'items': ['Student Group']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/program/program.js b/erpnext/education/doctype/program/program.js
index 98263b5..2d89351 100644
--- a/erpnext/education/doctype/program/program.js
+++ b/erpnext/education/doctype/program/program.js
@@ -4,5 +4,5 @@
 cur_frm.add_fetch('fee_structure', 'total_amount', 'amount');
 
 frappe.ui.form.on("Program", "refresh", function(frm) {
-	
-});
\ No newline at end of file
+
+});
diff --git a/erpnext/education/doctype/program/program.py b/erpnext/education/doctype/program/program.py
index d24df5d..9d886b7 100644
--- a/erpnext/education/doctype/program/program.py
+++ b/erpnext/education/doctype/program/program.py
@@ -11,4 +11,4 @@
 	def get_course_list(self):
 		program_course_list = self.courses
 		course_list = [frappe.get_doc("Course", program_course.course) for program_course in program_course_list]
-		return course_list
\ No newline at end of file
+		return course_list
diff --git a/erpnext/education/doctype/program/program_dashboard.py b/erpnext/education/doctype/program/program_dashboard.py
index c5d2494..6c503e1 100644
--- a/erpnext/education/doctype/program/program_dashboard.py
+++ b/erpnext/education/doctype/program/program_dashboard.py
@@ -21,4 +21,4 @@
 				'items': ['Assessment Plan', 'Assessment Result']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/program/test_program.js b/erpnext/education/doctype/program/test_program.js
index dc347cf..b9ca41a 100644
--- a/erpnext/education/doctype/program/test_program.js
+++ b/erpnext/education/doctype/program/test_program.js
@@ -31,4 +31,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/program/test_program.py b/erpnext/education/doctype/program/test_program.py
index d753036..204f296 100644
--- a/erpnext/education/doctype/program/test_program.py
+++ b/erpnext/education/doctype/program/test_program.py
@@ -88,4 +88,4 @@
 
 	course_list = [course['course_name'] for course in test_data['course']]
 	program = make_program_and_linked_courses(test_data['program_name'], course_list)
-	return program
\ No newline at end of file
+	return program
diff --git a/erpnext/education/doctype/program_enrollment/program_enrollment.js b/erpnext/education/doctype/program_enrollment/program_enrollment.js
index f9c65fb..e92d063 100644
--- a/erpnext/education/doctype/program_enrollment/program_enrollment.js
+++ b/erpnext/education/doctype/program_enrollment/program_enrollment.js
@@ -101,4 +101,4 @@
 			return { filters: [['Course', 'name', 'not in', course_list]] };
 		};
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/program_enrollment/program_enrollment.py b/erpnext/education/doctype/program_enrollment/program_enrollment.py
index b282bab..dd4aa57 100644
--- a/erpnext/education/doctype/program_enrollment/program_enrollment.py
+++ b/erpnext/education/doctype/program_enrollment/program_enrollment.py
@@ -174,4 +174,3 @@
 			tuple(students + ["%%%s%%" % txt, start, page_len]
 		)
 	)
-
diff --git a/erpnext/education/doctype/program_enrollment/program_enrollment_dashboard.py b/erpnext/education/doctype/program_enrollment/program_enrollment_dashboard.py
index 18d307c..c47f866 100644
--- a/erpnext/education/doctype/program_enrollment/program_enrollment_dashboard.py
+++ b/erpnext/education/doctype/program_enrollment/program_enrollment_dashboard.py
@@ -16,4 +16,4 @@
 				'items': ['Student and Guardian Contact Details']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/program_enrollment/test_program_enrollment.py b/erpnext/education/doctype/program_enrollment/test_program_enrollment.py
index fec6422..497ee28 100644
--- a/erpnext/education/doctype/program_enrollment/test_program_enrollment.py
+++ b/erpnext/education/doctype/program_enrollment/test_program_enrollment.py
@@ -32,4 +32,4 @@
 		for entry in frappe.db.get_all("Program Enrollment"):
 			doc = frappe.get_doc("Program Enrollment", entry.name)
 			doc.cancel()
-			doc.delete()
\ No newline at end of file
+			doc.delete()
diff --git a/erpnext/education/doctype/question/question.py b/erpnext/education/doctype/question/question.py
index a7deeab..fb3b504 100644
--- a/erpnext/education/doctype/question/question.py
+++ b/erpnext/education/doctype/question/question.py
@@ -43,4 +43,4 @@
 		elif len(answers) == 1:
 			return answers[0]
 		else:
-			return answers
\ No newline at end of file
+			return answers
diff --git a/erpnext/education/doctype/quiz/quiz.js b/erpnext/education/doctype/quiz/quiz.js
index 01bcf73..320869b 100644
--- a/erpnext/education/doctype/quiz/quiz.js
+++ b/erpnext/education/doctype/quiz/quiz.js
@@ -68,4 +68,4 @@
 		method: 'erpnext.education.doctype.quiz.quiz.get_topics_without_quiz',
 		args: {'quiz': quiz}
 	});
-};
\ No newline at end of file
+};
diff --git a/erpnext/education/doctype/quiz/quiz.py b/erpnext/education/doctype/quiz/quiz.py
index a774b88..a128e1f 100644
--- a/erpnext/education/doctype/quiz/quiz.py
+++ b/erpnext/education/doctype/quiz/quiz.py
@@ -68,4 +68,4 @@
 		topic_contents = [tc.content for tc in topic.topic_content]
 		if not topic_contents or quiz not in topic_contents:
 			data.append(topic.name)
-	return data
\ No newline at end of file
+	return data
diff --git a/erpnext/education/doctype/room/room.js b/erpnext/education/doctype/room/room.js
index 20cee6b..1263b60 100644
--- a/erpnext/education/doctype/room/room.js
+++ b/erpnext/education/doctype/room/room.js
@@ -1,2 +1,2 @@
 frappe.ui.form.on("Room", {
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/room/room_dashboard.py b/erpnext/education/doctype/room/room_dashboard.py
index 99aac33..7bcb97f 100644
--- a/erpnext/education/doctype/room/room_dashboard.py
+++ b/erpnext/education/doctype/room/room_dashboard.py
@@ -16,4 +16,4 @@
 				'items': ['Assessment Plan']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/student/student.js b/erpnext/education/doctype/student/student.js
index fd23ae4..aead556 100644
--- a/erpnext/education/doctype/student/student.js
+++ b/erpnext/education/doctype/student/student.js
@@ -60,4 +60,4 @@
 			return { filters: [['Student', 'name', 'not in', sibling_list]] };
 		};
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student/student_list.js b/erpnext/education/doctype/student/student_list.js
index 763f120..c1bce24 100644
--- a/erpnext/education/doctype/student/student_list.js
+++ b/erpnext/education/doctype/student/student_list.js
@@ -1,3 +1,3 @@
 frappe.listview_settings['Student'] = {
 	add_fields: [ "image"]
-}
\ No newline at end of file
+}
diff --git a/erpnext/education/doctype/student/test_student.py b/erpnext/education/doctype/student/test_student.py
index 2e52637..fcb2b5f 100644
--- a/erpnext/education/doctype/student/test_student.py
+++ b/erpnext/education/doctype/student/test_student.py
@@ -68,4 +68,4 @@
 		student_id = frappe.get_all("Student", {"student_email_id": email}, ["name"])[0].name
 		return frappe.get_doc("Student", student_id)
 	except IndexError:
-		return None
\ No newline at end of file
+		return None
diff --git a/erpnext/education/doctype/student_admission/templates/student_admission_row.html b/erpnext/education/doctype/student_admission/templates/student_admission_row.html
index 99868d5..529d651 100644
--- a/erpnext/education/doctype/student_admission/templates/student_admission_row.html
+++ b/erpnext/education/doctype/student_admission/templates/student_admission_row.html
@@ -41,4 +41,4 @@
 			</div>
 		</div>
 	</a>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/education/doctype/student_admission/test_student_admission.js b/erpnext/education/doctype/student_admission/test_student_admission.js
index 3a0bb0b..e01791a 100644
--- a/erpnext/education/doctype/student_admission/test_student_admission.js
+++ b/erpnext/education/doctype/student_admission/test_student_admission.js
@@ -37,4 +37,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student_applicant/student_applicant.js b/erpnext/education/doctype/student_applicant/student_applicant.js
index b4cfdf1..7b41a72 100644
--- a/erpnext/education/doctype/student_applicant/student_applicant.js
+++ b/erpnext/education/doctype/student_applicant/student_applicant.js
@@ -59,4 +59,4 @@
 		frm.add_fetch("student", "gender", "gender");
 		frm.add_fetch("student", "date_of_birth", "date_of_birth");
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student_applicant/student_applicant.py b/erpnext/education/doctype/student_applicant/student_applicant.py
index 2113482..193b6d3 100644
--- a/erpnext/education/doctype/student_applicant/student_applicant.py
+++ b/erpnext/education/doctype/student_applicant/student_applicant.py
@@ -49,7 +49,7 @@
 			frappe.throw(_("Please select Student Admission which is mandatory for the paid student applicant"))
 
 	def validation_from_student_admission(self):
-		
+
 		student_admission = get_student_admission_data(self.student_admission, self.program)
 
 		if student_admission and student_admission.min_age and \
diff --git a/erpnext/education/doctype/student_applicant/student_applicant_list.js b/erpnext/education/doctype/student_applicant/student_applicant_list.js
index 817a728..c39d46e 100644
--- a/erpnext/education/doctype/student_applicant/student_applicant_list.js
+++ b/erpnext/education/doctype/student_applicant/student_applicant_list.js
@@ -18,4 +18,4 @@
 			return [__("Admitted"), "blue", "application_status,=,Admitted"];
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/education/doctype/student_applicant/tests/test_student_applicant.js b/erpnext/education/doctype/student_applicant/tests/test_student_applicant.js
index a69ad8a..fa67977 100644
--- a/erpnext/education/doctype/student_applicant/tests/test_student_applicant.js
+++ b/erpnext/education/doctype/student_applicant/tests/test_student_applicant.js
@@ -92,4 +92,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student_applicant/tests/test_student_applicant_dummy_data.js b/erpnext/education/doctype/student_applicant/tests/test_student_applicant_dummy_data.js
index 26244ab..03101e4 100644
--- a/erpnext/education/doctype/student_applicant/tests/test_student_applicant_dummy_data.js
+++ b/erpnext/education/doctype/student_applicant/tests/test_student_applicant_dummy_data.js
@@ -84,4 +84,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student_applicant/tests/test_student_applicant_options.js b/erpnext/education/doctype/student_applicant/tests/test_student_applicant_options.js
index 114358f..daa36e7 100644
--- a/erpnext/education/doctype/student_applicant/tests/test_student_applicant_options.js
+++ b/erpnext/education/doctype/student_applicant/tests/test_student_applicant_options.js
@@ -107,4 +107,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student_attendance/student_attendance.js b/erpnext/education/doctype/student_attendance/student_attendance.js
index f025a1a..2bbecb9 100644
--- a/erpnext/education/doctype/student_attendance/student_attendance.js
+++ b/erpnext/education/doctype/student_attendance/student_attendance.js
@@ -2,4 +2,4 @@
 // For license information, please see license.txt
 
 cur_frm.add_fetch("course_schedule", "schedule_date", "date");
-cur_frm.add_fetch("course_schedule", "student_group", "student_group")
\ No newline at end of file
+cur_frm.add_fetch("course_schedule", "student_group", "student_group")
diff --git a/erpnext/education/doctype/student_attendance/student_attendance_dashboard.py b/erpnext/education/doctype/student_attendance/student_attendance_dashboard.py
index 9c41b8f..e405b8a 100644
--- a/erpnext/education/doctype/student_attendance/student_attendance_dashboard.py
+++ b/erpnext/education/doctype/student_attendance/student_attendance_dashboard.py
@@ -9,4 +9,4 @@
 				'items': ['Student Monthly Attendance Sheet', 'Student Batch-Wise Attendance']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/student_attendance/student_attendance_list.js b/erpnext/education/doctype/student_attendance/student_attendance_list.js
index 0d3e7ad..e89b76c 100644
--- a/erpnext/education/doctype/student_attendance/student_attendance_list.js
+++ b/erpnext/education/doctype/student_attendance/student_attendance_list.js
@@ -8,4 +8,4 @@
 			return [__("Present"), "green", "status,=,Present"];
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/education/doctype/student_attendance/test_student_attendance.js b/erpnext/education/doctype/student_attendance/test_student_attendance.js
index c7da6f6..3d30b09 100644
--- a/erpnext/education/doctype/student_attendance/test_student_attendance.js
+++ b/erpnext/education/doctype/student_attendance/test_student_attendance.js
@@ -28,4 +28,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.py b/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.py
index 028db91..972973f 100644
--- a/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.py
+++ b/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.py
@@ -38,4 +38,4 @@
 			if student.student == attendance.student:
 				student.status = attendance.status
 
-	return student_list
\ No newline at end of file
+	return student_list
diff --git a/erpnext/education/doctype/student_attendance_tool/test_student_attendance_tool.js b/erpnext/education/doctype/student_attendance_tool/test_student_attendance_tool.js
index cea0761..b66d839 100644
--- a/erpnext/education/doctype/student_attendance_tool/test_student_attendance_tool.js
+++ b/erpnext/education/doctype/student_attendance_tool/test_student_attendance_tool.js
@@ -82,4 +82,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student_group/student_group.js b/erpnext/education/doctype/student_group/student_group.js
index 51e3b74..39ee9ce 100644
--- a/erpnext/education/doctype/student_group/student_group.js
+++ b/erpnext/education/doctype/student_group/student_group.js
@@ -142,4 +142,4 @@
 			return { filters: [['Instructor', 'name', 'not in', instructor_list]] };
 		};
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student_group/student_group.py b/erpnext/education/doctype/student_group/student_group.py
index 0260b80..3d4572a 100644
--- a/erpnext/education/doctype/student_group/student_group.py
+++ b/erpnext/education/doctype/student_group/student_group.py
@@ -128,4 +128,3 @@
 			order by idx desc, name
 			limit %s, %s""".format(searchfield),
 			tuple(["%%%s%%" % txt, "%%%s%%" % txt, start, page_len]))
-
diff --git a/erpnext/education/doctype/student_group/student_group_dashboard.py b/erpnext/education/doctype/student_group/student_group_dashboard.py
index ad7a6de..d37445f 100644
--- a/erpnext/education/doctype/student_group/student_group_dashboard.py
+++ b/erpnext/education/doctype/student_group/student_group_dashboard.py
@@ -16,4 +16,4 @@
 				'items': ['Course Schedule']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/student_group/test_student_group.js b/erpnext/education/doctype/student_group/test_student_group.js
index 6673343..4c7e47b 100644
--- a/erpnext/education/doctype/student_group/test_student_group.js
+++ b/erpnext/education/doctype/student_group/test_student_group.js
@@ -53,4 +53,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.js b/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.js
index d0d7afd..c189e27 100644
--- a/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.js
+++ b/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.js
@@ -37,4 +37,4 @@
 			}
 		};
 	});
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.py b/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.py
index dc8667e..28ff7d6 100644
--- a/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.py
+++ b/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.py
@@ -76,4 +76,4 @@
 				student_group.append('students', student)
 			student_group.save()
 
-		frappe.msgprint(_("{0} Student Groups created.").format(l))
\ No newline at end of file
+		frappe.msgprint(_("{0} Student Groups created.").format(l))
diff --git a/erpnext/education/doctype/student_group_creation_tool/test_student_group_creation_tool.js b/erpnext/education/doctype/student_group_creation_tool/test_student_group_creation_tool.js
index 34c1093..fa612ba 100644
--- a/erpnext/education/doctype/student_group_creation_tool/test_student_group_creation_tool.js
+++ b/erpnext/education/doctype/student_group_creation_tool/test_student_group_creation_tool.js
@@ -81,4 +81,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student_group_student/student_group_student.py b/erpnext/education/doctype/student_group_student/student_group_student.py
index 820e301..1fe4ea1 100644
--- a/erpnext/education/doctype/student_group_student/student_group_student.py
+++ b/erpnext/education/doctype/student_group_student/student_group_student.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class StudentGroupStudent(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/education/doctype/student_leave_application/student_leave_application_dashboard.py b/erpnext/education/doctype/student_leave_application/student_leave_application_dashboard.py
index fdcc147..0ff6d1a 100644
--- a/erpnext/education/doctype/student_leave_application/student_leave_application_dashboard.py
+++ b/erpnext/education/doctype/student_leave_application/student_leave_application_dashboard.py
@@ -8,4 +8,4 @@
 				'items': ['Student Attendance']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/education/doctype/student_leave_application/test_student_leave_application.js b/erpnext/education/doctype/student_leave_application/test_student_leave_application.js
index 5af9f5d..6bbf17b 100644
--- a/erpnext/education/doctype/student_leave_application/test_student_leave_application.js
+++ b/erpnext/education/doctype/student_leave_application/test_student_leave_application.js
@@ -66,4 +66,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student_leave_application/test_student_leave_application.py b/erpnext/education/doctype/student_leave_application/test_student_leave_application.py
index fcdd428..9cae257 100644
--- a/erpnext/education/doctype/student_leave_application/test_student_leave_application.py
+++ b/erpnext/education/doctype/student_leave_application/test_student_leave_application.py
@@ -112,4 +112,4 @@
 
 	company = get_default_company() or frappe.get_all('Company')[0].name
 	frappe.db.set_value('Company', company, 'default_holiday_list', holiday_list)
-	return holiday_list
\ No newline at end of file
+	return holiday_list
diff --git a/erpnext/education/doctype/student_log/test_student_log.js b/erpnext/education/doctype/student_log/test_student_log.js
index 5775369..4c90c5f 100644
--- a/erpnext/education/doctype/student_log/test_student_log.js
+++ b/erpnext/education/doctype/student_log/test_student_log.js
@@ -32,4 +32,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.html b/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.html
index 72772b7..a9e84e6 100644
--- a/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.html
+++ b/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.html
@@ -12,67 +12,67 @@
 			padding: 0.75in;
 			margin: auto;
 		}
-	
+
 		.print-format.landscape {
 			max-width: 11.69in;
 			padding: 0.2in;
 		}
-	
+
 		.page-break {
 			padding: 30px 0px;
 			border-bottom: 1px dashed #888;
 		}
-	
+
 		.page-break:first-child {
 			padding-top: 0px;
 		}
-	
+
 		.page-break:last-child {
 			border-bottom: 0px;
 		}
-	
+
 		/* mozilla hack for images in table */
 		body:last-child .print-format td img {
 			width: 100% !important;
 		}
-	
+
 		@media(max-width: 767px) {
 			.print-format {
 				padding: 0.2in;
 			}
 		}
 	}
-	
+
 	@media print {
 		.print-format p {
 			margin-left: 1px;
 			margin-right: 1px;
 		}
 	}
-	
+
 	.data-field {
 		margin-top: 5px;
 		margin-bottom: 5px;
 	}
-	
+
 	.data-field .value {
 		word-wrap: break-word;
 	}
-	
+
 	.important .value {
 		font-size: 120%;
 		font-weight: bold;
 	}
-	
+
 	.important label {
 		line-height: 1.8;
 		margin: 0px;
 	}
-	
+
 	.table {
 		margin: 20px 0px;
 	}
-	
+
 	.square-image {
 		width: 100%;
 		height: 0;
@@ -83,88 +83,88 @@
 		background-position: center center;
 		border-radius: 4px;
 	}
-	
+
 	.print-item-image {
 		object-fit: contain;
 	}
-	
+
 	.pdf-variables,
 	.pdf-variable,
 	.visible-pdf {
 		display: none !important;
 	}
-	
+
 	.print-format {
 		font-size: 9pt;
 		font-family: "Helvetica Neue", Helvetica, Arial, "Open Sans", sans-serif;
 		-webkit-print-color-adjust:exact;
 	}
-	
+
 	.page-break {
 		page-break-after: always;
 	}
-	
+
 	.print-heading {
 		border-bottom: 1px solid #aaa;
 		margin-bottom: 10px;
 	}
-	
+
 	.print-heading h2 {
 		margin: 0px;
 	}
 	.print-heading h4 {
 		margin-top: 5px;
 	}
-	
+
 	table.no-border, table.no-border td {
 		border: 0px;
 	}
-	
+
 	.print-format label {
 		/* wkhtmltopdf breaks label into multiple lines when it is inline-block */
 		display: block;
 	}
-	
+
 	.print-format img {
 		max-width: 100%;
 	}
-	
+
 	.print-format table td > .primary:first-child {
 		font-weight: bold;
 	}
-	
+
 	.print-format td, .print-format th {
 		vertical-align: top !important;
 		padding: 6px !important;
 	}
-	
+
 	.print-format p {
 		margin: 3px 0px 3px;
 	}
-	
+
 	table td div {
-		
+
 		/* needed to avoid partial cutting of text between page break in wkhtmltopdf */
 		page-break-inside: avoid !important;
-		
+
 	}
-	
+
 	/* hack for webkit specific browser */
 	@media (-webkit-min-device-pixel-ratio:0) {
 		thead, tfoot { display: table-row-group; }
 	}
-	
+
 	[document-status] {
 		margin-bottom: 5mm;
 	}
-	
+
 	.signature-img {
 		background: #fff;
 		border-radius: 3px;
 		margin-top: 5px;
 		max-height: 150px;
 	}
-	
+
 	.print-heading {
 		text-align: right;
 		text-transform: uppercase;
@@ -173,16 +173,16 @@
 		margin-bottom: 20px;
 		border-bottom: 1px solid #d1d8dd;
 	}
-	
+
 	.print-heading h2 {
 		font-size: 24px;
 	}
-	
+
 	.print-format th {
 		background-color: #eee !important;
 		border-bottom: 0px !important;
 	}
-	
+
 	/* modern format: for-test */
 
 	.pbi_avoid {
@@ -344,7 +344,7 @@
 <br>
 
 <div class="row section-break pbi_avoid">
-	<div class="col-xs-6 column-break">	
+	<div class="col-xs-6 column-break">
 		<h4>{{ _("Student Attendance")}}</h4> <br>
 		<div>
 			Present {{ doc.attendance.get("Present") if doc.attendance.get("Present") != None else '0' }} days
@@ -352,7 +352,7 @@
 		</div>
 	</div>
 
-	<div class="col-xs-6 column-break">	
+	<div class="col-xs-6 column-break">
 		<h4>{{ _("Parents Teacher Meeting Attendance")}}</h4> <br>
 		<div>
 			Present {{ doc.parents_attendance if doc.parents_attendance != None else '0' }}
diff --git a/erpnext/education/doctype/topic/topic.js b/erpnext/education/doctype/topic/topic.js
index 2002b0c..0c903c5 100644
--- a/erpnext/education/doctype/topic/topic.js
+++ b/erpnext/education/doctype/topic/topic.js
@@ -52,4 +52,4 @@
 		method: 'erpnext.education.doctype.topic.topic.get_courses_without_topic',
 		args: {'topic': topic}
 	});
-};
\ No newline at end of file
+};
diff --git a/erpnext/education/doctype/topic/topic.py b/erpnext/education/doctype/topic/topic.py
index a5253e9..fb680d7 100644
--- a/erpnext/education/doctype/topic/topic.py
+++ b/erpnext/education/doctype/topic/topic.py
@@ -56,4 +56,4 @@
 		topic.save()
 	frappe.db.commit()
 	frappe.msgprint(_('{0} {1} has been added to all the selected topics successfully.').format(content_type, frappe.bold(content)),
-		title=_('Topics updated'), indicator='green')
\ No newline at end of file
+		title=_('Topics updated'), indicator='green')
diff --git a/erpnext/education/report/program_wise_fee_collection/program_wise_fee_collection.py b/erpnext/education/report/program_wise_fee_collection/program_wise_fee_collection.py
index c145359..c0ec035 100644
--- a/erpnext/education/report/program_wise_fee_collection/program_wise_fee_collection.py
+++ b/erpnext/education/report/program_wise_fee_collection/program_wise_fee_collection.py
@@ -121,4 +121,3 @@
 		},
 		'type': 'bar'
 	}
-
diff --git a/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.js b/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.js
index ad04356..9f1fcbc 100644
--- a/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.js
+++ b/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.js
@@ -9,4 +9,4 @@
 		"default": frappe.datetime.get_today(),
 		"reqd": 1
 	}]
-}
\ No newline at end of file
+}
diff --git a/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.py b/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.py
index 7793dcf..e2576a0 100644
--- a/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.py
+++ b/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.py
@@ -67,4 +67,4 @@
 				student_group= %s and date= %s and docstatus = 1 and
 				(course_schedule is Null or course_schedule='') group by status""",
 				(student_group, date), as_dict=1)
-	return student_attendance
\ No newline at end of file
+	return student_attendance
diff --git a/erpnext/education/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.js b/erpnext/education/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.js
index 104d3ec..62c9455 100644
--- a/erpnext/education/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.js
+++ b/erpnext/education/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.js
@@ -39,4 +39,4 @@
 			}
 		});
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/education/web_form/student_applicant/student_applicant.js b/erpnext/education/web_form/student_applicant/student_applicant.js
index 699703c..ffc5e98 100644
--- a/erpnext/education/web_form/student_applicant/student_applicant.js
+++ b/erpnext/education/web_form/student_applicant/student_applicant.js
@@ -1,3 +1,3 @@
 frappe.ready(function() {
 	// bind events here
-})
\ No newline at end of file
+})
diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.js b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.js
index a9925ad..f5ea804 100644
--- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.js
+++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.js
@@ -1,3 +1,2 @@
 // Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
 // For license information, please see license.txt
-
diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/xml_utils.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/xml_utils.py
index a25a29f..99ede8f 100644
--- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/xml_utils.py
+++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/xml_utils.py
@@ -103,4 +103,4 @@
 		"""parse a string"""
 		t = ET.fromstring(s)
 		root_tag, root_tree = self._namespace_split(t.tag, self._parse_node(t))
-		return object_dict({root_tag: root_tree})
\ No newline at end of file
+		return object_dict({root_tag: root_tree})
diff --git a/erpnext/erpnext_integrations/doctype/exotel_settings/exotel_settings.py b/erpnext/erpnext_integrations/doctype/exotel_settings/exotel_settings.py
index 6a846ef..bff928c 100644
--- a/erpnext/erpnext_integrations/doctype/exotel_settings/exotel_settings.py
+++ b/erpnext/erpnext_integrations/doctype/exotel_settings/exotel_settings.py
@@ -17,4 +17,4 @@
 			response = requests.get('https://api.exotel.com/v1/Accounts/{sid}'
 				.format(sid = self.account_sid), auth=(self.api_key, self.api_token))
 			if response.status_code != 200:
-				frappe.throw(_("Invalid credentials"))
\ No newline at end of file
+				frappe.throw(_("Invalid credentials"))
diff --git a/erpnext/erpnext_integrations/doctype/mpesa_settings/account_balance.html b/erpnext/erpnext_integrations/doctype/mpesa_settings/account_balance.html
index 2c4d4bb..b74a718 100644
--- a/erpnext/erpnext_integrations/doctype/mpesa_settings/account_balance.html
+++ b/erpnext/erpnext_integrations/doctype/mpesa_settings/account_balance.html
@@ -25,4 +25,4 @@
 </table>
 {% else %}
 <p style="margin-top: 30px;"> Account Balance Information Not Available. </p>
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_connector.py b/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_connector.py
index 554c6b0..d1adeee 100644
--- a/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_connector.py
+++ b/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_connector.py
@@ -115,4 +115,4 @@
 
 		saf_url = "{0}{1}".format(self.base_url, "/mpesa/stkpush/v1/processrequest")
 		r = requests.post(saf_url, headers=headers, json=payload)
-		return r.json()
\ No newline at end of file
+		return r.json()
diff --git a/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_custom_fields.py b/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_custom_fields.py
index 0499e88..139e2fb 100644
--- a/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_custom_fields.py
+++ b/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_custom_fields.py
@@ -50,4 +50,4 @@
 	for record in record_dict:
 		if frappe.db.exists("POS Field", {"fieldname": record.get("fieldname")}):
 			continue
-		frappe.get_doc(record).insert()
\ No newline at end of file
+		frappe.get_doc(record).insert()
diff --git a/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_settings.py b/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_settings.py
index fdfaa1b..de93357 100644
--- a/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_settings.py
+++ b/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_settings.py
@@ -276,4 +276,4 @@
 	"""Fetch the specified key from list of dictionary. Key is identified via the key field."""
 	for param in response:
 		if param[key_field] == key:
-			return param["Value"]
\ No newline at end of file
+			return param["Value"]
diff --git a/erpnext/erpnext_integrations/doctype/mpesa_settings/test_mpesa_settings.py b/erpnext/erpnext_integrations/doctype/mpesa_settings/test_mpesa_settings.py
index b0e662d..d4cb6b9 100644
--- a/erpnext/erpnext_integrations/doctype/mpesa_settings/test_mpesa_settings.py
+++ b/erpnext/erpnext_integrations/doctype/mpesa_settings/test_mpesa_settings.py
@@ -355,4 +355,4 @@
 				}
 			}
 		}
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_connector.py b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_connector.py
index 42d4b9b..73f5927 100644
--- a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_connector.py
+++ b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_connector.py
@@ -50,7 +50,7 @@
 				"secret": self.settings.plaid_secret,
 				"products": self.products,
 			})
-		
+
 		return args
 
 	def get_link_token(self, update_mode=False):
diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.js b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.js
index 37bf282..3740d04 100644
--- a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.js
+++ b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.js
@@ -135,4 +135,4 @@
 			});
 		}, __("Select a company"), __("Continue"));
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py
index 3ef069b..eddcb34 100644
--- a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py
+++ b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py
@@ -110,7 +110,7 @@
 				frappe.msgprint(_("Bank account {0} already exists and could not be created again").format(account["name"]))
 			except Exception:
 				frappe.log_error(frappe.get_traceback(), title=_("Plaid Link Error"))
-				frappe.throw(_("There was an error creating Bank Account while linking with Plaid."), 
+				frappe.throw(_("There was an error creating Bank Account while linking with Plaid."),
 					title=_("Plaid Link Failed"))
 
 		else:
diff --git a/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.js b/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.js
index 5482b9c..af06b34 100644
--- a/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.js
+++ b/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.js
@@ -346,4 +346,4 @@
 		}).join("");
 
 	return rows
-}
\ No newline at end of file
+}
diff --git a/erpnext/erpnext_integrations/doctype/woocommerce_settings/woocommerce_settings.py b/erpnext/erpnext_integrations/doctype/woocommerce_settings/woocommerce_settings.py
index bd072f4..45f2610 100644
--- a/erpnext/erpnext_integrations/doctype/woocommerce_settings/woocommerce_settings.py
+++ b/erpnext/erpnext_integrations/doctype/woocommerce_settings/woocommerce_settings.py
@@ -27,7 +27,7 @@
 			for doctype in ["Customer", "Address"]:
 				df = dict(fieldname='woocommerce_email', label='Woocommerce Email', fieldtype='Data', read_only=1, print_hide=1)
 				create_custom_field(doctype, df)
-			
+
 			if not frappe.get_value("Item Group", {"name": _("WooCommerce Products")}):
 				item_group = frappe.new_doc("Item Group")
 				item_group.item_group_name = _("WooCommerce Products")
@@ -74,4 +74,4 @@
 def get_series():
 	return {
 		"sales_order_series" : frappe.get_meta("Sales Order").get_options("naming_series") or "SO-WOO-",
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/erpnext_integrations/stripe_integration.py b/erpnext/erpnext_integrations/stripe_integration.py
index a35ca28..108b4c0 100644
--- a/erpnext/erpnext_integrations/stripe_integration.py
+++ b/erpnext/erpnext_integrations/stripe_integration.py
@@ -50,4 +50,4 @@
 			stripe_settings.integration_request.db_set('status', 'Failed', update_modified=False)
 			frappe.log_error(frappe.get_traceback())
 
-		return stripe_settings.finalize_request()
\ No newline at end of file
+		return stripe_settings.finalize_request()
diff --git a/erpnext/erpnext_integrations/utils.py b/erpnext/erpnext_integrations/utils.py
index a5e162f..caafc08 100644
--- a/erpnext/erpnext_integrations/utils.py
+++ b/erpnext/erpnext_integrations/utils.py
@@ -52,7 +52,7 @@
 			"payment_gateway": gateway
 		}, ['payment_account'])
 
-	mode_of_payment = frappe.db.exists("Mode of Payment", gateway) 
+	mode_of_payment = frappe.db.exists("Mode of Payment", gateway)
 	if not mode_of_payment and payment_gateway_account:
 		mode_of_payment = frappe.get_doc({
 			"doctype": "Mode of Payment",
diff --git a/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.js b/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.js
index dd6dc66..e494489 100644
--- a/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.js
+++ b/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.js
@@ -11,4 +11,4 @@
 			default: frappe.defaults.get_user_default("Company")
 		}
 	]
-};
\ No newline at end of file
+};
diff --git a/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.py b/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.py
index 062da6e..eca7143 100644
--- a/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.py
+++ b/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.py
@@ -69,4 +69,4 @@
 			}
 		],
 		'type': 'bar'
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/healthcare/doctype/appointment_type/appointment_type.js b/erpnext/healthcare/doctype/appointment_type/appointment_type.js
index 861675a..99b7cb2 100644
--- a/erpnext/healthcare/doctype/appointment_type/appointment_type.js
+++ b/erpnext/healthcare/doctype/appointment_type/appointment_type.js
@@ -80,4 +80,4 @@
 			});
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py b/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py
index 03e96a4..81a3982 100644
--- a/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py
+++ b/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py
@@ -63,4 +63,4 @@
 	procedure.company = "_Test Company"
 	procedure.warehouse = "_Test Warehouse - _TC"
 	procedure.submit()
-	return procedure
\ No newline at end of file
+	return procedure
diff --git a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.js b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.js
index 1ef110d..ae6b39b 100644
--- a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.js
+++ b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.js
@@ -188,4 +188,3 @@
 		description: __('You can also set the Medical Department for the template. After saving the document, an Item will automatically be created for billing this Clinical Procedure. You can then use this template while creating Clinical Procedures for Patients. Templates save you from filling up redundant data every single time. You can also create templates for other operations like Lab Tests, Therapy Sessions, etc.')
 	}
 ];
-
diff --git a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py
index f32b7cf..58194f1 100644
--- a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py
+++ b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py
@@ -118,4 +118,3 @@
 		rename_doc('Item', doc.item_code, item_code, ignore_permissions=True)
 		frappe.db.set_value('Clinical Procedure Template', doc.name, 'item_code', item_code)
 	return
-
diff --git a/erpnext/healthcare/doctype/exercise_type/exercise_type.py b/erpnext/healthcare/doctype/exercise_type/exercise_type.py
index fb635c8..ae44a2b 100644
--- a/erpnext/healthcare/doctype/exercise_type/exercise_type.py
+++ b/erpnext/healthcare/doctype/exercise_type/exercise_type.py
@@ -12,4 +12,3 @@
 			self.name = ' - '.join(filter(None, [self.exercise_name, self.difficulty_level]))
 		else:
 			self.name = self.exercise_name
-
diff --git a/erpnext/healthcare/doctype/fee_validity/fee_validity.py b/erpnext/healthcare/doctype/fee_validity/fee_validity.py
index 058bc97..5b9c179 100644
--- a/erpnext/healthcare/doctype/fee_validity/fee_validity.py
+++ b/erpnext/healthcare/doctype/fee_validity/fee_validity.py
@@ -60,4 +60,4 @@
 	})
 	if len(appointment_exists) and appointment_exists[0]:
 		return False
-	return True
\ No newline at end of file
+	return True
diff --git a/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py b/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
index 7e7fd82..6ae3e12 100644
--- a/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
+++ b/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
@@ -47,4 +47,4 @@
 		# appointment should be invoiced as it is not within fee validity and the max_visits are exceeded
 		appointment = create_appointment(patient, practitioner, add_days(nowdate(), 10), invoice=1)
 		invoiced = frappe.db.get_value("Patient Appointment", appointment.name, "invoiced")
-		self.assertEqual(invoiced, 1)
\ No newline at end of file
+		self.assertEqual(invoiced, 1)
diff --git a/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.js b/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.js
index fc0b241..44c3998 100644
--- a/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.js
+++ b/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.js
@@ -142,4 +142,3 @@
 		description: __('If this Healthcare Practitioner also works for the In-Patient Department, set the inpatient visit charge for this Practitioner.')
 	}
 ];
-
diff --git a/erpnext/healthcare/doctype/healthcare_service_unit_type/test_healthcare_service_unit_type.py b/erpnext/healthcare/doctype/healthcare_service_unit_type/test_healthcare_service_unit_type.py
index 01cf4b0..3ee3377 100644
--- a/erpnext/healthcare/doctype/healthcare_service_unit_type/test_healthcare_service_unit_type.py
+++ b/erpnext/healthcare/doctype/healthcare_service_unit_type/test_healthcare_service_unit_type.py
@@ -30,4 +30,4 @@
 	unit_type.no_of_hours = 1
 	unit_type.rate = 4000
 	unit_type.save()
-	return unit_type
\ No newline at end of file
+	return unit_type
diff --git a/erpnext/healthcare/doctype/inpatient_medication_entry/test_inpatient_medication_entry.py b/erpnext/healthcare/doctype/inpatient_medication_entry/test_inpatient_medication_entry.py
index 7cb5a48..ff9e212 100644
--- a/erpnext/healthcare/doctype/inpatient_medication_entry/test_inpatient_medication_entry.py
+++ b/erpnext/healthcare/doctype/inpatient_medication_entry/test_inpatient_medication_entry.py
@@ -153,4 +153,4 @@
 	# in stock uom
 	se_child.conversion_factor = 1.0
 	se_child.expense_account = expense_account
-	stock_entry.submit()
\ No newline at end of file
+	stock_entry.submit()
diff --git a/erpnext/healthcare/doctype/inpatient_medication_order/test_inpatient_medication_order.py b/erpnext/healthcare/doctype/inpatient_medication_order/test_inpatient_medication_order.py
index 21776d2..7989762 100644
--- a/erpnext/healthcare/doctype/inpatient_medication_order/test_inpatient_medication_order.py
+++ b/erpnext/healthcare/doctype/inpatient_medication_order/test_inpatient_medication_order.py
@@ -140,4 +140,3 @@
 	ipme = ipme.get_medication_orders()
 
 	return ipme
-
diff --git a/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py
index 5f2dc48..9dd4a2c 100644
--- a/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py
+++ b/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py
@@ -295,4 +295,4 @@
 			'color': args.get('color') or '#7575ff',
 			'price_list': args.get('price_list') or frappe.db.get_value("Price List", {"selling": 1}),
 			'items': args.get('items') or items
-		}).insert()
\ No newline at end of file
+		}).insert()
diff --git a/erpnext/healthcare/doctype/patient_assessment/patient_assessment.py b/erpnext/healthcare/doctype/patient_assessment/patient_assessment.py
index 3033a3e..7bad20d 100644
--- a/erpnext/healthcare/doctype/patient_assessment/patient_assessment.py
+++ b/erpnext/healthcare/doctype/patient_assessment/patient_assessment.py
@@ -31,6 +31,3 @@
 		}, target_doc)
 
 	return doc
-
-
-
diff --git a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py
index cc21417..2b3029e 100644
--- a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py
+++ b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py
@@ -99,4 +99,4 @@
 def delete_ip_medication_order(encounter):
 	record = frappe.db.exists('Inpatient Medication Order', {'patient_encounter': encounter.name})
 	if record:
-		frappe.delete_doc('Inpatient Medication Order', record, force=1)
\ No newline at end of file
+		frappe.delete_doc('Inpatient Medication Order', record, force=1)
diff --git a/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.py b/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.py
index 887d58a..63b0085 100644
--- a/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.py
+++ b/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.py
@@ -187,4 +187,4 @@
 	if not module:
 		module = frappe.db.get_value('DocType', doc.doctype, 'module')
 
-	return module
\ No newline at end of file
+	return module
diff --git a/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py b/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py
index c1d9872..f8ccc8a 100644
--- a/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py
+++ b/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py
@@ -88,4 +88,4 @@
 	lab_test.template = template
 	lab_test.save()
 	lab_test.submit()
-	return lab_test
\ No newline at end of file
+	return lab_test
diff --git a/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.py b/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.py
index 748c12c..635d4be 100644
--- a/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.py
+++ b/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.py
@@ -70,4 +70,4 @@
 		item_price.item_name = self.item_name
 		item_price.price_list_rate = self.total_amount
 		item_price.ignore_mandatory = True
-		item_price.save(ignore_permissions=True)
\ No newline at end of file
+		item_price.save(ignore_permissions=True)
diff --git a/erpnext/healthcare/doctype/therapy_session/therapy_session.js b/erpnext/healthcare/doctype/therapy_session/therapy_session.js
index fd20003..fbfa774 100644
--- a/erpnext/healthcare/doctype/therapy_session/therapy_session.js
+++ b/erpnext/healthcare/doctype/therapy_session/therapy_session.js
@@ -168,4 +168,4 @@
 			});
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/healthcare/doctype/therapy_type/test_therapy_type.py b/erpnext/healthcare/doctype/therapy_type/test_therapy_type.py
index 21f6369..a5dad29 100644
--- a/erpnext/healthcare/doctype/therapy_type/test_therapy_type.py
+++ b/erpnext/healthcare/doctype/therapy_type/test_therapy_type.py
@@ -47,4 +47,4 @@
 			'description': 'Squat and Rise'
 		})
 		exercise_type.save()
-	return exercise_type
\ No newline at end of file
+	return exercise_type
diff --git a/erpnext/healthcare/doctype/vital_signs/vital_signs.py b/erpnext/healthcare/doctype/vital_signs/vital_signs.py
index 35c823d..4bb3940 100644
--- a/erpnext/healthcare/doctype/vital_signs/vital_signs.py
+++ b/erpnext/healthcare/doctype/vital_signs/vital_signs.py
@@ -15,4 +15,3 @@
 	def set_title(self):
 		self.title = _('{0} on {1}').format(self.patient_name or self.patient,
 			frappe.utils.format_date(self.signs_date))[:100]
-
diff --git a/erpnext/healthcare/page/patient_history/patient_history.html b/erpnext/healthcare/page/patient_history/patient_history.html
index be486c6..f170655 100644
--- a/erpnext/healthcare/page/patient_history/patient_history.html
+++ b/erpnext/healthcare/page/patient_history/patient_history.html
@@ -23,4 +23,4 @@
 			<a class="btn btn-sm btn-default btn-get-records" style="display:none">More..</a>
 		</div>
 	</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/healthcare/page/patient_progress/patient_progress.html b/erpnext/healthcare/page/patient_progress/patient_progress.html
index c20537e..30064bd 100644
--- a/erpnext/healthcare/page/patient_progress/patient_progress.html
+++ b/erpnext/healthcare/page/patient_progress/patient_progress.html
@@ -65,4 +65,4 @@
 			</div>
 		</div>
 	</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/healthcare/page/patient_progress/patient_progress.js b/erpnext/healthcare/page/patient_progress/patient_progress.js
index 2410b0c..4b7599d 100644
--- a/erpnext/healthcare/page/patient_progress/patient_progress.js
+++ b/erpnext/healthcare/page/patient_progress/patient_progress.js
@@ -528,4 +528,4 @@
 		}
 		$(parent).find('.chart-container').hide();
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/healthcare/page/patient_progress/patient_progress.py b/erpnext/healthcare/page/patient_progress/patient_progress.py
index a04fb2b..46bfb3d 100644
--- a/erpnext/healthcare/page/patient_progress/patient_progress.py
+++ b/erpnext/healthcare/page/patient_progress/patient_progress.py
@@ -194,4 +194,3 @@
 		return time_span
 	except json.decoder.JSONDecodeError:
 		return get_timespan_date_range(time_span.lower())
-
diff --git a/erpnext/healthcare/page/patient_progress/patient_progress_sidebar.html b/erpnext/healthcare/page/patient_progress/patient_progress_sidebar.html
index cd62dd3..4ee6573 100644
--- a/erpnext/healthcare/page/patient_progress/patient_progress_sidebar.html
+++ b/erpnext/healthcare/page/patient_progress/patient_progress_sidebar.html
@@ -26,4 +26,4 @@
 		<p><a class="therapy-plan-link">{%=__("Therapy Plan") %}</a></p>
 		<p><a class="patient-history">{%=__("Patient History") %}</a></p>
 	</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/healthcare/print_format/encounter_print/encounter_print.json b/erpnext/healthcare/print_format/encounter_print/encounter_print.json
index ec1e0f2..3c90adb 100644
--- a/erpnext/healthcare/print_format/encounter_print/encounter_print.json
+++ b/erpnext/healthcare/print_format/encounter_print/encounter_print.json
@@ -16,7 +16,7 @@
  "name": "Encounter Print",
  "owner": "Administrator",
  "print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
  "show_section_headings": 0,
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json b/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json
index e99ce70..4819e6d 100644
--- a/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json
+++ b/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json
@@ -16,7 +16,7 @@
  "name": "Sample ID Print", 
  "owner": "Administrator",
  "print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
  "show_section_headings": 0,
  "standard": "Yes"
 }
diff --git a/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.py b/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.py
index b907730..28b60bd 100644
--- a/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.py
+++ b/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.py
@@ -195,4 +195,4 @@
 
 	chart["fieldtype"] = "Data"
 
-	return chart
\ No newline at end of file
+	return chart
diff --git a/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py b/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py
index 9c35dbb..9a4840a 100644
--- a/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py
+++ b/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py
@@ -191,4 +191,4 @@
 				'datasets': []
 			},
 			"type": "line"
-		}
\ No newline at end of file
+		}
diff --git a/erpnext/healthcare/setup.py b/erpnext/healthcare/setup.py
index bf4df7e..891272d 100644
--- a/erpnext/healthcare/setup.py
+++ b/erpnext/healthcare/setup.py
@@ -292,4 +292,4 @@
 			{"label": "Medication Orders", "fieldname": "medication_orders", "fieldtype": "Table"},
 			{"label": "Total Orders", "fieldname": "total_orders", "fieldtype": "Float"}
 		])
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/healthcare/web_form/patient_registration/patient_registration.js b/erpnext/healthcare/web_form/patient_registration/patient_registration.js
index 7da3f1f..f09e540 100644
--- a/erpnext/healthcare/web_form/patient_registration/patient_registration.js
+++ b/erpnext/healthcare/web_form/patient_registration/patient_registration.js
@@ -1,3 +1,3 @@
 frappe.ready(function() {
 	// bind events here
-});
\ No newline at end of file
+});
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 8f7c7db..74977cd 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -251,7 +251,7 @@
 			"erpnext.support.doctype.issue.issue.set_first_response_time"
 		]
 	},
-	("Sales Taxes and Charges Template", 'Price List'): {
+	"Sales Taxes and Charges Template": {
 		"on_update": "erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings.validate_cart_settings"
 	},
 	"Website Settings": {
@@ -308,6 +308,9 @@
 	},
 	('Quotation', 'Sales Order', 'Sales Invoice'): {
 		'validate': ["erpnext.erpnext_integrations.taxjar_integration.set_sales_tax"]
+	},
+	"Company": {
+		"on_trash": "erpnext.regional.india.utils.delete_gst_settings_for_company"
 	}
 }
 
@@ -436,7 +439,6 @@
 		'erpnext.controllers.taxes_and_totals.get_regional_round_off_accounts': 'erpnext.regional.india.utils.get_regional_round_off_accounts',
 		'erpnext.hr.utils.calculate_annual_eligible_hra_exemption': 'erpnext.regional.india.utils.calculate_annual_eligible_hra_exemption',
 		'erpnext.hr.utils.calculate_hra_exemption_for_period': 'erpnext.regional.india.utils.calculate_hra_exemption_for_period',
-		'erpnext.controllers.accounts_controller.validate_einvoice_fields': 'erpnext.regional.india.e_invoice.utils.validate_einvoice_fields',
 		'erpnext.assets.doctype.asset.asset.get_depreciation_amount': 'erpnext.regional.india.utils.get_depreciation_amount',
 		'erpnext.stock.doctype.item.item.set_item_tax_from_hsn_code': 'erpnext.regional.india.utils.set_item_tax_from_hsn_code'
 	},
diff --git a/erpnext/hotels/doctype/hotel_room/hotel_room.py b/erpnext/hotels/doctype/hotel_room/hotel_room.py
index 8471aee..6a2fc02 100644
--- a/erpnext/hotels/doctype/hotel_room/hotel_room.py
+++ b/erpnext/hotels/doctype/hotel_room/hotel_room.py
@@ -10,4 +10,4 @@
 	def validate(self):
 		if not self.capacity:
 			self.capacity, self.extra_bed_capacity = frappe.db.get_value('Hotel Room Type',
-					self.hotel_room_type, ['capacity', 'extra_bed_capacity'])
\ No newline at end of file
+					self.hotel_room_type, ['capacity', 'extra_bed_capacity'])
diff --git a/erpnext/hotels/doctype/hotel_room_reservation/hotel_room_reservation_calendar.js b/erpnext/hotels/doctype/hotel_room_reservation/hotel_room_reservation_calendar.js
index 7f7322c..7bde292 100644
--- a/erpnext/hotels/doctype/hotel_room_reservation/hotel_room_reservation_calendar.js
+++ b/erpnext/hotels/doctype/hotel_room_reservation/hotel_room_reservation_calendar.js
@@ -6,4 +6,4 @@
 		"title": "guest_name",
 		"status": "status"
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/hotels/report/hotel_room_occupancy/hotel_room_occupancy.py b/erpnext/hotels/report/hotel_room_occupancy/hotel_room_occupancy.py
index f77d43b..259edb9 100644
--- a/erpnext/hotels/report/hotel_room_occupancy/hotel_room_occupancy.py
+++ b/erpnext/hotels/report/hotel_room_occupancy/hotel_room_occupancy.py
@@ -30,4 +30,4 @@
 
 		out.append([room_type.name, total_booked])
 
-	return out
\ No newline at end of file
+	return out
diff --git a/erpnext/hr/doctype/appraisal/appraisal.js b/erpnext/hr/doctype/appraisal/appraisal.js
index 1a30cea..50612b9 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.js
+++ b/erpnext/hr/doctype/appraisal/appraisal.js
@@ -15,7 +15,7 @@
 			frm.set_value('status', 'Draft');
 		}
 	},
-	
+
 	kra_template: function(frm) {
 		frm.doc.goals = [];
 		erpnext.utils.map_current_doc({
diff --git a/erpnext/hr/doctype/appraisal/test_appraisal.js b/erpnext/hr/doctype/appraisal/test_appraisal.js
index 9ca17e2..fb1354c 100644
--- a/erpnext/hr/doctype/appraisal/test_appraisal.js
+++ b/erpnext/hr/doctype/appraisal/test_appraisal.js
@@ -55,4 +55,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/hr/doctype/appraisal_goal/appraisal_goal.py b/erpnext/hr/doctype/appraisal_goal/appraisal_goal.py
index a6868ee..11d9f39 100644
--- a/erpnext/hr/doctype/appraisal_goal/appraisal_goal.py
+++ b/erpnext/hr/doctype/appraisal_goal/appraisal_goal.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class AppraisalGoal(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/hr/doctype/appraisal_template/appraisal_template_dashboard.py b/erpnext/hr/doctype/appraisal_template/appraisal_template_dashboard.py
index 309427e..392b370 100644
--- a/erpnext/hr/doctype/appraisal_template/appraisal_template_dashboard.py
+++ b/erpnext/hr/doctype/appraisal_template/appraisal_template_dashboard.py
@@ -9,4 +9,4 @@
                 'items': ['Appraisal']
             },
         ],
-    }
\ No newline at end of file
+    }
diff --git a/erpnext/hr/doctype/appraisal_template/test_appraisal_template.js b/erpnext/hr/doctype/appraisal_template/test_appraisal_template.js
index 0403cad..3eb64e0 100644
--- a/erpnext/hr/doctype/appraisal_template/test_appraisal_template.js
+++ b/erpnext/hr/doctype/appraisal_template/test_appraisal_template.js
@@ -27,4 +27,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.py b/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.py
index ca58e0c..b3c5704 100644
--- a/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.py
+++ b/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class AppraisalTemplateGoal(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/hr/doctype/attendance/attendance_calendar.js b/erpnext/hr/doctype/attendance/attendance_calendar.js
index 4566489..d9f6d2e 100644
--- a/erpnext/hr/doctype/attendance/attendance_calendar.js
+++ b/erpnext/hr/doctype/attendance/attendance_calendar.js
@@ -9,4 +9,4 @@
 		}
 	},
 	get_events_method: "erpnext.hr.doctype.attendance.attendance.get_events"
-};
\ No newline at end of file
+};
diff --git a/erpnext/hr/doctype/attendance/test_attendance.js b/erpnext/hr/doctype/attendance/test_attendance.js
index 8f30e8c..b3e7fef 100644
--- a/erpnext/hr/doctype/attendance/test_attendance.js
+++ b/erpnext/hr/doctype/attendance/test_attendance.js
@@ -36,4 +36,4 @@
 			"attendance for Present day is marked"),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/attendance_request/attendance_request_dashboard.py b/erpnext/hr/doctype/attendance_request/attendance_request_dashboard.py
index cfdd6d3..2d3eb00 100644
--- a/erpnext/hr/doctype/attendance_request/attendance_request_dashboard.py
+++ b/erpnext/hr/doctype/attendance_request/attendance_request_dashboard.py
@@ -8,4 +8,4 @@
 				'items': ['Attendance']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/hr/doctype/branch/branch.py b/erpnext/hr/doctype/branch/branch.py
index fab2ffc..a847c8e 100644
--- a/erpnext/hr/doctype/branch/branch.py
+++ b/erpnext/hr/doctype/branch/branch.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class Branch(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/hr/doctype/branch/test_branch.js b/erpnext/hr/doctype/branch/test_branch.js
index c315385..82a6ae1 100644
--- a/erpnext/hr/doctype/branch/test_branch.js
+++ b/erpnext/hr/doctype/branch/test_branch.js
@@ -20,4 +20,4 @@
 			'name of branch correctly saved'),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/branch/test_branch.py b/erpnext/hr/doctype/branch/test_branch.py
index 5ba02b3..807698b 100644
--- a/erpnext/hr/doctype/branch/test_branch.py
+++ b/erpnext/hr/doctype/branch/test_branch.py
@@ -4,4 +4,4 @@
 
 
 import frappe
-test_records = frappe.get_test_records('Branch')
\ No newline at end of file
+test_records = frappe.get_test_records('Branch')
diff --git a/erpnext/hr/doctype/daily_work_summary/test_daily_work_summary.js b/erpnext/hr/doctype/daily_work_summary/test_daily_work_summary.js
index d2ceb8b..1533517 100644
--- a/erpnext/hr/doctype/daily_work_summary/test_daily_work_summary.js
+++ b/erpnext/hr/doctype/daily_work_summary/test_daily_work_summary.js
@@ -20,4 +20,4 @@
 		() => done()
 	]);
 
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/department/department_tree.js b/erpnext/hr/doctype/department/department_tree.js
index 52d864b..5c7726d 100644
--- a/erpnext/hr/doctype/department/department_tree.js
+++ b/erpnext/hr/doctype/department/department_tree.js
@@ -25,4 +25,4 @@
 	onload: function(treeview) {
 		treeview.make_tree();
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/hr/doctype/department/test_department.js b/erpnext/hr/doctype/department/test_department.js
index 3a571f7..e73779c 100644
--- a/erpnext/hr/doctype/department/test_department.js
+++ b/erpnext/hr/doctype/department/test_department.js
@@ -20,4 +20,4 @@
 			'name of department correctly saved'),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/department/test_department.py b/erpnext/hr/doctype/department/test_department.py
index 2eeca26..e4f6645 100644
--- a/erpnext/hr/doctype/department/test_department.py
+++ b/erpnext/hr/doctype/department/test_department.py
@@ -21,4 +21,4 @@
 
     return doc
 
-test_records = frappe.get_test_records('Department')
\ No newline at end of file
+test_records = frappe.get_test_records('Department')
diff --git a/erpnext/hr/doctype/designation/designation.py b/erpnext/hr/doctype/designation/designation.py
index efd864a..a3f84aa 100644
--- a/erpnext/hr/doctype/designation/designation.py
+++ b/erpnext/hr/doctype/designation/designation.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class Designation(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/hr/doctype/designation/test_designation.js b/erpnext/hr/doctype/designation/test_designation.js
index 45c3417..00adf82 100644
--- a/erpnext/hr/doctype/designation/test_designation.js
+++ b/erpnext/hr/doctype/designation/test_designation.js
@@ -20,4 +20,4 @@
 			'name of designation correctly saved'),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/designation/test_designation.py b/erpnext/hr/doctype/designation/test_designation.py
index 3b30094..2778862 100644
--- a/erpnext/hr/doctype/designation/test_designation.py
+++ b/erpnext/hr/doctype/designation/test_designation.py
@@ -17,4 +17,4 @@
         "description": args.description or "_Test description"
     })
     designation.save()
-    return designation
\ No newline at end of file
+    return designation
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index 5ca4756..f428015 100755
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -520,4 +520,4 @@
 		user = frappe.session.user
 	if get_doc_permissions(doc, user=user, ptype=ptype).get(ptype):
 		return True
-	return doc.user_id == user
\ No newline at end of file
+	return doc.user_id == user
diff --git a/erpnext/hr/doctype/employee/employee_tree.js b/erpnext/hr/doctype/employee/employee_tree.js
index 9ab091a..7d6a700 100644
--- a/erpnext/hr/doctype/employee/employee_tree.js
+++ b/erpnext/hr/doctype/employee/employee_tree.js
@@ -33,4 +33,4 @@
 			condition: 'frappe.boot.user.can_create.indexOf("Employee") !== -1'
 		}
 	],
-};
\ No newline at end of file
+};
diff --git a/erpnext/hr/doctype/employee/test_employee.js b/erpnext/hr/doctype/employee/test_employee.js
index 200dcd7..3a41458 100644
--- a/erpnext/hr/doctype/employee/test_employee.js
+++ b/erpnext/hr/doctype/employee/test_employee.js
@@ -37,4 +37,4 @@
 		() => frappe.timeout(10),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/employee_advance/test_employee_advance.py b/erpnext/hr/doctype/employee_advance/test_employee_advance.py
index c88b2b8..100968b 100644
--- a/erpnext/hr/doctype/employee_advance/test_employee_advance.py
+++ b/erpnext/hr/doctype/employee_advance/test_employee_advance.py
@@ -48,4 +48,4 @@
 	doc.insert()
 	doc.submit()
 
-	return doc
\ No newline at end of file
+	return doc
diff --git a/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.css b/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.css
index d25fb22..c8d6644 100644
--- a/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.css
+++ b/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.css
@@ -18,4 +18,4 @@
 
 .checkbox{
 	margin-top: -3px;
-}
\ No newline at end of file
+}
diff --git a/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js b/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js
index ab965d5..5ae8c6b 100644
--- a/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js
+++ b/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js
@@ -267,5 +267,3 @@
 		mark_employee_toolbar.appendTo($(this.wrapper));
 	}
 };
-
-
diff --git a/erpnext/hr/doctype/employee_attendance_tool/test_employee_attendance_tool.js b/erpnext/hr/doctype/employee_attendance_tool/test_employee_attendance_tool.js
index 2827d4b..48d4344 100644
--- a/erpnext/hr/doctype/employee_attendance_tool/test_employee_attendance_tool.js
+++ b/erpnext/hr/doctype/employee_attendance_tool/test_employee_attendance_tool.js
@@ -58,4 +58,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/employee_checkin/employee_checkin.py b/erpnext/hr/doctype/employee_checkin/employee_checkin.py
index 60ea0f9..6c0cd4f 100644
--- a/erpnext/hr/doctype/employee_checkin/employee_checkin.py
+++ b/erpnext/hr/doctype/employee_checkin/employee_checkin.py
@@ -176,4 +176,3 @@
 
 def find_index_in_dict(dict_list, key, value):
 	return next((index for (index, d) in enumerate(dict_list) if d[key] == value), None)
-
diff --git a/erpnext/hr/doctype/employee_checkin/test_employee_checkin.py b/erpnext/hr/doctype/employee_checkin/test_employee_checkin.py
index 9f12ef2..7ba511f 100644
--- a/erpnext/hr/doctype/employee_checkin/test_employee_checkin.py
+++ b/erpnext/hr/doctype/employee_checkin/test_employee_checkin.py
@@ -42,11 +42,11 @@
 		self.assertEqual(logs_count, 4)
 		attendance_count = frappe.db.count('Attendance', {'status':'Present', 'working_hours':8.2,
 			'employee':employee, 'attendance_date':now_date})
-		self.assertEqual(attendance_count, 1)		
+		self.assertEqual(attendance_count, 1)
 
 	def test_calculate_working_hours(self):
 		check_in_out_type = ['Alternating entries as IN and OUT during the same shift',
-			'Strictly based on Log Type in Employee Checkin'] 
+			'Strictly based on Log Type in Employee Checkin']
 		working_hours_calc_type = ['First Check-in and Last Check-out',
 			'Every Valid Check-in and Check-out']
 		logs_type_1 = [
diff --git a/erpnext/hr/doctype/employee_education/employee_education.py b/erpnext/hr/doctype/employee_education/employee_education.py
index a1d4492..f0a7617 100644
--- a/erpnext/hr/doctype/employee_education/employee_education.py
+++ b/erpnext/hr/doctype/employee_education/employee_education.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class EmployeeEducation(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.py b/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.py
index c716630..517ef57 100644
--- a/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.py
+++ b/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class EmployeeExternalWorkHistory(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/hr/doctype/employee_grade/employee_grade_dashboard.py b/erpnext/hr/doctype/employee_grade/employee_grade_dashboard.py
index f2656e9..df67910 100644
--- a/erpnext/hr/doctype/employee_grade/employee_grade_dashboard.py
+++ b/erpnext/hr/doctype/employee_grade/employee_grade_dashboard.py
@@ -10,4 +10,4 @@
 				'items': ['Employee Onboarding Template', 'Employee Separation Template']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/hr/doctype/employee_grievance/employee_grievance.py b/erpnext/hr/doctype/employee_grievance/employee_grievance.py
index 503b5ea..1705582 100644
--- a/erpnext/hr/doctype/employee_grievance/employee_grievance.py
+++ b/erpnext/hr/doctype/employee_grievance/employee_grievance.py
@@ -12,4 +12,3 @@
 				bold("Invalid"),
 				bold("Resolved"))
 			)
-
diff --git a/erpnext/hr/doctype/employee_grievance/employee_grievance_list.js b/erpnext/hr/doctype/employee_grievance/employee_grievance_list.js
index fc08e21..11672ca 100644
--- a/erpnext/hr/doctype/employee_grievance/employee_grievance_list.js
+++ b/erpnext/hr/doctype/employee_grievance/employee_grievance_list.js
@@ -9,4 +9,4 @@
 		};
 		return [__(doc.status), colors[doc.status], "status,=," + doc.status];
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/hr/doctype/employee_grievance/test_employee_grievance.py b/erpnext/hr/doctype/employee_grievance/test_employee_grievance.py
index a615b20..ed897ee 100644
--- a/erpnext/hr/doctype/employee_grievance/test_employee_grievance.py
+++ b/erpnext/hr/doctype/employee_grievance/test_employee_grievance.py
@@ -48,4 +48,3 @@
 	grievance_type.save()
 
 	return grievance_type.name
-
diff --git a/erpnext/hr/doctype/employee_group/test_employee_group.py b/erpnext/hr/doctype/employee_group/test_employee_group.py
index 3a6bf85..26a61c4 100644
--- a/erpnext/hr/doctype/employee_group/test_employee_group.py
+++ b/erpnext/hr/doctype/employee_group/test_employee_group.py
@@ -29,4 +29,4 @@
 
 def get_employee_group():
 	employee_group = frappe.db.exists("Employee Group", "_Test Employee Group")
-	return employee_group
\ No newline at end of file
+	return employee_group
diff --git a/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.py b/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.py
index d0f3d8d..2f385a8 100644
--- a/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.py
+++ b/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class EmployeeInternalWorkHistory(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/hr/doctype/employee_onboarding/employee_onboarding.py b/erpnext/hr/doctype/employee_onboarding/employee_onboarding.py
index 55fe317..ca9b298 100644
--- a/erpnext/hr/doctype/employee_onboarding/employee_onboarding.py
+++ b/erpnext/hr/doctype/employee_onboarding/employee_onboarding.py
@@ -57,4 +57,3 @@
 				}}
 		}, target_doc, set_missing_values)
 	return doc
-
diff --git a/erpnext/hr/doctype/employee_onboarding/test_employee_onboarding.py b/erpnext/hr/doctype/employee_onboarding/test_employee_onboarding.py
index 5f7756b..0445270 100644
--- a/erpnext/hr/doctype/employee_onboarding/test_employee_onboarding.py
+++ b/erpnext/hr/doctype/employee_onboarding/test_employee_onboarding.py
@@ -101,4 +101,4 @@
 	onboarding.insert()
 	onboarding.submit()
 
-	return onboarding
\ No newline at end of file
+	return onboarding
diff --git a/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template_dashboard.py b/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template_dashboard.py
index 837da53..ab0eb2f 100644
--- a/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template_dashboard.py
+++ b/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template_dashboard.py
@@ -9,4 +9,4 @@
                 'items': ['Employee Onboarding']
             },
         ],
-    }
\ No newline at end of file
+    }
diff --git a/erpnext/hr/doctype/employee_referral/employee_referral.py b/erpnext/hr/doctype/employee_referral/employee_referral.py
index 0493306..547a95e 100644
--- a/erpnext/hr/doctype/employee_referral/employee_referral.py
+++ b/erpnext/hr/doctype/employee_referral/employee_referral.py
@@ -70,4 +70,3 @@
 		additional_salary.ref_docname = doc.name
 
 	return additional_salary
-
diff --git a/erpnext/hr/doctype/employee_referral/employee_referral_dashboard.py b/erpnext/hr/doctype/employee_referral/employee_referral_dashboard.py
index afa2a1f..caca296 100644
--- a/erpnext/hr/doctype/employee_referral/employee_referral_dashboard.py
+++ b/erpnext/hr/doctype/employee_referral/employee_referral_dashboard.py
@@ -12,4 +12,4 @@
 			},
 
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/hr/doctype/employee_referral/employee_referral_list.js b/erpnext/hr/doctype/employee_referral/employee_referral_list.js
index 7533ab6..38dfc4d 100644
--- a/erpnext/hr/doctype/employee_referral/employee_referral_list.js
+++ b/erpnext/hr/doctype/employee_referral/employee_referral_list.js
@@ -11,4 +11,4 @@
 			return [__(doc.status), "red", "status,=," + doc.status];
 		}
 	},
-};
\ No newline at end of file
+};
diff --git a/erpnext/hr/doctype/employee_referral/test_employee_referral.py b/erpnext/hr/doctype/employee_referral/test_employee_referral.py
index a674f39..599f326 100644
--- a/erpnext/hr/doctype/employee_referral/test_employee_referral.py
+++ b/erpnext/hr/doctype/employee_referral/test_employee_referral.py
@@ -57,4 +57,4 @@
 	emp_ref.save()
 	emp_ref.submit()
 
-	return emp_ref
\ No newline at end of file
+	return emp_ref
diff --git a/erpnext/hr/doctype/employee_separation/test_employee_separation.py b/erpnext/hr/doctype/employee_separation/test_employee_separation.py
index f787d9c..d63501a 100644
--- a/erpnext/hr/doctype/employee_separation/test_employee_separation.py
+++ b/erpnext/hr/doctype/employee_separation/test_employee_separation.py
@@ -45,4 +45,4 @@
 	separation.boarding_status = 'Pending'
 	separation.insert()
 	separation.submit()
-	return separation
\ No newline at end of file
+	return separation
diff --git a/erpnext/hr/doctype/employee_separation_template/employee_separation_template_dashboard.py b/erpnext/hr/doctype/employee_separation_template/employee_separation_template_dashboard.py
index 39345f0..75f985c 100644
--- a/erpnext/hr/doctype/employee_separation_template/employee_separation_template_dashboard.py
+++ b/erpnext/hr/doctype/employee_separation_template/employee_separation_template_dashboard.py
@@ -9,4 +9,4 @@
                 'items': ['Employee Separation']
             },
         ],
-    }
\ No newline at end of file
+    }
diff --git a/erpnext/hr/doctype/employment_type/employment_type.py b/erpnext/hr/doctype/employment_type/employment_type.py
index fb306b6..00aa6bb 100644
--- a/erpnext/hr/doctype/employment_type/employment_type.py
+++ b/erpnext/hr/doctype/employment_type/employment_type.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class EmploymentType(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/hr/doctype/employment_type/test_employment_type.js b/erpnext/hr/doctype/employment_type/test_employment_type.js
index 9835aab..fd7c6a1 100644
--- a/erpnext/hr/doctype/employment_type/test_employment_type.js
+++ b/erpnext/hr/doctype/employment_type/test_employment_type.js
@@ -19,4 +19,4 @@
 			'name of employment type correctly saved'),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/employment_type/test_employment_type.py b/erpnext/hr/doctype/employment_type/test_employment_type.py
index e138136..0297ffa 100644
--- a/erpnext/hr/doctype/employment_type/test_employment_type.py
+++ b/erpnext/hr/doctype/employment_type/test_employment_type.py
@@ -4,4 +4,4 @@
 
 
 import frappe
-test_records = frappe.get_test_records('Employment Type')
\ No newline at end of file
+test_records = frappe.get_test_records('Employment Type')
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js
index 629341f..3c4c672 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.js
@@ -442,4 +442,4 @@
 	tax_amount: function(frm, cdt, cdn) {
 		frm.trigger("calculate_total_tax", cdt, cdn);
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim_dashboard.py b/erpnext/hr/doctype/expense_claim/expense_claim_dashboard.py
index 7de8f4f..fe97350 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim_dashboard.py
+++ b/erpnext/hr/doctype/expense_claim/expense_claim_dashboard.py
@@ -17,4 +17,4 @@
 				'items': ['Employee Advance']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/hr/doctype/expense_claim/test_expense_claim.js b/erpnext/hr/doctype/expense_claim/test_expense_claim.js
index d0c43d3..2529fae 100644
--- a/erpnext/hr/doctype/expense_claim/test_expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/test_expense_claim.js
@@ -42,4 +42,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/hr/doctype/expense_claim/test_expense_claim.py b/erpnext/hr/doctype/expense_claim/test_expense_claim.py
index 96ea686..c2bd1e9 100644
--- a/erpnext/hr/doctype/expense_claim/test_expense_claim.py
+++ b/erpnext/hr/doctype/expense_claim/test_expense_claim.py
@@ -72,7 +72,7 @@
 	def test_expense_claim_gl_entry(self):
 		payable_account = get_payable_account(company_name)
 		taxes = generate_taxes()
-		expense_claim = make_expense_claim(payable_account, 300, 200, company_name, "Travel Expenses - _TC4", 
+		expense_claim = make_expense_claim(payable_account, 300, 200, company_name, "Travel Expenses - _TC4",
 			do_not_submit=True, taxes=taxes)
 		expense_claim.submit()
 
diff --git a/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.py b/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.py
index 8bfa1ad..5d48990 100644
--- a/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.py
+++ b/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class ExpenseClaimDetail(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/hr/doctype/expense_claim_type/expense_claim_type.py b/erpnext/hr/doctype/expense_claim_type/expense_claim_type.py
index 2595506..a637a54 100644
--- a/erpnext/hr/doctype/expense_claim_type/expense_claim_type.py
+++ b/erpnext/hr/doctype/expense_claim_type/expense_claim_type.py
@@ -25,4 +25,4 @@
 			"""Error when Company of Ledger account doesn't match with Company Selected"""
 			if frappe.db.get_value("Account", entry.default_account, "company") != entry.company:
 				frappe.throw(_("Account {0} does not match with Company {1}"
-					).format(entry.default_account, entry.company))
\ No newline at end of file
+					).format(entry.default_account, entry.company))
diff --git a/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.js b/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.js
index 62234e0..3c9ed35 100644
--- a/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.js
+++ b/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.js
@@ -27,4 +27,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/hr/doctype/holiday/holiday.py b/erpnext/hr/doctype/holiday/holiday.py
index aabab0b..78a95b9 100644
--- a/erpnext/hr/doctype/holiday/holiday.py
+++ b/erpnext/hr/doctype/holiday/holiday.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class Holiday(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/hr/doctype/holiday_list/holiday_list_dashboard.py b/erpnext/hr/doctype/holiday_list/holiday_list_dashboard.py
index 22e1de0..05641c7 100644
--- a/erpnext/hr/doctype/holiday_list/holiday_list_dashboard.py
+++ b/erpnext/hr/doctype/holiday_list/holiday_list_dashboard.py
@@ -18,4 +18,4 @@
 				'items': ['Service Level', 'Service Level Agreement']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/hr/doctype/holiday_list/test_holiday_list.js b/erpnext/hr/doctype/holiday_list/test_holiday_list.js
index bfcafa9..ce76614 100644
--- a/erpnext/hr/doctype/holiday_list/test_holiday_list.js
+++ b/erpnext/hr/doctype/holiday_list/test_holiday_list.js
@@ -39,4 +39,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/hr_settings/hr_settings.js b/erpnext/hr/doctype/hr_settings/hr_settings.js
index fd082fd..ec99472 100644
--- a/erpnext/hr/doctype/hr_settings/hr_settings.js
+++ b/erpnext/hr/doctype/hr_settings/hr_settings.js
@@ -5,4 +5,4 @@
 	restrict_backdated_leave_application: function(frm) {
 		frm.toggle_reqd("role_allowed_to_create_backdated_leave_application", frm.doc.restrict_backdated_leave_application);
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/hr_settings/hr_settings.py b/erpnext/hr/doctype/hr_settings/hr_settings.py
index ced98fb..c99df26 100644
--- a/erpnext/hr/doctype/hr_settings/hr_settings.py
+++ b/erpnext/hr/doctype/hr_settings/hr_settings.py
@@ -15,4 +15,3 @@
 		from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series
 		set_by_naming_series("Employee", "employee_number",
 			self.get("emp_created_by")=="Naming Series", hide_name_field=True)
-
diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.js b/erpnext/hr/doctype/job_applicant/job_applicant.js
index c625155..7658bc9 100644
--- a/erpnext/hr/doctype/job_applicant/job_applicant.js
+++ b/erpnext/hr/doctype/job_applicant/job_applicant.js
@@ -38,4 +38,4 @@
 		});
 
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.py b/erpnext/hr/doctype/job_applicant/job_applicant.py
index 0594ba3..14aeb03 100644
--- a/erpnext/hr/doctype/job_applicant/job_applicant.py
+++ b/erpnext/hr/doctype/job_applicant/job_applicant.py
@@ -50,4 +50,3 @@
 
 			if names:
 				frappe.throw(_("Email Address must be unique, already exists for {0}").format(comma_and(names)), frappe.DuplicateEntryError)
-
diff --git a/erpnext/hr/doctype/job_applicant/job_applicant_dashboard.py b/erpnext/hr/doctype/job_applicant/job_applicant_dashboard.py
index 7f13115..ed97978 100644
--- a/erpnext/hr/doctype/job_applicant/job_applicant_dashboard.py
+++ b/erpnext/hr/doctype/job_applicant/job_applicant_dashboard.py
@@ -12,4 +12,4 @@
                 'items': ['Job Offer']
             },
         ],
-    }
\ No newline at end of file
+    }
diff --git a/erpnext/hr/doctype/job_applicant/test_job_applicant.js b/erpnext/hr/doctype/job_applicant/test_job_applicant.js
index b5391c8..741a182 100644
--- a/erpnext/hr/doctype/job_applicant/test_job_applicant.js
+++ b/erpnext/hr/doctype/job_applicant/test_job_applicant.js
@@ -26,4 +26,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/hr/doctype/job_offer/test_job_offer.js b/erpnext/hr/doctype/job_offer/test_job_offer.js
index c9d7d2b..5339b9c 100644
--- a/erpnext/hr/doctype/job_offer/test_job_offer.js
+++ b/erpnext/hr/doctype/job_offer/test_job_offer.js
@@ -48,4 +48,4 @@
 		() => frappe.timeout(2),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/job_offer/test_job_offer.py b/erpnext/hr/doctype/job_offer/test_job_offer.py
index b3e1dc8..edb2132 100644
--- a/erpnext/hr/doctype/job_offer/test_job_offer.py
+++ b/erpnext/hr/doctype/job_offer/test_job_offer.py
@@ -79,4 +79,4 @@
 	})
 	staffing_plan.insert()
 	staffing_plan.submit()
-	return staffing_plan
\ No newline at end of file
+	return staffing_plan
diff --git a/erpnext/hr/doctype/job_opening/job_opening_dashboard.py b/erpnext/hr/doctype/job_opening/job_opening_dashboard.py
index c0890b4..31ef33e 100644
--- a/erpnext/hr/doctype/job_opening/job_opening_dashboard.py
+++ b/erpnext/hr/doctype/job_opening/job_opening_dashboard.py
@@ -9,4 +9,4 @@
                 'items': ['Job Applicant']
             }
         ],
-    }
\ No newline at end of file
+    }
diff --git a/erpnext/hr/doctype/job_opening/templates/job_opening_row.html b/erpnext/hr/doctype/job_opening/templates/job_opening_row.html
index c015101..69bf49b 100644
--- a/erpnext/hr/doctype/job_opening/templates/job_opening_row.html
+++ b/erpnext/hr/doctype/job_opening/templates/job_opening_row.html
@@ -1,16 +1,16 @@
 <div class="my-5">
 	<h3>{{ doc.job_title }}</h3>
 	<p>{{ doc.description }}</p>
-	{%- if doc.publish_salary_range -%} 
+	{%- if doc.publish_salary_range -%}
 	<p><b>{{_("Salary range per month")}}: </b>{{ frappe.format_value(frappe.utils.flt(doc.lower_range), currency=doc.currency) }} - {{ frappe.format_value(frappe.utils.flt(doc.upper_range), currency=doc.currency) }}</p>
 	{% endif %}
 	<div>
 		{%- if doc.job_application_route -%}
-		<a class='btn btn-primary' 
+		<a class='btn btn-primary'
 		href='/{{doc.job_application_route}}?new=1&job_title={{ doc.name }}'>
 		{{ _("Apply Now") }}</a>
 		{% else %}
-		<a class='btn btn-primary' 
+		<a class='btn btn-primary'
 		href='/job_application?new=1&job_title={{ doc.name }}'>
 		{{ _("Apply Now") }}</a>
 		{% endif %}
diff --git a/erpnext/hr/doctype/job_opening/test_job_opening.js b/erpnext/hr/doctype/job_opening/test_job_opening.js
index b9e6c0a..cc2f027 100644
--- a/erpnext/hr/doctype/job_opening/test_job_opening.js
+++ b/erpnext/hr/doctype/job_opening/test_job_opening.js
@@ -24,4 +24,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.js b/erpnext/hr/doctype/leave_allocation/leave_allocation.js
index e9e129c..d947641 100755
--- a/erpnext/hr/doctype/leave_allocation/leave_allocation.js
+++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.js
@@ -100,4 +100,4 @@
 			frm.set_value("total_leaves_allocated", flt(frm.doc.new_leaves_allocated));
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation_dashboard.py b/erpnext/hr/doctype/leave_allocation/leave_allocation_dashboard.py
index 7456aeb..7a063d9 100644
--- a/erpnext/hr/doctype/leave_allocation/leave_allocation_dashboard.py
+++ b/erpnext/hr/doctype/leave_allocation/leave_allocation_dashboard.py
@@ -17,4 +17,4 @@
 				'items': ['Employee Leave Balance']
 			}
 		]
-    }
\ No newline at end of file
+    }
diff --git a/erpnext/hr/doctype/leave_allocation/test_leave_allocation.js b/erpnext/hr/doctype/leave_allocation/test_leave_allocation.js
index 0ef78f2..d5364fc 100644
--- a/erpnext/hr/doctype/leave_allocation/test_leave_allocation.js
+++ b/erpnext/hr/doctype/leave_allocation/test_leave_allocation.js
@@ -38,4 +38,4 @@
 			"total leave calculation is correctly set"),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/leave_application/leave_application_calendar.js b/erpnext/hr/doctype/leave_application/leave_application_calendar.js
index 0286f30..31faadb 100644
--- a/erpnext/hr/doctype/leave_application/leave_application_calendar.js
+++ b/erpnext/hr/doctype/leave_application/leave_application_calendar.js
@@ -17,4 +17,4 @@
 		}
 	},
 	get_events_method: "erpnext.hr.doctype.leave_application.leave_application.get_events"
-}
\ No newline at end of file
+}
diff --git a/erpnext/hr/doctype/leave_application/leave_application_dashboard.py b/erpnext/hr/doctype/leave_application/leave_application_dashboard.py
index c1d6a66..c45717f 100644
--- a/erpnext/hr/doctype/leave_application/leave_application_dashboard.py
+++ b/erpnext/hr/doctype/leave_application/leave_application_dashboard.py
@@ -17,4 +17,4 @@
 				'items': ['Employee Leave Balance']
 			}
 		]
-    }
\ No newline at end of file
+    }
diff --git a/erpnext/hr/doctype/leave_application/leave_application_email_template.html b/erpnext/hr/doctype/leave_application/leave_application_email_template.html
index 209302e..14ca41b 100644
--- a/erpnext/hr/doctype/leave_application/leave_application_email_template.html
+++ b/erpnext/hr/doctype/leave_application/leave_application_email_template.html
@@ -21,5 +21,5 @@
 		<tr>
 			<td>Status</td>
 			<td>{{status}}</td>
-		</tr> 
+		</tr>
 	</table>
diff --git a/erpnext/hr/doctype/leave_application/test_leave_application.js b/erpnext/hr/doctype/leave_application/test_leave_application.js
index 6d7b6a7..0866b0b 100644
--- a/erpnext/hr/doctype/leave_application/test_leave_application.js
+++ b/erpnext/hr/doctype/leave_application/test_leave_application.js
@@ -39,4 +39,4 @@
 		// 	"leave for correct employee is submitted"),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/leave_block_list/leave_block_list_dashboard.py b/erpnext/hr/doctype/leave_block_list/leave_block_list_dashboard.py
index 2aa5498..45aa491 100644
--- a/erpnext/hr/doctype/leave_block_list/leave_block_list_dashboard.py
+++ b/erpnext/hr/doctype/leave_block_list/leave_block_list_dashboard.py
@@ -8,4 +8,4 @@
 				'items': ['Department']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/hr/doctype/leave_block_list/test_leave_block_list.js b/erpnext/hr/doctype/leave_block_list/test_leave_block_list.js
index 4537878..b39601b 100644
--- a/erpnext/hr/doctype/leave_block_list/test_leave_block_list.js
+++ b/erpnext/hr/doctype/leave_block_list/test_leave_block_list.js
@@ -24,4 +24,4 @@
 			'name of blocked leave list correctly saved'),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.py b/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.py
index be06b76..8e5a09e 100644
--- a/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.py
+++ b/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.py
@@ -9,4 +9,4 @@
 from frappe.model.document import Document
 
 class LeaveBlockListAllow(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.py b/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.py
index f4028f5..54978a1 100644
--- a/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.py
+++ b/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.py
@@ -9,4 +9,4 @@
 from frappe.model.document import Document
 
 class LeaveBlockListDate(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js
index b60e225..4a45080 100644
--- a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js
+++ b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js
@@ -21,4 +21,4 @@
 			});
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/leave_control_panel/test_leave_control_panel.js b/erpnext/hr/doctype/leave_control_panel/test_leave_control_panel.js
index 2b5cec1..9d37327 100644
--- a/erpnext/hr/doctype/leave_control_panel/test_leave_control_panel.js
+++ b/erpnext/hr/doctype/leave_control_panel/test_leave_control_panel.js
@@ -47,4 +47,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/leave_encashment/leave_encashment.py b/erpnext/hr/doctype/leave_encashment/leave_encashment.py
index 912bd8a..d136210 100644
--- a/erpnext/hr/doctype/leave_encashment/leave_encashment.py
+++ b/erpnext/hr/doctype/leave_encashment/leave_encashment.py
@@ -134,4 +134,4 @@
 			leave_type=allocation.leave_type,
 			encashment_date=allocation.to_date
 		))
-		leave_encashment.insert(ignore_permissions=True)
\ No newline at end of file
+		leave_encashment.insert(ignore_permissions=True)
diff --git a/erpnext/hr/doctype/leave_ledger_entry/leave_ledger_entry.py b/erpnext/hr/doctype/leave_ledger_entry/leave_ledger_entry.py
index cf13036..33a6243 100644
--- a/erpnext/hr/doctype/leave_ledger_entry/leave_ledger_entry.py
+++ b/erpnext/hr/doctype/leave_ledger_entry/leave_ledger_entry.py
@@ -185,4 +185,4 @@
 			from_date=allocation.to_date,
 			to_date=allocation.to_date
 		)
-		create_leave_ledger_entry(allocation, args)
\ No newline at end of file
+		create_leave_ledger_entry(allocation, args)
diff --git a/erpnext/hr/doctype/leave_period/leave_period_dashboard.py b/erpnext/hr/doctype/leave_period/leave_period_dashboard.py
index 1572de3..7c2c963 100644
--- a/erpnext/hr/doctype/leave_period/leave_period_dashboard.py
+++ b/erpnext/hr/doctype/leave_period/leave_period_dashboard.py
@@ -10,4 +10,4 @@
 				'items': ['Leave Allocation']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/hr/doctype/leave_period/test_leave_period.py b/erpnext/hr/doctype/leave_period/test_leave_period.py
index b5857bc..cbb3437 100644
--- a/erpnext/hr/doctype/leave_period/test_leave_period.py
+++ b/erpnext/hr/doctype/leave_period/test_leave_period.py
@@ -27,4 +27,4 @@
 		"to_date": to_date,
 		"is_active": 1
 	}).insert()
-	return leave_period
\ No newline at end of file
+	return leave_period
diff --git a/erpnext/hr/doctype/leave_policy/leave_policy_dashboard.py b/erpnext/hr/doctype/leave_policy/leave_policy_dashboard.py
index ff7f042..474f3a7 100644
--- a/erpnext/hr/doctype/leave_policy/leave_policy_dashboard.py
+++ b/erpnext/hr/doctype/leave_policy/leave_policy_dashboard.py
@@ -10,4 +10,4 @@
 				'items': ['Leave Policy Assignment', 'Leave Allocation']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/hr/doctype/leave_policy/test_leave_policy.py b/erpnext/hr/doctype/leave_policy/test_leave_policy.py
index fc868ea..af7567b 100644
--- a/erpnext/hr/doctype/leave_policy/test_leave_policy.py
+++ b/erpnext/hr/doctype/leave_policy/test_leave_policy.py
@@ -28,4 +28,4 @@
 			"leave_type": args.leave_type or "_Test Leave Type",
 			"annual_allocation": args.annual_allocation or 10
 		}]
-	})
\ No newline at end of file
+	})
diff --git a/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment_dashboard.py b/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment_dashboard.py
index 4bb0535..a2f7f58 100644
--- a/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment_dashboard.py
+++ b/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment_dashboard.py
@@ -10,4 +10,4 @@
 				'items': ['Leave Allocation']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment_list.js b/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment_list.js
index 8fe4b8f..8b954c4 100644
--- a/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment_list.js
+++ b/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment_list.js
@@ -105,4 +105,4 @@
 			});
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/hr/doctype/leave_policy_assignment/test_leave_policy_assignment.py b/erpnext/hr/doctype/leave_policy_assignment/test_leave_policy_assignment.py
index 9a14e35..0089804 100644
--- a/erpnext/hr/doctype/leave_policy_assignment/test_leave_policy_assignment.py
+++ b/erpnext/hr/doctype/leave_policy_assignment/test_leave_policy_assignment.py
@@ -99,5 +99,3 @@
 	def tearDown(self):
 		for doctype in ["Leave Application", "Leave Allocation", "Leave Policy Assignment", "Leave Ledger Entry"]:
 			frappe.db.sql("delete from `tab{0}`".format(doctype)) #nosec
-
-
diff --git a/erpnext/hr/doctype/leave_type/leave_type_dashboard.py b/erpnext/hr/doctype/leave_type/leave_type_dashboard.py
index 5cae9a8..c8944fc 100644
--- a/erpnext/hr/doctype/leave_type/leave_type_dashboard.py
+++ b/erpnext/hr/doctype/leave_type/leave_type_dashboard.py
@@ -11,4 +11,4 @@
 				'items': ['Attendance', 'Leave Encashment']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/hr/doctype/leave_type/test_leave_type.js b/erpnext/hr/doctype/leave_type/test_leave_type.js
index d939a24..db910cd 100644
--- a/erpnext/hr/doctype/leave_type/test_leave_type.js
+++ b/erpnext/hr/doctype/leave_type/test_leave_type.js
@@ -19,4 +19,4 @@
 			'leave type correctly saved'),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/leave_type/test_leave_type.py b/erpnext/hr/doctype/leave_type/test_leave_type.py
index 7fef297..048dddd 100644
--- a/erpnext/hr/doctype/leave_type/test_leave_type.py
+++ b/erpnext/hr/doctype/leave_type/test_leave_type.py
@@ -28,4 +28,4 @@
     if leave_type.is_ppl:
         leave_type.fraction_of_daily_salary_per_leave = args.fraction_of_daily_salary_per_leave or 0.5
 
-    return leave_type
\ No newline at end of file
+    return leave_type
diff --git a/erpnext/hr/doctype/shift_assignment/shift_assignment_calendar.js b/erpnext/hr/doctype/shift_assignment/shift_assignment_calendar.js
index bb692e1..5d2360f 100644
--- a/erpnext/hr/doctype/shift_assignment/shift_assignment_calendar.js
+++ b/erpnext/hr/doctype/shift_assignment/shift_assignment_calendar.js
@@ -10,4 +10,4 @@
 		"allDay": "allDay",
 	},
 	get_events_method: "erpnext.hr.doctype.shift_assignment.shift_assignment.get_events"
-}
\ No newline at end of file
+}
diff --git a/erpnext/hr/doctype/shift_assignment/test_shift_assignment.py b/erpnext/hr/doctype/shift_assignment/test_shift_assignment.py
index 4c3c1ed..07d92fe 100644
--- a/erpnext/hr/doctype/shift_assignment/test_shift_assignment.py
+++ b/erpnext/hr/doctype/shift_assignment/test_shift_assignment.py
@@ -77,4 +77,4 @@
 				"status": 'Active'
 			})
 
-			self.assertRaises(frappe.ValidationError, shift_assignment_3.save)
\ No newline at end of file
+			self.assertRaises(frappe.ValidationError, shift_assignment_3.save)
diff --git a/erpnext/hr/doctype/shift_request/shift_request.py b/erpnext/hr/doctype/shift_request/shift_request.py
index 6461f07..2731da1 100644
--- a/erpnext/hr/doctype/shift_request/shift_request.py
+++ b/erpnext/hr/doctype/shift_request/shift_request.py
@@ -94,4 +94,4 @@
 		msg = _("Employee {0} has already applied for {1} between {2} and {3} : ").format(self.employee,
 			d['shift_type'], formatdate(d['from_date']), formatdate(d['to_date'])) \
 			+ """ <b><a href="/app/Form/Shift Request/{0}">{0}</a></b>""".format(d["name"])
-		frappe.throw(msg, OverlapError)
\ No newline at end of file
+		frappe.throw(msg, OverlapError)
diff --git a/erpnext/hr/doctype/shift_request/shift_request_dashboard.py b/erpnext/hr/doctype/shift_request/shift_request_dashboard.py
index e3bf5df..f70b61a 100644
--- a/erpnext/hr/doctype/shift_request/shift_request_dashboard.py
+++ b/erpnext/hr/doctype/shift_request/shift_request_dashboard.py
@@ -9,4 +9,4 @@
                 'items': ['Shift Assignment']
             },
         ],
-    }
\ No newline at end of file
+    }
diff --git a/erpnext/hr/doctype/shift_request/test_shift_request.py b/erpnext/hr/doctype/shift_request/test_shift_request.py
index 3525540..60b7676 100644
--- a/erpnext/hr/doctype/shift_request/test_shift_request.py
+++ b/erpnext/hr/doctype/shift_request/test_shift_request.py
@@ -106,4 +106,4 @@
 		return shift_request
 
 	shift_request.submit()
-	return shift_request
\ No newline at end of file
+	return shift_request
diff --git a/erpnext/hr/doctype/staffing_plan/staffing_plan_dashboard.py b/erpnext/hr/doctype/staffing_plan/staffing_plan_dashboard.py
index 35a303f..8e89d53 100644
--- a/erpnext/hr/doctype/staffing_plan/staffing_plan_dashboard.py
+++ b/erpnext/hr/doctype/staffing_plan/staffing_plan_dashboard.py
@@ -9,4 +9,4 @@
                 'items': ['Job Opening']
             }
         ],
-    }
\ No newline at end of file
+    }
diff --git a/erpnext/hr/doctype/staffing_plan/test_staffing_plan.py b/erpnext/hr/doctype/staffing_plan/test_staffing_plan.py
index 628255b..1c6218e 100644
--- a/erpnext/hr/doctype/staffing_plan/test_staffing_plan.py
+++ b/erpnext/hr/doctype/staffing_plan/test_staffing_plan.py
@@ -94,4 +94,4 @@
 	company.parent_company = "_Test Company 3"
 	company.default_currency = "INR"
 	company.country = "Pakistan"
-	company.insert()
\ No newline at end of file
+	company.insert()
diff --git a/erpnext/hr/doctype/training_event/test_training_event.py b/erpnext/hr/doctype/training_event/test_training_event.py
index 9b32136..6a275b3 100644
--- a/erpnext/hr/doctype/training_event/test_training_event.py
+++ b/erpnext/hr/doctype/training_event/test_training_event.py
@@ -58,4 +58,4 @@
 		"end_time": add_days(today(), 6),
 		"introduction": "Welcome to the Basic Training Event",
 		"employees": attendees
-	}).insert()
\ No newline at end of file
+	}).insert()
diff --git a/erpnext/hr/doctype/training_event/tests/test_training_event.js b/erpnext/hr/doctype/training_event/tests/test_training_event.js
index 8ff4fec..08031a1 100644
--- a/erpnext/hr/doctype/training_event/tests/test_training_event.js
+++ b/erpnext/hr/doctype/training_event/tests/test_training_event.js
@@ -56,4 +56,4 @@
 		() => frappe.timeout(2),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/training_event/training_event.js b/erpnext/hr/doctype/training_event/training_event.js
index d5f6e5f..642e6a1 100644
--- a/erpnext/hr/doctype/training_event/training_event.js
+++ b/erpnext/hr/doctype/training_event/training_event.js
@@ -46,4 +46,3 @@
 		frm.events.set_employee_query(frm);
 	}
 });
-
diff --git a/erpnext/hr/doctype/training_event/training_event_dashboard.py b/erpnext/hr/doctype/training_event/training_event_dashboard.py
index 1c1645c..19afd8d 100644
--- a/erpnext/hr/doctype/training_event/training_event_dashboard.py
+++ b/erpnext/hr/doctype/training_event/training_event_dashboard.py
@@ -9,4 +9,4 @@
                 'items': ['Training Result', 'Training Feedback']
             },
         ],
-    }
\ No newline at end of file
+    }
diff --git a/erpnext/hr/doctype/training_feedback/test_training_feedback.js b/erpnext/hr/doctype/training_feedback/test_training_feedback.js
index 9daa51f..5c825ae 100644
--- a/erpnext/hr/doctype/training_feedback/test_training_feedback.js
+++ b/erpnext/hr/doctype/training_feedback/test_training_feedback.js
@@ -49,4 +49,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/hr/doctype/training_feedback/test_training_feedback.py b/erpnext/hr/doctype/training_feedback/test_training_feedback.py
index c30a3ad..4c0c180 100644
--- a/erpnext/hr/doctype/training_feedback/test_training_feedback.py
+++ b/erpnext/hr/doctype/training_feedback/test_training_feedback.py
@@ -64,4 +64,4 @@
 		"training_event": event,
 		"employee": employee,
 		"feedback": "Test"
-	})
\ No newline at end of file
+	})
diff --git a/erpnext/hr/doctype/training_feedback/training_feedback.js b/erpnext/hr/doctype/training_feedback/training_feedback.js
index 0dea098..5e875c1 100644
--- a/erpnext/hr/doctype/training_feedback/training_feedback.js
+++ b/erpnext/hr/doctype/training_feedback/training_feedback.js
@@ -7,4 +7,4 @@
 		frm.add_fetch("training_event", "event_name", "event_name");
 		frm.add_fetch("training_event", "trainer_name", "trainer_name");
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/training_feedback/training_feedback.py b/erpnext/hr/doctype/training_feedback/training_feedback.py
index 0d32de7..3d4b9b3 100644
--- a/erpnext/hr/doctype/training_feedback/training_feedback.py
+++ b/erpnext/hr/doctype/training_feedback/training_feedback.py
@@ -42,4 +42,3 @@
 
 		if employee:
 			frappe.db.set_value("Training Event Employee", employee, "status", "Completed")
-
diff --git a/erpnext/hr/doctype/training_program/training_program.js b/erpnext/hr/doctype/training_program/training_program.js
index 7d85cab..a4ccf54 100644
--- a/erpnext/hr/doctype/training_program/training_program.js
+++ b/erpnext/hr/doctype/training_program/training_program.js
@@ -2,4 +2,4 @@
 // For license information, please see license.txt
 
 frappe.ui.form.on('Training Program', {
-});
\ No newline at end of file
+});
diff --git a/erpnext/hr/doctype/training_program/training_program_dashboard.py b/erpnext/hr/doctype/training_program/training_program_dashboard.py
index 441a71b..0fc18a8 100644
--- a/erpnext/hr/doctype/training_program/training_program_dashboard.py
+++ b/erpnext/hr/doctype/training_program/training_program_dashboard.py
@@ -10,4 +10,4 @@
 				'items': ['Training Event']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/hr/doctype/training_result/training_result.js b/erpnext/hr/doctype/training_result/training_result.js
index 62ac383..5cdbcad 100644
--- a/erpnext/hr/doctype/training_result/training_result.js
+++ b/erpnext/hr/doctype/training_result/training_result.js
@@ -11,7 +11,7 @@
 	},
 
 	training_event: function(frm) {
-		if (frm.doc.training_event && !frm.doc.docstatus && !frm.doc.employees) { 
+		if (frm.doc.training_event && !frm.doc.docstatus && !frm.doc.employees) {
 			frappe.call({
 				method: "erpnext.hr.doctype.training_result.training_result.get_employees",
 				args: {
diff --git a/erpnext/hr/doctype/training_result_employee/test_training_result.js b/erpnext/hr/doctype/training_result_employee/test_training_result.js
index 2ebf896..3f39750 100644
--- a/erpnext/hr/doctype/training_result_employee/test_training_result.js
+++ b/erpnext/hr/doctype/training_result_employee/test_training_result.js
@@ -50,4 +50,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/hr/doctype/vehicle/vehicle_dashboard.py b/erpnext/hr/doctype/vehicle/vehicle_dashboard.py
index 761c701..628c897 100644
--- a/erpnext/hr/doctype/vehicle/vehicle_dashboard.py
+++ b/erpnext/hr/doctype/vehicle/vehicle_dashboard.py
@@ -17,4 +17,4 @@
 				'items': ['Delivery Trip']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/hr/doctype/vehicle_log/test_vehicle_log.py b/erpnext/hr/doctype/vehicle_log/test_vehicle_log.py
index ed52c4e..ed02120 100644
--- a/erpnext/hr/doctype/vehicle_log/test_vehicle_log.py
+++ b/erpnext/hr/doctype/vehicle_log/test_vehicle_log.py
@@ -115,4 +115,4 @@
 	vehicle_log.save()
 	vehicle_log.submit()
 
-	return vehicle_log
\ No newline at end of file
+	return vehicle_log
diff --git a/erpnext/hr/doctype/vehicle_log/vehicle_log.js b/erpnext/hr/doctype/vehicle_log/vehicle_log.js
index 6f3a0dc..14fe9a0 100644
--- a/erpnext/hr/doctype/vehicle_log/vehicle_log.js
+++ b/erpnext/hr/doctype/vehicle_log/vehicle_log.js
@@ -24,4 +24,3 @@
 		});
 	}
 });
-
diff --git a/erpnext/hr/notification/training_feedback/training_feedback.html b/erpnext/hr/notification/training_feedback/training_feedback.html
index fd8fef9..b49662a 100644
--- a/erpnext/hr/notification/training_feedback/training_feedback.html
+++ b/erpnext/hr/notification/training_feedback/training_feedback.html
@@ -3,4 +3,4 @@
 <p>You attended training {{ frappe.utils.get_link_to_form(
 	"Training Event", doc.training_event) }}</p>
 
-<p>{{ _("Please share your feedback to the training by clicking on 'Training Feedback' and then 'New'") }}</p>
\ No newline at end of file
+<p>{{ _("Please share your feedback to the training by clicking on 'Training Feedback' and then 'New'") }}</p>
diff --git a/erpnext/hr/notification/training_scheduled/training_scheduled.html b/erpnext/hr/notification/training_scheduled/training_scheduled.html
index 374038a..50f6d07 100644
--- a/erpnext/hr/notification/training_scheduled/training_scheduled.html
+++ b/erpnext/hr/notification/training_scheduled/training_scheduled.html
@@ -41,4 +41,4 @@
         <td width="15"></td>
     </tr>
     <tr height="10"></tr>
-</table>
\ No newline at end of file
+</table>
diff --git a/erpnext/hr/page/organizational_chart/organizational_chart.js b/erpnext/hr/page/organizational_chart/organizational_chart.js
index 08f2c94..81162a4 100644
--- a/erpnext/hr/page/organizational_chart/organizational_chart.js
+++ b/erpnext/hr/page/organizational_chart/organizational_chart.js
@@ -18,4 +18,4 @@
 			organizational_chart.show();
 		});
 	});
-};
\ No newline at end of file
+};
diff --git a/erpnext/hr/page/organizational_chart/organizational_chart.py b/erpnext/hr/page/organizational_chart/organizational_chart.py
index 2983198..4423d29 100644
--- a/erpnext/hr/page/organizational_chart/organizational_chart.py
+++ b/erpnext/hr/page/organizational_chart/organizational_chart.py
@@ -45,4 +45,4 @@
 		num_connections += len(descendants)
 		nodes_to_expand.extend(descendants)
 
-	return num_connections
\ No newline at end of file
+	return num_connections
diff --git a/erpnext/hr/page/team_updates/team_updates.py b/erpnext/hr/page/team_updates/team_updates.py
index a6cf935..58cdc4b 100644
--- a/erpnext/hr/page/team_updates/team_updates.py
+++ b/erpnext/hr/page/team_updates/team_updates.py
@@ -17,4 +17,4 @@
 		if d.text_content:
 			d.content = frappe.utils.md_to_html(EmailReplyParser.parse_reply(d.text_content))
 
-	return data
\ No newline at end of file
+	return data
diff --git a/erpnext/hr/print_format/job_offer/job_offer.json b/erpnext/hr/print_format/job_offer/job_offer.json
index 3fc2bcf..0a92230 100644
--- a/erpnext/hr/print_format/job_offer/job_offer.json
+++ b/erpnext/hr/print_format/job_offer/job_offer.json
@@ -15,7 +15,7 @@
  "name": "Job Offer", 
  "owner": "Administrator", 
  "print_format_builder": 0, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/hr/print_format/standard_appointment_letter/standard_appointment_letter.html b/erpnext/hr/print_format/standard_appointment_letter/standard_appointment_letter.html
index d60582e..87daafc 100644
--- a/erpnext/hr/print_format/standard_appointment_letter/standard_appointment_letter.html
+++ b/erpnext/hr/print_format/standard_appointment_letter/standard_appointment_letter.html
@@ -35,4 +35,4 @@
 <div>
     <span><b>________________</b></span><br>
     <span><b>{{ doc.applicant_name }}</b></span>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.py b/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.py
index aa8eea5..d8691b4 100644
--- a/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.py
+++ b/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.py
@@ -54,4 +54,4 @@
 		user_name = frappe.get_value('User', user, 'full_name')
 		count = len([d for d in replies if d.sender == user])
 		data.append([user_name, count, total])
-	return data
\ No newline at end of file
+	return data
diff --git a/erpnext/hr/report/employee_advance_summary/employee_advance_summary.js b/erpnext/hr/report/employee_advance_summary/employee_advance_summary.js
index 528ae4c..8de4af5 100644
--- a/erpnext/hr/report/employee_advance_summary/employee_advance_summary.js
+++ b/erpnext/hr/report/employee_advance_summary/employee_advance_summary.js
@@ -38,4 +38,3 @@
 		}
 	]
 };
-
diff --git a/erpnext/hr/report/employee_analytics/employee_analytics.py b/erpnext/hr/report/employee_analytics/employee_analytics.py
index 8f39388..fe77b6a 100644
--- a/erpnext/hr/report/employee_analytics/employee_analytics.py
+++ b/erpnext/hr/report/employee_analytics/employee_analytics.py
@@ -81,4 +81,3 @@
 	}
 	chart["type"] = "donut"
 	return chart
-
diff --git a/erpnext/hr/report/employee_birthday/employee_birthday.js b/erpnext/hr/report/employee_birthday/employee_birthday.js
index 60b69b4..bbe4a8d 100644
--- a/erpnext/hr/report/employee_birthday/employee_birthday.js
+++ b/erpnext/hr/report/employee_birthday/employee_birthday.js
@@ -8,7 +8,7 @@
 			"label": __("Month"),
 			"fieldtype": "Select",
 			"options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
-			"default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", 
+			"default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
 				"Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()],
 		},
 		{
@@ -19,4 +19,4 @@
 			"default": frappe.defaults.get_user_default("Company")
 		}
 	]
-}
\ No newline at end of file
+}
diff --git a/erpnext/hr/report/recruitment_analytics/recruitment_analytics.js b/erpnext/hr/report/recruitment_analytics/recruitment_analytics.js
index 9620f52..51dc7ff 100644
--- a/erpnext/hr/report/recruitment_analytics/recruitment_analytics.js
+++ b/erpnext/hr/report/recruitment_analytics/recruitment_analytics.js
@@ -20,4 +20,4 @@
 			"reqd": 1,
 		},
 	]
-};
\ No newline at end of file
+};
diff --git a/erpnext/hr/report/vehicle_expenses/vehicle_expenses.js b/erpnext/hr/report/vehicle_expenses/vehicle_expenses.js
index 879acd1..2d0aa0f 100644
--- a/erpnext/hr/report/vehicle_expenses/vehicle_expenses.js
+++ b/erpnext/hr/report/vehicle_expenses/vehicle_expenses.js
@@ -49,4 +49,3 @@
 		}
 	]
 };
-
diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py
index 992b18d..a1026ce 100644
--- a/erpnext/hr/utils.py
+++ b/erpnext/hr/utils.py
@@ -413,4 +413,4 @@
 def validate_active_employee(employee):
 	if frappe.db.get_value("Employee", employee, "status") == "Inactive":
 		frappe.throw(_("Transactions cannot be created for an Inactive Employee {0}.").format(
-			get_link_to_form("Employee", employee)), InactiveEmployeeStatusError)
\ No newline at end of file
+			get_link_to_form("Employee", employee)), InactiveEmployeeStatusError)
diff --git a/erpnext/hr/web_form/job_application/job_application.js b/erpnext/hr/web_form/job_application/job_application.js
index 699703c..ffc5e98 100644
--- a/erpnext/hr/web_form/job_application/job_application.js
+++ b/erpnext/hr/web_form/job_application/job_application.js
@@ -1,3 +1,3 @@
 frappe.ready(function() {
 	// bind events here
-})
\ No newline at end of file
+})
diff --git a/erpnext/loan_management/dashboard_chart_source/top_10_pledged_loan_securities/top_10_pledged_loan_securities.js b/erpnext/loan_management/dashboard_chart_source/top_10_pledged_loan_securities/top_10_pledged_loan_securities.js
index cf75cc8..5817941 100644
--- a/erpnext/loan_management/dashboard_chart_source/top_10_pledged_loan_securities/top_10_pledged_loan_securities.js
+++ b/erpnext/loan_management/dashboard_chart_source/top_10_pledged_loan_securities/top_10_pledged_loan_securities.js
@@ -11,4 +11,4 @@
 			default: frappe.defaults.get_user_default("Company")
 		}
 	]
-};
\ No newline at end of file
+};
diff --git a/erpnext/loan_management/dashboard_chart_source/top_10_pledged_loan_securities/top_10_pledged_loan_securities.py b/erpnext/loan_management/dashboard_chart_source/top_10_pledged_loan_securities/top_10_pledged_loan_securities.py
index 6bb0440..6ce2a54 100644
--- a/erpnext/loan_management/dashboard_chart_source/top_10_pledged_loan_securities/top_10_pledged_loan_securities.py
+++ b/erpnext/loan_management/dashboard_chart_source/top_10_pledged_loan_securities/top_10_pledged_loan_securities.py
@@ -73,4 +73,4 @@
 			'chartType': 'bar',
 			'values': values
 		}]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/loan_management/doctype/loan/loan_dashboard.py b/erpnext/loan_management/doctype/loan/loan_dashboard.py
index 7a8190f..711a782 100644
--- a/erpnext/loan_management/doctype/loan/loan_dashboard.py
+++ b/erpnext/loan_management/doctype/loan/loan_dashboard.py
@@ -16,4 +16,4 @@
 				'items': ['Loan Repayment', 'Loan Interest Accrual', 'Loan Write Off', 'Loan Security Unpledge']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/loan_management/doctype/loan/test_loan.py b/erpnext/loan_management/doctype/loan/test_loan.py
index 314f58d..122d723 100644
--- a/erpnext/loan_management/doctype/loan/test_loan.py
+++ b/erpnext/loan_management/doctype/loan/test_loan.py
@@ -988,4 +988,4 @@
 
 	loan.save()
 
-	return loan
\ No newline at end of file
+	return loan
diff --git a/erpnext/loan_management/doctype/loan_application/loan_application_dashboard.py b/erpnext/loan_management/doctype/loan_application/loan_application_dashboard.py
index bf3f58b..3975adf 100644
--- a/erpnext/loan_management/doctype/loan_application/loan_application_dashboard.py
+++ b/erpnext/loan_management/doctype/loan_application/loan_application_dashboard.py
@@ -9,4 +9,4 @@
                 'items': ['Loan', 'Loan Security Pledge']
             },
         ],
-    }
\ No newline at end of file
+    }
diff --git a/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py b/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py
index f341e81..f113c10 100644
--- a/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py
+++ b/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py
@@ -203,5 +203,3 @@
 		disbursal_amount = loan_details.loan_amount - loan_details.disbursed_amount
 
 	return disbursal_amount
-
-
diff --git a/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py b/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py
index 7978350..d75213c 100644
--- a/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py
+++ b/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py
@@ -247,4 +247,3 @@
 		posting_date = getdate()
 
 	return flt((principal_amount * rate_of_interest) / (days_in_year(get_datetime(posting_date).year) * 100))
-
diff --git a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
index b8b1a40..57aec2e 100644
--- a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
+++ b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
@@ -455,6 +455,3 @@
 		amounts['payable_amount'] = amounts['payable_principal_amount'] + amounts['interest_amount']
 
 	return amounts
-
-
-
diff --git a/erpnext/loan_management/doctype/loan_security/loan_security_dashboard.py b/erpnext/loan_management/doctype/loan_security/loan_security_dashboard.py
index 878b3fd..3eec566 100644
--- a/erpnext/loan_management/doctype/loan_security/loan_security_dashboard.py
+++ b/erpnext/loan_management/doctype/loan_security/loan_security_dashboard.py
@@ -12,4 +12,4 @@
 				'items': ['Loan Security Pledge', 'Loan Security Unpledge']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/loan_management/doctype/loan_security_pledge/loan_security_pledge.js b/erpnext/loan_management/doctype/loan_security_pledge/loan_security_pledge.js
index 11c932f..48ca392 100644
--- a/erpnext/loan_management/doctype/loan_security_pledge/loan_security_pledge.js
+++ b/erpnext/loan_management/doctype/loan_security_pledge/loan_security_pledge.js
@@ -40,4 +40,4 @@
 	qty: function(frm, cdt, cdn) {
 		frm.events.calculate_amounts(frm, cdt, cdn);
 	},
-});
\ No newline at end of file
+});
diff --git a/erpnext/loan_management/doctype/loan_security_price/loan_security_price.py b/erpnext/loan_management/doctype/loan_security_price/loan_security_price.py
index 32d81af..9fc1fda 100644
--- a/erpnext/loan_management/doctype/loan_security_price/loan_security_price.py
+++ b/erpnext/loan_management/doctype/loan_security_price/loan_security_price.py
@@ -40,12 +40,3 @@
 		frappe.throw(_("No valid Loan Security Price found for {0}").format(frappe.bold(loan_security)))
 	else:
 		return loan_security_price
-
-
-
-
-
-
-
-
-
diff --git a/erpnext/loan_management/doctype/loan_security_shortfall/loan_security_shortfall.py b/erpnext/loan_management/doctype/loan_security_shortfall/loan_security_shortfall.py
index 8233b7b..cd7694b 100644
--- a/erpnext/loan_management/doctype/loan_security_shortfall/loan_security_shortfall.py
+++ b/erpnext/loan_management/doctype/loan_security_shortfall/loan_security_shortfall.py
@@ -122,4 +122,3 @@
 			"shortfall_amount": 0,
 			"shortfall_percentage": 0
 		})
-
diff --git a/erpnext/loan_management/doctype/loan_security_type/loan_security_type_dashboard.py b/erpnext/loan_management/doctype/loan_security_type/loan_security_type_dashboard.py
index ac33589..17de8c1 100644
--- a/erpnext/loan_management/doctype/loan_security_type/loan_security_type_dashboard.py
+++ b/erpnext/loan_management/doctype/loan_security_type/loan_security_type_dashboard.py
@@ -12,4 +12,4 @@
 				'items': ['Loan Security Pledge', 'Loan Security Unpledge']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/loan_management/doctype/loan_security_unpledge/loan_security_unpledge.py b/erpnext/loan_management/doctype/loan_security_unpledge/loan_security_unpledge.py
index b24dc2f..4f936dd 100644
--- a/erpnext/loan_management/doctype/loan_security_unpledge/loan_security_unpledge.py
+++ b/erpnext/loan_management/doctype/loan_security_unpledge/loan_security_unpledge.py
@@ -147,8 +147,3 @@
 		current_pledges[security] -= unpledges.get(security, 0.0)
 
 	return current_pledges
-
-
-
-
-
diff --git a/erpnext/loan_management/doctype/loan_type/loan_type.py b/erpnext/loan_management/doctype/loan_type/loan_type.py
index 208cb19..50ef930 100644
--- a/erpnext/loan_management/doctype/loan_type/loan_type.py
+++ b/erpnext/loan_management/doctype/loan_type/loan_type.py
@@ -21,4 +21,3 @@
 
 		if self.get('loan_account') == self.get('payment_account'):
 			frappe.throw(_('Loan Account and Payment Account cannot be same'))
-
diff --git a/erpnext/loan_management/doctype/loan_type/loan_type_dashboard.py b/erpnext/loan_management/doctype/loan_type/loan_type_dashboard.py
index 58c6689..95d97fd 100644
--- a/erpnext/loan_management/doctype/loan_type/loan_type_dashboard.py
+++ b/erpnext/loan_management/doctype/loan_type/loan_type_dashboard.py
@@ -12,4 +12,4 @@
 				'items': ['Loan Application']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/loan_management/doctype/loan_write_off/loan_write_off.py b/erpnext/loan_management/doctype/loan_write_off/loan_write_off.py
index 54a3f2c..676df70 100644
--- a/erpnext/loan_management/doctype/loan_write_off/loan_write_off.py
+++ b/erpnext/loan_management/doctype/loan_write_off/loan_write_off.py
@@ -84,5 +84,3 @@
 		)
 
 		make_gl_entries(gl_entries, cancel=cancel, merge_entries=False)
-
-
diff --git a/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual.py b/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual.py
index 11333dc..8c67c0a 100644
--- a/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual.py
+++ b/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual.py
@@ -61,4 +61,3 @@
 	})
 
 	return pending_accrual
-
diff --git a/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual_dashboard.py b/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual_dashboard.py
index 243a7a3..e104c66 100644
--- a/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual_dashboard.py
+++ b/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual_dashboard.py
@@ -9,4 +9,4 @@
 				'items': ['Loan Interest Accrual']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/loan_management/doctype/process_loan_security_shortfall/process_loan_security_shortfall_dashboard.py b/erpnext/loan_management/doctype/process_loan_security_shortfall/process_loan_security_shortfall_dashboard.py
index dc9bd81..e67e4d4 100644
--- a/erpnext/loan_management/doctype/process_loan_security_shortfall/process_loan_security_shortfall_dashboard.py
+++ b/erpnext/loan_management/doctype/process_loan_security_shortfall/process_loan_security_shortfall_dashboard.py
@@ -9,4 +9,4 @@
 				'items': ['Loan Security Shortfall']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/loan_management/loan_common.js b/erpnext/loan_management/loan_common.js
index 50b68da..43980ff 100644
--- a/erpnext/loan_management/loan_common.js
+++ b/erpnext/loan_management/loan_common.js
@@ -40,4 +40,4 @@
 			frm.set_value("applicant_name", null);
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/loan_management/report/applicant_wise_loan_security_exposure/applicant_wise_loan_security_exposure.py b/erpnext/loan_management/report/applicant_wise_loan_security_exposure/applicant_wise_loan_security_exposure.py
index 0ccd149..f2cbbb4 100644
--- a/erpnext/loan_management/report/applicant_wise_loan_security_exposure/applicant_wise_loan_security_exposure.py
+++ b/erpnext/loan_management/report/applicant_wise_loan_security_exposure/applicant_wise_loan_security_exposure.py
@@ -136,4 +136,4 @@
 		total_value_map[security.applicant] += current_pledges.get((security.applicant, security.loan_security)) \
 			* loan_security_details.get(security.loan_security, {}).get('latest_price', 0)
 
-	return current_pledges, total_value_map, applicant_type_map
\ No newline at end of file
+	return current_pledges, total_value_map, applicant_type_map
diff --git a/erpnext/loan_management/report/loan_interest_report/loan_interest_report.py b/erpnext/loan_management/report/loan_interest_report/loan_interest_report.py
index 2a74a1e..a505e72 100644
--- a/erpnext/loan_management/report/loan_interest_report/loan_interest_report.py
+++ b/erpnext/loan_management/report/loan_interest_report/loan_interest_report.py
@@ -182,4 +182,4 @@
 		loan_wise_security_value[key[0]] += \
 			flt(qty * loan_security_details.get(key[1], {}).get('latest_price', 0))
 
-	return loan_wise_security_value
\ No newline at end of file
+	return loan_wise_security_value
diff --git a/erpnext/loan_management/report/loan_repayment_and_closure/loan_repayment_and_closure.py b/erpnext/loan_management/report/loan_repayment_and_closure/loan_repayment_and_closure.py
index c6f6b99..6591077 100644
--- a/erpnext/loan_management/report/loan_repayment_and_closure/loan_repayment_and_closure.py
+++ b/erpnext/loan_management/report/loan_repayment_and_closure/loan_repayment_and_closure.py
@@ -126,4 +126,4 @@
 
 		data.append(row)
 
-	return data
\ No newline at end of file
+	return data
diff --git a/erpnext/loan_management/report/loan_security_exposure/loan_security_exposure.py b/erpnext/loan_management/report/loan_security_exposure/loan_security_exposure.py
index 887a86a..34bbe5a 100644
--- a/erpnext/loan_management/report/loan_security_exposure/loan_security_exposure.py
+++ b/erpnext/loan_management/report/loan_security_exposure/loan_security_exposure.py
@@ -79,6 +79,3 @@
 		total_portfolio_value += flt(qty * loan_security_details.get(key[1], {}).get('latest_price', 0))
 
 	return security_wise_map, total_portfolio_value
-
-
-
diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js
index 546a68f..d1a8c8d 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js
+++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js
@@ -69,10 +69,10 @@
 			if (flag) {
 				this.frm.add_custom_button(__('Maintenance Visit'), function () {
 					let options = "";
-					
+
 					me.frm.call('get_pending_data', {data_type: "items"}).then(r => {
 						options = r.message;
-						
+
 						let schedule_id = "";
 						let d = new frappe.ui.Dialog({
 							title: __("Enter Visit Details"),
@@ -86,7 +86,7 @@
 									let field = d.get_field("scheduled_date");
 									me.frm.call('get_pending_data',
 										{
-											item_name: this.value, 
+											item_name: this.value,
 											data_type: "date"
 										}).then(r => {
 										field.df.options = r.message;
@@ -157,10 +157,9 @@
 		let me = this;
 		if (item.start_date && item.periodicity) {
 			me.frm.call('validate_end_date_visits');
-			
+
 		}
 	}
 };
 
 extend_cscript(cur_frm.cscript, new erpnext.maintenance.MaintenanceSchedule({frm: cur_frm}));
-
diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
index d6e42f3..9728903 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
@@ -52,15 +52,15 @@
 						item.end_date = add_days(item.start_date, item.no_of_visits * days_in_period[item.periodicity])
 					else:
 						item.end_date = add_days(item.start_date, days_in_period[item.periodicity])
-						
+
 				diff = date_diff(item.end_date, item.start_date) + 1
 				no_of_visits = cint(diff / days_in_period[item.periodicity])
-				
+
 				if not item.no_of_visits or item.no_of_visits == 0:
 					item.end_date = add_days(item.start_date, days_in_period[item.periodicity])
 					diff = date_diff(item.end_date, item.start_date) + 1
 					item.no_of_visits = cint(diff / days_in_period[item.periodicity])
-					
+
 				elif item.no_of_visits > no_of_visits:
 					item.end_date = add_days(item.start_date, item.no_of_visits * days_in_period[item.periodicity])
 
@@ -207,7 +207,7 @@
 
 	def on_update(self):
 		frappe.db.set(self, 'status', 'Draft')
-	
+
 	def update_amc_date(self, serial_nos, amc_expiry_date=None):
 		for serial_no in serial_nos:
 			serial_no_doc = frappe.get_doc("Serial No", serial_no)
@@ -300,7 +300,7 @@
 			for schedule in self.schedules:
 				if schedule.item_name == item_name and s_date == formatdate(schedule.scheduled_date, "dd-mm-yyyy"):
 					return schedule.name
-				
+
 @frappe.whitelist()
 def update_serial_nos(s_id):
 	serial_nos = frappe.db.get_value('Maintenance Schedule Detail', s_id, 'serial_no')
@@ -318,12 +318,12 @@
 		target.maintenance_type = "Scheduled"
 		target.maintenance_schedule = source.name
 		target.maintenance_schedule_detail = s_id
-		
+
 	def update_sales(source, target, parent):
 		sales_person = frappe.db.get_value('Maintenance Schedule Detail', s_id, 'sales_person')
 		target.service_person = sales_person
 		target.serial_no = ''
-	
+
 	doclist = get_mapped_doc("Maintenance Schedule", source_name, {
 		"Maintenance Schedule": {
 			"doctype": "Maintenance Visit",
diff --git a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py
index 09981ba..c733dd0 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py
+++ b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py
@@ -22,7 +22,7 @@
 		ms.cancel()
 		events_after_cancel = get_events(ms)
 		self.assertTrue(len(events_after_cancel) == 0)
-	
+
 	def test_make_schedule(self):
 		ms = make_maintenance_schedule()
 		ms.save()
@@ -72,7 +72,7 @@
 
 		#checks if visit status is back updated in schedule
 		self.assertTrue(ms.schedules[1].completion_status, "Partially Completed")
-	
+
 def get_events(ms):
 	return frappe.get_all("Event Participants", filters={
 			"reference_doctype": ms.doctype,
diff --git a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py
index 7fffc94..d63c700 100644
--- a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py
+++ b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py
@@ -28,11 +28,11 @@
 	def validate(self):
 		self.validate_serial_no()
 		self.validate_maintenance_date()
-	
+
 	def update_completion_status(self):
 		if self.maintenance_schedule_detail:
 			frappe.db.set_value('Maintenance Schedule Detail', self.maintenance_schedule_detail, 'completion_status', self.completion_status)
-	
+
 	def update_actual_date(self):
 		if self.maintenance_schedule_detail:
 			frappe.db.set_value('Maintenance Schedule Detail', self.maintenance_schedule_detail, 'actual_date', self.mntc_date)
diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order.js b/erpnext/manufacturing/doctype/blanket_order/blanket_order.js
index f19a1b0..d3bb33e 100644
--- a/erpnext/manufacturing/doctype/blanket_order/blanket_order.js
+++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order.js
@@ -85,5 +85,3 @@
 		frm.trigger('set_tc_name_filter');
 	}
 });
-
-
diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order.py b/erpnext/manufacturing/doctype/blanket_order/blanket_order.py
index d7556ad..1aedb1e 100644
--- a/erpnext/manufacturing/doctype/blanket_order/blanket_order.py
+++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order.py
@@ -76,4 +76,4 @@
 			"postprocess": update_item
 		}
 	})
-	return target_doc
\ No newline at end of file
+	return target_doc
diff --git a/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py b/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py
index 3171def..9a0a72f 100644
--- a/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py
+++ b/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py
@@ -88,4 +88,4 @@
 
 	bo.insert()
 	bo.submit()
-	return bo
\ No newline at end of file
+	return bo
diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js
index 5afda70..1481f1c 100644
--- a/erpnext/manufacturing/doctype/bom/bom.js
+++ b/erpnext/manufacturing/doctype/bom/bom.js
@@ -235,7 +235,7 @@
 						reqd: 1,
 					},
 					{
-						fieldname: "varint_item_code",
+						fieldname: "variant_item_code",
 						options: "Item",
 						label: __("Variant Item"),
 						fieldtype: "Link",
@@ -287,7 +287,7 @@
 			let variant_items = data.items || [];
 
 			variant_items.forEach(d => {
-				if (!d.varint_item_code) {
+				if (!d.variant_item_code) {
 					frappe.throw(__("Select variant item code for the template item {0}", [d.item_code]));
 				}
 			})
@@ -299,7 +299,7 @@
 		has_template_rm.forEach(d => {
 			dialog.fields_dict.items.df.data.push({
 				"item_code": d.item_code,
-				"varint_item_code": "",
+				"variant_item_code": "",
 				"qty": d.qty,
 				"source_warehouse": d.source_warehouse,
 				"operation": d.operation
diff --git a/erpnext/manufacturing/doctype/bom/bom_item_preview.html b/erpnext/manufacturing/doctype/bom/bom_item_preview.html
index 6088e46..e614a7e 100644
--- a/erpnext/manufacturing/doctype/bom/bom_item_preview.html
+++ b/erpnext/manufacturing/doctype/bom/bom_item_preview.html
@@ -38,4 +38,4 @@
 			{{ __("Open Item {0}", [data.item_code.bold()]) }}</a>
 		{% endif %}
 	</p>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/manufacturing/doctype/bom/bom_tree.js b/erpnext/manufacturing/doctype/bom/bom_tree.js
index 60fb377..6e2599e 100644
--- a/erpnext/manufacturing/doctype/bom/bom_tree.js
+++ b/erpnext/manufacturing/doctype/bom/bom_tree.js
@@ -70,4 +70,4 @@
 		}
 	},
 	view_template: 'bom_item_preview'
-}
\ No newline at end of file
+}
diff --git a/erpnext/manufacturing/doctype/bom/test_bom.js b/erpnext/manufacturing/doctype/bom/test_bom.js
index 5044a28..98a9198 100644
--- a/erpnext/manufacturing/doctype/bom/test_bom.js
+++ b/erpnext/manufacturing/doctype/bom/test_bom.js
@@ -60,4 +60,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.py b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.py
index cc5a3f8..39ccbdd 100644
--- a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.py
+++ b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class BOMExplosionItem(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/manufacturing/doctype/bom_item/bom_item.py b/erpnext/manufacturing/doctype/bom_item/bom_item.py
index e7cdea2..220c73e 100644
--- a/erpnext/manufacturing/doctype/bom_item/bom_item.py
+++ b/erpnext/manufacturing/doctype/bom_item/bom_item.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class BOMItem(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/manufacturing/doctype/bom_operation/bom_operation.py b/erpnext/manufacturing/doctype/bom_operation/bom_operation.py
index ee3f877..e3501eb 100644
--- a/erpnext/manufacturing/doctype/bom_operation/bom_operation.py
+++ b/erpnext/manufacturing/doctype/bom_operation/bom_operation.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class BOMOperation(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.js b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.js
index e4b8a20..bf5fe2e 100644
--- a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.js
+++ b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.js
@@ -46,4 +46,4 @@
 			}
 		});
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/manufacturing/doctype/job_card/job_card.js b/erpnext/manufacturing/doctype/job_card/job_card.js
index 81860c9..91eb4a0 100644
--- a/erpnext/manufacturing/doctype/job_card/job_card.js
+++ b/erpnext/manufacturing/doctype/job_card/job_card.js
@@ -367,4 +367,4 @@
 	to_time: function(frm) {
 		frm.set_value('started_time', '');
 	}
-})
\ No newline at end of file
+})
diff --git a/erpnext/manufacturing/doctype/job_card/job_card_list.js b/erpnext/manufacturing/doctype/job_card/job_card_list.js
index ed851eb..8017209 100644
--- a/erpnext/manufacturing/doctype/job_card/job_card_list.js
+++ b/erpnext/manufacturing/doctype/job_card/job_card_list.js
@@ -12,4 +12,4 @@
 			return [__("Open"), "red", "status,=,Open"];
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py
index b6a6c33..8fa0b27 100644
--- a/erpnext/manufacturing/doctype/job_card/test_job_card.py
+++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py
@@ -72,4 +72,4 @@
 				doc.cancel()
 
 			for d in job_cards:
-				frappe.delete_doc("Job Card", d.name)
\ No newline at end of file
+				frappe.delete_doc("Job Card", d.name)
diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.js b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.js
index 668e981..a0122a4 100644
--- a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.js
+++ b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.js
@@ -30,4 +30,4 @@
 		title: __("Update BOM Cost Automatically"),
 		description: __("If ticked, the BOM cost will be automatically updated based on Valuation Rate / Price List Rate / last purchase rate of raw materials.")
 	}
-];
\ No newline at end of file
+];
diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py
index e88164f..149fe3e 100644
--- a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py
+++ b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py
@@ -20,4 +20,4 @@
 		frappe.local.material_consumption = cint(frappe.db.get_single_value('Manufacturing Settings',
 			'material_consumption'))
 
-	return frappe.local.material_consumption
\ No newline at end of file
+	return frappe.local.material_consumption
diff --git a/erpnext/manufacturing/doctype/operation/operation.js b/erpnext/manufacturing/doctype/operation/operation.js
index 102b678..2936e33 100644
--- a/erpnext/manufacturing/doctype/operation/operation.js
+++ b/erpnext/manufacturing/doctype/operation/operation.js
@@ -11,4 +11,4 @@
 			};
 		});
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/manufacturing/doctype/operation/test_operation.py b/erpnext/manufacturing/doctype/operation/test_operation.py
index 0067231..8e7e723 100644
--- a/erpnext/manufacturing/doctype/operation/test_operation.py
+++ b/erpnext/manufacturing/doctype/operation/test_operation.py
@@ -28,4 +28,4 @@
 
 		return doc
 	except frappe.DuplicateEntryError:
-		return frappe.get_doc("Operation", args.operation)
\ No newline at end of file
+		return frappe.get_doc("Operation", args.operation)
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py
index 8c27d6c..b4c6635 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py
@@ -297,7 +297,7 @@
 
 		if self.total_produced_qty > 0:
 			self.status = "In Process"
-			if self.total_produced_qty == self.total_planned_qty:
+			if self.total_produced_qty >= self.total_planned_qty:
 				self.status = "Completed"
 
 		if self.status != 'Completed':
@@ -346,6 +346,7 @@
 				"production_plan"       : self.name,
 				"production_plan_item"  : d.name,
 				"product_bundle_item"	: d.product_bundle_item,
+				"planned_start_date"    : d.planned_start_date,
 				"make_work_order_for_sub_assembly_items": d.get("make_work_order_for_sub_assembly_items", 0)
 			}
 
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan_dashboard.py b/erpnext/manufacturing/doctype/production_plan/production_plan_dashboard.py
index ca597f6..52a56af 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan_dashboard.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan_dashboard.py
@@ -14,4 +14,4 @@
 				'items': ['Purchase Order']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
index af8de8e..a5b9ff8 100644
--- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
@@ -5,7 +5,7 @@
 
 import frappe
 import unittest
-from frappe.utils import nowdate, now_datetime, flt
+from frappe.utils import nowdate, now_datetime, flt, add_to_date
 from erpnext.stock.doctype.item.test_item import create_item
 from erpnext.manufacturing.doctype.production_plan.production_plan import get_sales_orders
 from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import create_stock_reconciliation
@@ -61,6 +61,21 @@
 		pln = frappe.get_doc('Production Plan', pln.name)
 		pln.cancel()
 
+	def test_production_plan_start_date(self):
+		planned_date = add_to_date(date=None, days=3)
+		plan = create_production_plan(item_code='Test Production Item 1', planned_start_date=planned_date)
+		plan.make_work_order()
+
+		work_orders = frappe.get_all('Work Order', fields = ['name', 'planned_start_date'],
+			filters = {'production_plan': plan.name})
+
+		self.assertEqual(work_orders[0].planned_start_date, planned_date)
+
+		for wo in work_orders:
+			frappe.delete_doc('Work Order', wo.name)
+
+		frappe.get_doc('Production Plan', plan.name).cancel()
+
 	def test_production_plan_for_existing_ordered_qty(self):
 		sr1 = create_stock_reconciliation(item_code="Raw Material Item 1",
 			target="_Test Warehouse - _TC", qty=1, rate=110)
diff --git a/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.py b/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.py
index 8b57042..37cf5a4 100644
--- a/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.py
+++ b/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class ProductionPlanItem(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.py b/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.py
index ef7f79e..99c7273 100644
--- a/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.py
+++ b/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class ProductionPlanSalesOrder(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/manufacturing/doctype/routing/routing_dashboard.py b/erpnext/manufacturing/doctype/routing/routing_dashboard.py
index ab309cc..50a3fe6 100644
--- a/erpnext/manufacturing/doctype/routing/routing_dashboard.py
+++ b/erpnext/manufacturing/doctype/routing/routing_dashboard.py
@@ -9,4 +9,4 @@
 				'items': ['BOM']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py
index 1cdbc5f..24b33d5 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order.py
@@ -619,7 +619,7 @@
 
 		if self.docstatus==1:
 			# calculate transferred qty based on submitted stock entries
-			self.update_transaferred_qty_for_required_items()
+			self.update_transferred_qty_for_required_items()
 
 			# update in bin
 			self.update_reserved_qty_for_production()
@@ -688,7 +688,7 @@
 
 			self.set_available_qty()
 
-	def update_transaferred_qty_for_required_items(self):
+	def update_transferred_qty_for_required_items(self):
 		'''update transferred qty from submitted stock entries for that item against
 			the work order'''
 
@@ -855,7 +855,7 @@
 
 	for item in variant_items:
 		args = frappe._dict({
-			"item_code": item.get("varint_item_code"),
+			"item_code": item.get("variant_item_code"),
 			"required_qty": item.get("qty"),
 			"qty": item.get("qty"), # for bom
 			"source_warehouse": item.get("source_warehouse"),
@@ -876,7 +876,7 @@
 		}, bom_doc)
 
 		if not args.source_warehouse:
-			args["source_warehouse"] = get_item_defaults(item.get("varint_item_code"),
+			args["source_warehouse"] = get_item_defaults(item.get("variant_item_code"),
 				wo_doc.company).default_warehouse
 
 		args["amount"] = flt(args.get("required_qty")) * flt(args.get("rate"))
diff --git a/erpnext/manufacturing/doctype/work_order/work_order_dashboard.py b/erpnext/manufacturing/doctype/work_order/work_order_dashboard.py
index 9aa0715..403d46d 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order_dashboard.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order_dashboard.py
@@ -17,4 +17,4 @@
 				'items': ['Serial No', 'Batch']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/manufacturing/doctype/work_order/work_order_preview.html b/erpnext/manufacturing/doctype/work_order/work_order_preview.html
index a4bf93e..95bdd29 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order_preview.html
+++ b/erpnext/manufacturing/doctype/work_order/work_order_preview.html
@@ -30,4 +30,4 @@
 			</p>
 		</div>
 	</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/manufacturing/doctype/work_order_item/work_order_item.py b/erpnext/manufacturing/doctype/work_order_item/work_order_item.py
index d18f028..9aa53b5 100644
--- a/erpnext/manufacturing/doctype/work_order_item/work_order_item.py
+++ b/erpnext/manufacturing/doctype/work_order_item/work_order_item.py
@@ -10,4 +10,4 @@
 	pass
 
 def on_doctype_update():
-	frappe.db.add_index("Work Order Item", ["item_code", "source_warehouse"])
\ No newline at end of file
+	frappe.db.add_index("Work Order Item", ["item_code", "source_warehouse"])
diff --git a/erpnext/manufacturing/doctype/workstation/workstation.js b/erpnext/manufacturing/doctype/workstation/workstation.js
index ba8e30c..d8d25fc 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation.js
+++ b/erpnext/manufacturing/doctype/workstation/workstation.js
@@ -16,4 +16,4 @@
 			})
 		}
 	}
-})
\ No newline at end of file
+})
diff --git a/erpnext/manufacturing/report/bom_operations_time/bom_operations_time.py b/erpnext/manufacturing/report/bom_operations_time/bom_operations_time.py
index e7d9265..8778d9b 100644
--- a/erpnext/manufacturing/report/bom_operations_time/bom_operations_time.py
+++ b/erpnext/manufacturing/report/bom_operations_time/bom_operations_time.py
@@ -108,5 +108,3 @@
 		"fieldtype": "Int",
 		"width": 180
 	}]
-
-
diff --git a/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.html b/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.html
index 119a4fc..2ae8848 100644
--- a/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.html
+++ b/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.html
@@ -24,4 +24,4 @@
         </tr>
         {% } %}
 	</tbody>
-</table>
\ No newline at end of file
+</table>
diff --git a/erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py b/erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py
index 9f81e7d..b4db98c 100644
--- a/erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py
+++ b/erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py
@@ -124,4 +124,4 @@
 			"fieldname": "total_time_in_mins",
 			"width": "100"
 		}
-	]
\ No newline at end of file
+	]
diff --git a/erpnext/manufacturing/report/downtime_analysis/downtime_analysis.py b/erpnext/manufacturing/report/downtime_analysis/downtime_analysis.py
index 093309a..74c794b 100644
--- a/erpnext/manufacturing/report/downtime_analysis/downtime_analysis.py
+++ b/erpnext/manufacturing/report/downtime_analysis/downtime_analysis.py
@@ -110,4 +110,4 @@
 			"fieldtype": "Text",
 			"width": 100
 		}
-	]
\ No newline at end of file
+	]
diff --git a/erpnext/manufacturing/report/exponential_smoothing_forecasting/exponential_smoothing_forecasting.py b/erpnext/manufacturing/report/exponential_smoothing_forecasting/exponential_smoothing_forecasting.py
index fc27d35..9a6c764 100644
--- a/erpnext/manufacturing/report/exponential_smoothing_forecasting/exponential_smoothing_forecasting.py
+++ b/erpnext/manufacturing/report/exponential_smoothing_forecasting/exponential_smoothing_forecasting.py
@@ -239,4 +239,4 @@
 				"currency": self.company_currency,
 				"datatype": self.fieldtype
 			}
-		]
\ No newline at end of file
+		]
diff --git a/erpnext/manufacturing/report/job_card_summary/job_card_summary.py b/erpnext/manufacturing/report/job_card_summary/job_card_summary.py
index b1bff35..a893905 100644
--- a/erpnext/manufacturing/report/job_card_summary/job_card_summary.py
+++ b/erpnext/manufacturing/report/job_card_summary/job_card_summary.py
@@ -201,4 +201,4 @@
 		}
 	])
 
-	return columns
\ No newline at end of file
+	return columns
diff --git a/erpnext/manufacturing/report/production_analytics/production_analytics.py b/erpnext/manufacturing/report/production_analytics/production_analytics.py
index 79af8a1..42c9d97 100644
--- a/erpnext/manufacturing/report/production_analytics/production_analytics.py
+++ b/erpnext/manufacturing/report/production_analytics/production_analytics.py
@@ -139,7 +139,3 @@
 	chart["type"] = "line"
 
 	return chart
-
-
-
-
diff --git a/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py b/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py
index 6192632..a12ac7f 100644
--- a/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py
+++ b/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py
@@ -129,4 +129,4 @@
 		}
 	])
 
-	return columns
\ No newline at end of file
+	return columns
diff --git a/erpnext/manufacturing/report/work_order_stock_report/work_order_stock_report.py b/erpnext/manufacturing/report/work_order_stock_report/work_order_stock_report.py
index 97553e6..599a738 100644
--- a/erpnext/manufacturing/report/work_order_stock_report/work_order_stock_report.py
+++ b/erpnext/manufacturing/report/work_order_stock_report/work_order_stock_report.py
@@ -10,10 +10,10 @@
 	data = get_item_list(wo_list, filters)
 	columns = get_columns()
 	return columns, data
-	
+
 def get_item_list(wo_list, filters):
 	out = []
-	
+
 	#Add a row for each item/qty
 	for wo_details in wo_list:
 		desc = frappe.db.get_value("BOM", wo_details.bom_no, "description")
@@ -70,13 +70,13 @@
 			out.append(row)
 
 	return out
-	
+
 def get_work_orders():
 	out =  frappe.get_all("Work Order", filters={"docstatus": 1, "status": ( "!=","Completed")},
 		fields=["name","status", "bom_no", "qty", "produced_qty"], order_by='name')
 
 	return out
-	
+
 def get_columns():
 	columns = [{
 		"fieldname": "work_order",
diff --git a/erpnext/manufacturing/report/work_order_summary/work_order_summary.py b/erpnext/manufacturing/report/work_order_summary/work_order_summary.py
index 612dad0..d0766f9 100644
--- a/erpnext/manufacturing/report/work_order_summary/work_order_summary.py
+++ b/erpnext/manufacturing/report/work_order_summary/work_order_summary.py
@@ -265,4 +265,4 @@
 			},
 		])
 
-	return columns
\ No newline at end of file
+	return columns
diff --git a/erpnext/non_profit/doctype/chapter_member/chapter_member.py b/erpnext/non_profit/doctype/chapter_member/chapter_member.py
index c4b8999..a1b25f2 100644
--- a/erpnext/non_profit/doctype/chapter_member/chapter_member.py
+++ b/erpnext/non_profit/doctype/chapter_member/chapter_member.py
@@ -7,5 +7,3 @@
 
 class ChapterMember(Document):
 	pass
-
-
diff --git a/erpnext/non_profit/doctype/donation/donation.py b/erpnext/non_profit/doctype/donation/donation.py
index 4fd1a30..9aa7e13 100644
--- a/erpnext/non_profit/doctype/donation/donation.py
+++ b/erpnext/non_profit/doctype/donation/donation.py
@@ -217,4 +217,3 @@
 		sendmail_to_system_managers(_('[Important] [ERPNext] Razorpay donation webhook failed, please check.'), content)
 	except Exception:
 		pass
-
diff --git a/erpnext/non_profit/doctype/donation/donation_dashboard.py b/erpnext/non_profit/doctype/donation/donation_dashboard.py
index 7e25c8d..3da8942 100644
--- a/erpnext/non_profit/doctype/donation/donation_dashboard.py
+++ b/erpnext/non_profit/doctype/donation/donation_dashboard.py
@@ -13,4 +13,4 @@
 				'items': ['Payment Entry']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/non_profit/doctype/donation/test_donation.py b/erpnext/non_profit/doctype/donation/test_donation.py
index bbe9bf5..b206f54 100644
--- a/erpnext/non_profit/doctype/donation/test_donation.py
+++ b/erpnext/non_profit/doctype/donation/test_donation.py
@@ -73,4 +73,4 @@
 				'company': '_Test Company',
 				'default_account': 'Cash - _TC'
 			}]
-		}).insert()
\ No newline at end of file
+		}).insert()
diff --git a/erpnext/non_profit/doctype/donor/donor.py b/erpnext/non_profit/doctype/donor/donor.py
index fb70e59..ab6a197 100644
--- a/erpnext/non_profit/doctype/donor/donor.py
+++ b/erpnext/non_profit/doctype/donor/donor.py
@@ -15,4 +15,3 @@
 		from frappe.utils import validate_email_address
 		if self.email:
 			validate_email_address(self.email.strip(), True)
-
diff --git a/erpnext/non_profit/doctype/grant_application/grant_application.py b/erpnext/non_profit/doctype/grant_application/grant_application.py
index f0123b2..b810fd0 100644
--- a/erpnext/non_profit/doctype/grant_application/grant_application.py
+++ b/erpnext/non_profit/doctype/grant_application/grant_application.py
@@ -55,4 +55,4 @@
 	grant.save()
 	frappe.db.commit()
 
-	frappe.msgprint(_("Review Invitation Sent"))
\ No newline at end of file
+	frappe.msgprint(_("Review Invitation Sent"))
diff --git a/erpnext/non_profit/doctype/member/member.js b/erpnext/non_profit/doctype/member/member.js
index 6b8f1b1..e58ec0f 100644
--- a/erpnext/non_profit/doctype/member/member.js
+++ b/erpnext/non_profit/doctype/member/member.js
@@ -61,4 +61,4 @@
 			}
 		});
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/non_profit/doctype/membership/test_membership.py b/erpnext/non_profit/doctype/membership/test_membership.py
index 0f5a9be..5ad2088 100644
--- a/erpnext/non_profit/doctype/membership/test_membership.py
+++ b/erpnext/non_profit/doctype/membership/test_membership.py
@@ -159,4 +159,4 @@
 				}
 			}
 		}
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/non_profit/doctype/membership_type/membership_type.py b/erpnext/non_profit/doctype/membership_type/membership_type.py
index 022829b..c712b99 100644
--- a/erpnext/non_profit/doctype/membership_type/membership_type.py
+++ b/erpnext/non_profit/doctype/membership_type/membership_type.py
@@ -15,4 +15,4 @@
 				frappe.throw(_("The Linked Item should be a service item"))
 
 def get_membership_type(razorpay_id):
-	return frappe.db.exists("Membership Type", {"razorpay_plan_id": razorpay_id})
\ No newline at end of file
+	return frappe.db.exists("Membership Type", {"razorpay_plan_id": razorpay_id})
diff --git a/erpnext/non_profit/doctype/non_profit_settings/non_profit_settings.py b/erpnext/non_profit/doctype/non_profit_settings/non_profit_settings.py
index a84cc2c..50c9351 100644
--- a/erpnext/non_profit/doctype/non_profit_settings/non_profit_settings.py
+++ b/erpnext/non_profit/doctype/non_profit_settings/non_profit_settings.py
@@ -35,4 +35,4 @@
 def get_plans_for_membership(*args, **kwargs):
 	controller = get_payment_gateway_controller("Razorpay")
 	plans = controller.get_plans()
-	return [plan.get("item") for plan in plans.get("items")]
\ No newline at end of file
+	return [plan.get("item") for plan in plans.get("items")]
diff --git a/erpnext/non_profit/web_form/grant_application/grant_application.js b/erpnext/non_profit/web_form/grant_application/grant_application.js
index 7da3f1f..f09e540 100644
--- a/erpnext/non_profit/web_form/grant_application/grant_application.js
+++ b/erpnext/non_profit/web_form/grant_application/grant_application.js
@@ -1,3 +1,3 @@
 frappe.ready(function() {
 	// bind events here
-});
\ No newline at end of file
+});
diff --git a/erpnext/non_profit/web_form/grant_application/grant_application.py b/erpnext/non_profit/web_form/grant_application/grant_application.py
index 7666ef6..186722a 100644
--- a/erpnext/non_profit/web_form/grant_application/grant_application.py
+++ b/erpnext/non_profit/web_form/grant_application/grant_application.py
@@ -4,5 +4,3 @@
 	context.no_cache = True
 	context.parents = [dict(label='View All ',
 		route='grant-application', title='View All')]
-
-
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 776b41d..b86c236 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -214,7 +214,6 @@
 execute:frappe.delete_doc_if_exists("DocType", "Bank Reconciliation")
 erpnext.patches.v13_0.move_doctype_reports_and_notification_from_hr_to_payroll #22-06-2020
 erpnext.patches.v13_0.move_payroll_setting_separately_from_hr_settings #22-06-2020
-execute:frappe.reload_doc("regional", "doctype", "e_invoice_settings")
 erpnext.patches.v13_0.check_is_income_tax_component #22-06-2020
 erpnext.patches.v13_0.loyalty_points_entry_for_pos_invoice #22-07-2020
 erpnext.patches.v12_0.add_taxjar_integration_field
@@ -237,7 +236,6 @@
 erpnext.patches.v13_0.print_uom_after_quantity_patch
 erpnext.patches.v13_0.set_payment_channel_in_payment_gateway_account
 erpnext.patches.v13_0.create_healthcare_custom_fields_in_stock_entry_detail
-erpnext.patches.v12_0.setup_einvoice_fields #2020-12-02
 erpnext.patches.v13_0.updates_for_multi_currency_payroll
 erpnext.patches.v13_0.update_reason_for_resignation_in_employee
 execute:frappe.delete_doc("Report", "Quoted Item Comparison")
@@ -259,14 +257,11 @@
 erpnext.patches.v13_0.item_reposting_for_incorrect_sl_and_gl
 erpnext.patches.v13_0.delete_old_bank_reconciliation_doctypes
 erpnext.patches.v12_0.update_vehicle_no_reqd_condition
-erpnext.patches.v12_0.add_einvoice_status_field #2021-03-17
-erpnext.patches.v12_0.add_einvoice_summary_report_permissions
 erpnext.patches.v13_0.setup_fields_for_80g_certificate_and_donation
 erpnext.patches.v13_0.rename_membership_settings_to_non_profit_settings
 erpnext.patches.v13_0.setup_gratuity_rule_for_india_and_uae
 erpnext.patches.v13_0.setup_uae_vat_fields
 execute:frappe.db.set_value('System Settings', None, 'app_name', 'ERPNext')
-erpnext.patches.v12_0.add_company_link_to_einvoice_settings
 erpnext.patches.v13_0.rename_discharge_date_in_ip_record
 erpnext.patches.v12_0.create_taxable_value_field
 erpnext.patches.v12_0.add_gst_category_in_delivery_note
@@ -277,7 +272,6 @@
 erpnext.patches.v13_0.make_non_standard_user_type #13-04-2021
 erpnext.patches.v13_0.update_shipment_status
 erpnext.patches.v13_0.remove_attribute_field_from_item_variant_setting
-erpnext.patches.v12_0.add_ewaybill_validity_field
 erpnext.patches.v13_0.germany_make_custom_fields
 erpnext.patches.v13_0.germany_fill_debtor_creditor_number
 erpnext.patches.v13_0.set_pos_closing_as_failed
@@ -294,10 +288,11 @@
 erpnext.patches.v13_0.add_missing_fg_item_for_stock_entry
 erpnext.patches.v13_0.update_subscription_status_in_memberships
 erpnext.patches.v13_0.update_amt_in_work_order_required_items
-erpnext.patches.v12_0.show_einvoice_irn_cancelled_field
 erpnext.patches.v13_0.delete_orphaned_tables
 erpnext.patches.v13_0.update_export_type_for_gst #2021-08-16
 erpnext.patches.v13_0.update_tds_check_field #3
 erpnext.patches.v13_0.add_custom_field_for_south_africa #2
 erpnext.patches.v13_0.update_recipient_email_digest
 erpnext.patches.v13_0.shopify_deprecation_warning
+erpnext.patches.v13_0.einvoicing_deprecation_warning
+erpnext.patches.v14_0.delete_einvoicing_doctypes
diff --git a/erpnext/patches/v10_0/migrate_daily_work_summary_settings_to_daily_work_summary_group.py b/erpnext/patches/v10_0/migrate_daily_work_summary_settings_to_daily_work_summary_group.py
index 102b6da..daa258e 100644
--- a/erpnext/patches/v10_0/migrate_daily_work_summary_settings_to_daily_work_summary_group.py
+++ b/erpnext/patches/v10_0/migrate_daily_work_summary_settings_to_daily_work_summary_group.py
@@ -48,4 +48,4 @@
 	return obj
 
 def get_setting_companies():
-	return frappe.db.sql("select * from `tabDaily Work Summary Settings Company`", as_dict=True)
\ No newline at end of file
+	return frappe.db.sql("select * from `tabDaily Work Summary Settings Company`", as_dict=True)
diff --git a/erpnext/patches/v10_0/rename_offer_letter_to_job_offer.py b/erpnext/patches/v10_0/rename_offer_letter_to_job_offer.py
index 2e30951..f832936 100644
--- a/erpnext/patches/v10_0/rename_offer_letter_to_job_offer.py
+++ b/erpnext/patches/v10_0/rename_offer_letter_to_job_offer.py
@@ -7,4 +7,4 @@
 		frappe.rename_doc("DocType", "Offer Letter Term", "Job Offer Term", force=True)
 		frappe.reload_doc("hr", "doctype", "job_offer")
 		frappe.reload_doc("hr", "doctype", "job_offer_term")
-		frappe.delete_doc("Print Format", "Offer Letter")
\ No newline at end of file
+		frappe.delete_doc("Print Format", "Offer Letter")
diff --git a/erpnext/patches/v10_0/rename_price_to_rate_in_pricing_rule.py b/erpnext/patches/v10_0/rename_price_to_rate_in_pricing_rule.py
index 48fa222..a9dd310 100644
--- a/erpnext/patches/v10_0/rename_price_to_rate_in_pricing_rule.py
+++ b/erpnext/patches/v10_0/rename_price_to_rate_in_pricing_rule.py
@@ -11,4 +11,4 @@
 
 	except Exception as e:
 		if e.args[0]!=1054:
-			raise
\ No newline at end of file
+			raise
diff --git a/erpnext/patches/v11_0/add_default_email_template_for_leave.py b/erpnext/patches/v11_0/add_default_email_template_for_leave.py
index f722be2..0f1e496 100644
--- a/erpnext/patches/v11_0/add_default_email_template_for_leave.py
+++ b/erpnext/patches/v11_0/add_default_email_template_for_leave.py
@@ -27,4 +27,3 @@
 			'subject': _("Leave Status Notification"),
 			'owner': frappe.session.user,
 		}).insert(ignore_permissions=True)
-
diff --git a/erpnext/patches/v11_0/add_expense_claim_default_account.py b/erpnext/patches/v11_0/add_expense_claim_default_account.py
index eecf755..a613bd8 100644
--- a/erpnext/patches/v11_0/add_expense_claim_default_account.py
+++ b/erpnext/patches/v11_0/add_expense_claim_default_account.py
@@ -8,4 +8,4 @@
 
 	for company in companies:
 		if company.default_payable_account is not None:
-			frappe.db.set_value("Company", company.name, "default_expense_claim_payable_account", company.default_payable_account)
\ No newline at end of file
+			frappe.db.set_value("Company", company.name, "default_expense_claim_payable_account", company.default_payable_account)
diff --git a/erpnext/patches/v11_0/add_healthcare_service_unit_tree_root.py b/erpnext/patches/v11_0/add_healthcare_service_unit_tree_root.py
index d956052..a45f39d 100644
--- a/erpnext/patches/v11_0/add_healthcare_service_unit_tree_root.py
+++ b/erpnext/patches/v11_0/add_healthcare_service_unit_tree_root.py
@@ -18,4 +18,3 @@
 			'is_group': 1,
 			'company': company
 		}).insert(ignore_permissions=True)
-
diff --git a/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py b/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py
index 5a30c78..0243dfb 100644
--- a/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py
+++ b/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py
@@ -8,4 +8,4 @@
 	frappe.reload_doc("assets", "doctype", "Location")
 	for dt in ("Account", "Cost Center", "File", "Employee", "Location", "Task", "Customer Group", "Sales Person", "Territory"):
 		frappe.reload_doctype(dt)
-		frappe.get_doc("DocType", dt).run_module_method("on_doctype_update")
\ No newline at end of file
+		frappe.get_doc("DocType", dt).run_module_method("on_doctype_update")
diff --git a/erpnext/patches/v11_0/add_market_segments.py b/erpnext/patches/v11_0/add_market_segments.py
index ed47d42..a8841ef 100644
--- a/erpnext/patches/v11_0/add_market_segments.py
+++ b/erpnext/patches/v11_0/add_market_segments.py
@@ -9,4 +9,4 @@
 
 	frappe.local.lang = frappe.db.get_default("lang") or 'en'
 
-	add_market_segments()
\ No newline at end of file
+	add_market_segments()
diff --git a/erpnext/patches/v11_0/add_sales_stages.py b/erpnext/patches/v11_0/add_sales_stages.py
index ac2ae15..d06c688 100644
--- a/erpnext/patches/v11_0/add_sales_stages.py
+++ b/erpnext/patches/v11_0/add_sales_stages.py
@@ -8,4 +8,4 @@
 
 	frappe.local.lang = frappe.db.get_default("lang") or 'en'
 
-	add_sale_stages()
\ No newline at end of file
+	add_sale_stages()
diff --git a/erpnext/patches/v11_0/check_buying_selling_in_currency_exchange.py b/erpnext/patches/v11_0/check_buying_selling_in_currency_exchange.py
index 462f830..0a1a360 100644
--- a/erpnext/patches/v11_0/check_buying_selling_in_currency_exchange.py
+++ b/erpnext/patches/v11_0/check_buying_selling_in_currency_exchange.py
@@ -3,4 +3,4 @@
 
 def execute():
 	frappe.reload_doc('setup', 'doctype', 'currency_exchange')
-	frappe.db.sql("""update `tabCurrency Exchange` set for_buying = 1, for_selling = 1""")
\ No newline at end of file
+	frappe.db.sql("""update `tabCurrency Exchange` set for_buying = 1, for_selling = 1""")
diff --git a/erpnext/patches/v11_0/create_salary_structure_assignments.py b/erpnext/patches/v11_0/create_salary_structure_assignments.py
index a908c16..d3ea7a3 100644
--- a/erpnext/patches/v11_0/create_salary_structure_assignments.py
+++ b/erpnext/patches/v11_0/create_salary_structure_assignments.py
@@ -69,4 +69,4 @@
 		except DuplicateAssignment:
 			pass
 
-	frappe.db.sql("update `tabSalary Structure` set docstatus=1")
\ No newline at end of file
+	frappe.db.sql("update `tabSalary Structure` set docstatus=1")
diff --git a/erpnext/patches/v11_0/drop_column_max_days_allowed.py b/erpnext/patches/v11_0/drop_column_max_days_allowed.py
index 591c521..029f75a 100644
--- a/erpnext/patches/v11_0/drop_column_max_days_allowed.py
+++ b/erpnext/patches/v11_0/drop_column_max_days_allowed.py
@@ -4,4 +4,4 @@
 def execute():
 	if frappe.db.exists("DocType", "Leave Type"):
 		if 'max_days_allowed' in frappe.db.get_table_columns("Leave Type"):
-			frappe.db.sql("alter table `tabLeave Type` drop column max_days_allowed")
\ No newline at end of file
+			frappe.db.sql("alter table `tabLeave Type` drop column max_days_allowed")
diff --git a/erpnext/patches/v11_0/ewaybill_fields_gst_india.py b/erpnext/patches/v11_0/ewaybill_fields_gst_india.py
index 9925b70..4247c78 100644
--- a/erpnext/patches/v11_0/ewaybill_fields_gst_india.py
+++ b/erpnext/patches/v11_0/ewaybill_fields_gst_india.py
@@ -7,4 +7,4 @@
     if not company:
         return
 
-    make_custom_fields()
\ No newline at end of file
+    make_custom_fields()
diff --git a/erpnext/patches/v11_0/hr_ux_cleanups.py b/erpnext/patches/v11_0/hr_ux_cleanups.py
index 80476c8..8d18796 100644
--- a/erpnext/patches/v11_0/hr_ux_cleanups.py
+++ b/erpnext/patches/v11_0/hr_ux_cleanups.py
@@ -10,4 +10,3 @@
 	for holiday_list in frappe.get_all('Holiday List'):
 		holiday_list = frappe.get_doc('Holiday List', holiday_list.name)
 		holiday_list.db_set('total_holidays', len(holiday_list.holidays), update_modified = False)
-
diff --git a/erpnext/patches/v11_0/make_asset_finance_book_against_old_entries.py b/erpnext/patches/v11_0/make_asset_finance_book_against_old_entries.py
index ee709ac..dfcf5ab 100644
--- a/erpnext/patches/v11_0/make_asset_finance_book_against_old_entries.py
+++ b/erpnext/patches/v11_0/make_asset_finance_book_against_old_entries.py
@@ -42,4 +42,4 @@
 				'frequency_of_depreciation': asset_category_doc.frequency_of_depreciation
 			})
 
-			row.db_update()
\ No newline at end of file
+			row.db_update()
diff --git a/erpnext/patches/v11_0/make_location_from_warehouse.py b/erpnext/patches/v11_0/make_location_from_warehouse.py
index a307e8c..8c92b51 100644
--- a/erpnext/patches/v11_0/make_location_from_warehouse.py
+++ b/erpnext/patches/v11_0/make_location_from_warehouse.py
@@ -28,4 +28,3 @@
 
 def get_parent_warehouse_name(warehouse):
 	return frappe.db.get_value('Warehouse', warehouse, 'warehouse_name')
-			
\ No newline at end of file
diff --git a/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py b/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py
index c7c7635..6da70b4 100644
--- a/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py
+++ b/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py
@@ -93,4 +93,4 @@
 					`expense_account`, `income_account`, `buying_cost_center`, `selling_cost_center`
 				)
 				VALUES {}
-			'''.format(', '.join(['%s'] * len(to_insert_data))), tuple(to_insert_data))
\ No newline at end of file
+			'''.format(', '.join(['%s'] * len(to_insert_data))), tuple(to_insert_data))
diff --git a/erpnext/patches/v11_0/move_leave_approvers_from_employee.py b/erpnext/patches/v11_0/move_leave_approvers_from_employee.py
index edab34c..ef703d0 100644
--- a/erpnext/patches/v11_0/move_leave_approvers_from_employee.py
+++ b/erpnext/patches/v11_0/move_leave_approvers_from_employee.py
@@ -31,4 +31,4 @@
 			if not len(department.leave_approvers):
 				department.append("leave_approvers",{
 					"approver": record.leave_approver
-				}).db_insert()
\ No newline at end of file
+				}).db_insert()
diff --git a/erpnext/patches/v11_0/refactor_autoname_naming.py b/erpnext/patches/v11_0/refactor_autoname_naming.py
index b997ba2..dd5cb63 100644
--- a/erpnext/patches/v11_0/refactor_autoname_naming.py
+++ b/erpnext/patches/v11_0/refactor_autoname_naming.py
@@ -117,4 +117,4 @@
 
 def get_series_to_preserve(doctype):
 	series_to_preserve = frappe.db.get_value('DocType', doctype, 'autoname')
-	return series_to_preserve
\ No newline at end of file
+	return series_to_preserve
diff --git a/erpnext/patches/v11_0/refactor_naming_series.py b/erpnext/patches/v11_0/refactor_naming_series.py
index b85ab66..9f231ed 100644
--- a/erpnext/patches/v11_0/refactor_naming_series.py
+++ b/erpnext/patches/v11_0/refactor_naming_series.py
@@ -132,4 +132,4 @@
 def get_default_series(doctype):
 	field = frappe.get_meta(doctype).get_field("naming_series")
 	default_series = field.get('default', '') if field else ''
-	return default_series
\ No newline at end of file
+	return default_series
diff --git a/erpnext/patches/v11_0/rename_asset_adjustment_doctype.py b/erpnext/patches/v11_0/rename_asset_adjustment_doctype.py
index fad0cf7..923b230 100644
--- a/erpnext/patches/v11_0/rename_asset_adjustment_doctype.py
+++ b/erpnext/patches/v11_0/rename_asset_adjustment_doctype.py
@@ -8,4 +8,4 @@
 def execute():
 	if frappe.db.table_exists("Asset Adjustment") and not frappe.db.table_exists("Asset Value Adjustment"):
 		frappe.rename_doc('DocType', 'Asset Adjustment', 'Asset Value Adjustment', force=True)
-		frappe.reload_doc('assets', 'doctype', 'asset_value_adjustment')
\ No newline at end of file
+		frappe.reload_doc('assets', 'doctype', 'asset_value_adjustment')
diff --git a/erpnext/patches/v11_0/rename_bom_wo_fields.py b/erpnext/patches/v11_0/rename_bom_wo_fields.py
index 882ec84..0e6036b 100644
--- a/erpnext/patches/v11_0/rename_bom_wo_fields.py
+++ b/erpnext/patches/v11_0/rename_bom_wo_fields.py
@@ -30,4 +30,4 @@
         else:
             frappe.db.sql(""" UPDATE `tab%s`
                 SET transfer_material_against = 'Work Order'
-                WHERE docstatus < 2""" % (doctype))
\ No newline at end of file
+                WHERE docstatus < 2""" % (doctype))
diff --git a/erpnext/patches/v11_0/rename_health_insurance.py b/erpnext/patches/v11_0/rename_health_insurance.py
index e605071..06fc615 100644
--- a/erpnext/patches/v11_0/rename_health_insurance.py
+++ b/erpnext/patches/v11_0/rename_health_insurance.py
@@ -6,4 +6,4 @@
 
 def execute():
 	frappe.rename_doc('DocType', 'Health Insurance', 'Employee Health Insurance', force=True)
-	frappe.reload_doc('hr', 'doctype', 'employee_health_insurance')
\ No newline at end of file
+	frappe.reload_doc('hr', 'doctype', 'employee_health_insurance')
diff --git a/erpnext/patches/v11_0/rename_overproduction_percent_field.py b/erpnext/patches/v11_0/rename_overproduction_percent_field.py
index 077829f..fbf925d 100644
--- a/erpnext/patches/v11_0/rename_overproduction_percent_field.py
+++ b/erpnext/patches/v11_0/rename_overproduction_percent_field.py
@@ -7,4 +7,4 @@
 
 def execute():
 	frappe.reload_doc('manufacturing', 'doctype', 'manufacturing_settings')
-	rename_field('Manufacturing Settings', 'over_production_allowance_percentage', 'overproduction_percentage_for_sales_order')
\ No newline at end of file
+	rename_field('Manufacturing Settings', 'over_production_allowance_percentage', 'overproduction_percentage_for_sales_order')
diff --git a/erpnext/patches/v11_0/renamed_from_to_fields_in_project.py b/erpnext/patches/v11_0/renamed_from_to_fields_in_project.py
index 4f68440..d5ca4cc 100644
--- a/erpnext/patches/v11_0/renamed_from_to_fields_in_project.py
+++ b/erpnext/patches/v11_0/renamed_from_to_fields_in_project.py
@@ -10,4 +10,4 @@
 
     if frappe.db.has_column('Project', 'from'):
         rename_field('Project', 'from', 'from_time')
-        rename_field('Project', 'to', 'to_time')
\ No newline at end of file
+        rename_field('Project', 'to', 'to_time')
diff --git a/erpnext/patches/v11_0/set_missing_gst_hsn_code.py b/erpnext/patches/v11_0/set_missing_gst_hsn_code.py
index 4353ef8..8f8a545 100644
--- a/erpnext/patches/v11_0/set_missing_gst_hsn_code.py
+++ b/erpnext/patches/v11_0/set_missing_gst_hsn_code.py
@@ -41,4 +41,4 @@
 		for t in list(parent):
 			trans_doc = frappe.get_doc(dt, t)
 			hsnwise_tax = get_itemised_tax_breakup_html(trans_doc)
-			frappe.db.set_value(dt, t, "other_charges_calculation", hsnwise_tax, update_modified=False)
\ No newline at end of file
+			frappe.db.set_value(dt, t, "other_charges_calculation", hsnwise_tax, update_modified=False)
diff --git a/erpnext/patches/v11_0/set_salary_component_properties.py b/erpnext/patches/v11_0/set_salary_component_properties.py
index 2498888..d8ce31f 100644
--- a/erpnext/patches/v11_0/set_salary_component_properties.py
+++ b/erpnext/patches/v11_0/set_salary_component_properties.py
@@ -13,4 +13,4 @@
 	frappe.db.sql("""update `tabSalary Detail` set is_tax_applicable=1
 	    where parentfield='earnings' and statistical_component=0""")
 	frappe.db.sql("""update `tabSalary Detail` set variable_based_on_taxable_salary=1
-	    where parentfield='deductions' and salary_component in ('TDS', 'Tax Deducted at Source')""")
\ No newline at end of file
+	    where parentfield='deductions' and salary_component in ('TDS', 'Tax Deducted at Source')""")
diff --git a/erpnext/patches/v11_0/set_user_permissions_for_department.py b/erpnext/patches/v11_0/set_user_permissions_for_department.py
index 7bd8577..2f90f14 100644
--- a/erpnext/patches/v11_0/set_user_permissions_for_department.py
+++ b/erpnext/patches/v11_0/set_user_permissions_for_department.py
@@ -6,7 +6,7 @@
         where allow='Department'""", as_dict=1)
     for d in user_permissions:
         user_permission = frappe.get_doc("User Permission", d.name)
-        for new_dept in frappe.db.sql("""select name from tabDepartment 
+        for new_dept in frappe.db.sql("""select name from tabDepartment
             where ifnull(company, '') != '' and department_name=%s""", d.for_value):
             try:
                 new_user_permission = frappe.copy_doc(user_permission)
@@ -16,4 +16,4 @@
                 pass
 
     frappe.reload_doc("hr", "doctype", "department")
-    frappe.db.sql("update tabDepartment set disabled=1 where ifnull(company, '') = ''")
\ No newline at end of file
+    frappe.db.sql("update tabDepartment set disabled=1 where ifnull(company, '') = ''")
diff --git a/erpnext/patches/v11_0/skip_user_permission_check_for_department.py b/erpnext/patches/v11_0/skip_user_permission_check_for_department.py
index 0f7fad7..4e72917 100644
--- a/erpnext/patches/v11_0/skip_user_permission_check_for_department.py
+++ b/erpnext/patches/v11_0/skip_user_permission_check_for_department.py
@@ -58,4 +58,4 @@
 	if user_permissions_to_delete:
 		frappe.db.sql('DELETE FROM `tabUser Permission` WHERE `name` IN ({})'.format( # nosec
 			','.join(['%s'] * len(user_permissions_to_delete))
-		), tuple(user_permissions_to_delete))
\ No newline at end of file
+		), tuple(user_permissions_to_delete))
diff --git a/erpnext/patches/v11_0/update_account_type_in_party_type.py b/erpnext/patches/v11_0/update_account_type_in_party_type.py
index efa04fd..dabaeff 100644
--- a/erpnext/patches/v11_0/update_account_type_in_party_type.py
+++ b/erpnext/patches/v11_0/update_account_type_in_party_type.py
@@ -10,4 +10,4 @@
 		'Employee': 'Payable', 'Member': 'Receivable', 'Shareholder': 'Payable', 'Student': 'Receivable'}
 
 	for party_type, account_type in party_types.items():
-		frappe.db.set_value('Party Type', party_type, 'account_type', account_type)
\ No newline at end of file
+		frappe.db.set_value('Party Type', party_type, 'account_type', account_type)
diff --git a/erpnext/patches/v11_0/update_allow_transfer_for_manufacture.py b/erpnext/patches/v11_0/update_allow_transfer_for_manufacture.py
index 1b58c97..799e91a 100644
--- a/erpnext/patches/v11_0/update_allow_transfer_for_manufacture.py
+++ b/erpnext/patches/v11_0/update_allow_transfer_for_manufacture.py
@@ -17,4 +17,4 @@
 				child.include_item_in_manufacturing = 1
 			where
 				child.item_code = item.name and ifnull(item.is_stock_item, 0) = 1
-		""".format(doctype))
\ No newline at end of file
+		""".format(doctype))
diff --git a/erpnext/patches/v11_0/update_backflush_subcontract_rm_based_on_bom.py b/erpnext/patches/v11_0/update_backflush_subcontract_rm_based_on_bom.py
index f2eeada..37a616c 100644
--- a/erpnext/patches/v11_0/update_backflush_subcontract_rm_based_on_bom.py
+++ b/erpnext/patches/v11_0/update_backflush_subcontract_rm_based_on_bom.py
@@ -16,4 +16,4 @@
 		where
 			se.purpose = 'Send to Subcontractor' and sed.parent = se.name
 			and pois.rm_item_code = sed.item_code and se.docstatus = 1
-			and pois.parenttype = 'Purchase Order'""")
\ No newline at end of file
+			and pois.parenttype = 'Purchase Order'""")
diff --git a/erpnext/patches/v11_0/update_brand_in_item_price.py b/erpnext/patches/v11_0/update_brand_in_item_price.py
index a8d3fab..977d84f 100644
--- a/erpnext/patches/v11_0/update_brand_in_item_price.py
+++ b/erpnext/patches/v11_0/update_brand_in_item_price.py
@@ -12,4 +12,4 @@
 			`tabItem Price`.brand = `tabItem`.brand
 		where
 			`tabItem Price`.item_code = `tabItem`.name
-			and `tabItem`.brand is not null and `tabItem`.brand != ''""")
\ No newline at end of file
+			and `tabItem`.brand is not null and `tabItem`.brand != ''""")
diff --git a/erpnext/patches/v11_0/update_department_lft_rgt.py b/erpnext/patches/v11_0/update_department_lft_rgt.py
index b2f407b..2b38203 100644
--- a/erpnext/patches/v11_0/update_department_lft_rgt.py
+++ b/erpnext/patches/v11_0/update_department_lft_rgt.py
@@ -17,4 +17,4 @@
 	frappe.db.sql("""update `tabDepartment` set parent_department = '{0}'
 		where is_group = 0""".format(_('All Departments')))
 
-	rebuild_tree("Department", "parent_department")
\ No newline at end of file
+	rebuild_tree("Department", "parent_department")
diff --git a/erpnext/patches/v11_1/delete_bom_browser.py b/erpnext/patches/v11_1/delete_bom_browser.py
index 457f511..2892674 100644
--- a/erpnext/patches/v11_1/delete_bom_browser.py
+++ b/erpnext/patches/v11_1/delete_bom_browser.py
@@ -5,4 +5,4 @@
 import frappe
 
 def execute():
-    frappe.delete_doc_if_exists('Page', 'bom-browser')
\ No newline at end of file
+    frappe.delete_doc_if_exists('Page', 'bom-browser')
diff --git a/erpnext/patches/v11_1/make_job_card_time_logs.py b/erpnext/patches/v11_1/make_job_card_time_logs.py
index 6e708df..b706e5c 100644
--- a/erpnext/patches/v11_1/make_job_card_time_logs.py
+++ b/erpnext/patches/v11_1/make_job_card_time_logs.py
@@ -26,4 +26,4 @@
 
         frappe.reload_doc('manufacturing', 'doctype', 'job_card')
         frappe.db.sql(""" update `tabJob Card` set total_completed_qty = for_quantity,
-            total_time_in_mins = time_in_mins where docstatus < 2 """)
\ No newline at end of file
+            total_time_in_mins = time_in_mins where docstatus < 2 """)
diff --git a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py
index 5b1251c..fc3ec74 100644
--- a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py
+++ b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py
@@ -11,4 +11,4 @@
 
 	frappe.reload_doctype("Opportunity")
 	frappe.db.sql(""" UPDATE `tabOpportunity` set party_name = lead WHERE opportunity_from = 'Lead' """)
-	frappe.db.sql(""" UPDATE `tabOpportunity` set party_name = customer WHERE opportunity_from = 'Customer' """)
\ No newline at end of file
+	frappe.db.sql(""" UPDATE `tabOpportunity` set party_name = customer WHERE opportunity_from = 'Customer' """)
diff --git a/erpnext/patches/v11_1/rename_depends_on_lwp.py b/erpnext/patches/v11_1/rename_depends_on_lwp.py
index a0f2536..4c4b14f 100644
--- a/erpnext/patches/v11_1/rename_depends_on_lwp.py
+++ b/erpnext/patches/v11_1/rename_depends_on_lwp.py
@@ -10,4 +10,4 @@
 	for doctype in ("Salary Component", "Salary Detail"):
 		if "depends_on_lwp" in frappe.db.get_table_columns(doctype):
 			frappe.reload_doc("Payroll", "doctype", scrub(doctype))
-			rename_field(doctype, "depends_on_lwp", "depends_on_payment_days")
\ No newline at end of file
+			rename_field(doctype, "depends_on_lwp", "depends_on_payment_days")
diff --git a/erpnext/patches/v11_1/renamed_delayed_item_report.py b/erpnext/patches/v11_1/renamed_delayed_item_report.py
index 222b9a0..8e8725c 100644
--- a/erpnext/patches/v11_1/renamed_delayed_item_report.py
+++ b/erpnext/patches/v11_1/renamed_delayed_item_report.py
@@ -7,4 +7,4 @@
 def execute():
     for report in ["Delayed Order Item Summary", "Delayed Order Summary"]:
         if frappe.db.exists("Report", report):
-            frappe.delete_doc("Report", report)
\ No newline at end of file
+            frappe.delete_doc("Report", report)
diff --git a/erpnext/patches/v11_1/set_status_for_material_request_type_manufacture.py b/erpnext/patches/v11_1/set_status_for_material_request_type_manufacture.py
index d41cff5..ec01fbb 100644
--- a/erpnext/patches/v11_1/set_status_for_material_request_type_manufacture.py
+++ b/erpnext/patches/v11_1/set_status_for_material_request_type_manufacture.py
@@ -6,4 +6,4 @@
 		update `tabMaterial Request`
 		set status='Manufactured'
 		where docstatus=1 and material_request_type='Manufacture' and per_ordered=100 and status != 'Stopped'
-	""")
\ No newline at end of file
+	""")
diff --git a/erpnext/patches/v11_1/set_variant_based_on.py b/erpnext/patches/v11_1/set_variant_based_on.py
index 019eefd..49a9a17 100644
--- a/erpnext/patches/v11_1/set_variant_based_on.py
+++ b/erpnext/patches/v11_1/set_variant_based_on.py
@@ -8,4 +8,4 @@
 	frappe.db.sql("""update tabItem set variant_based_on = 'Item Attribute'
 		where ifnull(variant_based_on, '') = ''
 		and (has_variants=1 or ifnull(variant_of, '') != '')
-	""")
\ No newline at end of file
+	""")
diff --git a/erpnext/patches/v11_1/update_bank_transaction_status.py b/erpnext/patches/v11_1/update_bank_transaction_status.py
index 544bc5e..354e636 100644
--- a/erpnext/patches/v11_1/update_bank_transaction_status.py
+++ b/erpnext/patches/v11_1/update_bank_transaction_status.py
@@ -23,4 +23,4 @@
             WHERE
                 status = 'Settled' and (deposit = allocated_amount or withdrawal = allocated_amount)
                 and ifnull(allocated_amount, 0) > 0
-        """)
\ No newline at end of file
+        """)
diff --git a/erpnext/patches/v11_1/update_default_supplier_in_item_defaults.py b/erpnext/patches/v11_1/update_default_supplier_in_item_defaults.py
index 347dec1..8c360ad 100644
--- a/erpnext/patches/v11_1/update_default_supplier_in_item_defaults.py
+++ b/erpnext/patches/v11_1/update_default_supplier_in_item_defaults.py
@@ -22,4 +22,4 @@
 			SET `tabItem Default`.default_supplier = `tabItem`.default_supplier
 			WHERE
 				`tabItem Default`.parent = `tabItem`.name and `tabItem Default`.default_supplier is null
-				and `tabItem`.default_supplier is not null and `tabItem`.default_supplier != '' """)
\ No newline at end of file
+				and `tabItem`.default_supplier is not null and `tabItem`.default_supplier != '' """)
diff --git a/erpnext/patches/v11_1/woocommerce_set_creation_user.py b/erpnext/patches/v11_1/woocommerce_set_creation_user.py
index 5ccdec6..074b904 100644
--- a/erpnext/patches/v11_1/woocommerce_set_creation_user.py
+++ b/erpnext/patches/v11_1/woocommerce_set_creation_user.py
@@ -8,4 +8,4 @@
 
 	if cint(doc.enable_sync):
 		doc.creation_user = doc.modified_by
-		doc.save(ignore_permissions=True)
\ No newline at end of file
+		doc.save(ignore_permissions=True)
diff --git a/erpnext/patches/v12_0/add_company_link_to_einvoice_settings.py b/erpnext/patches/v12_0/add_company_link_to_einvoice_settings.py
deleted file mode 100644
index b6bd5fa..0000000
--- a/erpnext/patches/v12_0/add_company_link_to_einvoice_settings.py
+++ /dev/null
@@ -1,16 +0,0 @@
-from __future__ import unicode_literals
-import frappe
-
-def execute():
-	company = frappe.get_all('Company', filters = {'country': 'India'})
-	if not company or not frappe.db.count('E Invoice User'):
-		return
-
-	frappe.reload_doc("regional", "doctype", "e_invoice_user")
-	for creds in frappe.db.get_all('E Invoice User', fields=['name', 'gstin']):
-		company_name = frappe.db.sql("""
-			select dl.link_name from `tabAddress` a, `tabDynamic Link` dl
-			where a.gstin = %s and dl.parent = a.name and dl.link_doctype = 'Company'
-		""", (creds.get('gstin')))
-		if company_name and len(company_name) > 0:
-			frappe.db.set_value('E Invoice User', creds.get('name'), 'company', company_name[0][0])
\ No newline at end of file
diff --git a/erpnext/patches/v12_0/add_default_buying_selling_terms_in_company.py b/erpnext/patches/v12_0/add_default_buying_selling_terms_in_company.py
index 484f81a..855d21d 100644
--- a/erpnext/patches/v12_0/add_default_buying_selling_terms_in_company.py
+++ b/erpnext/patches/v12_0/add_default_buying_selling_terms_in_company.py
@@ -14,6 +14,6 @@
 		for company in frappe.get_all("Company", ["name", "default_selling_terms", "default_buying_terms"]):
 			if company.default_selling_terms and not company.default_buying_terms:
 				frappe.db.set_value("Company", company.name, "default_buying_terms", company.default_selling_terms)
-	
+
 	frappe.reload_doc("setup", "doctype", "terms_and_conditions")
 	frappe.db.sql("update `tabTerms and Conditions` set selling=1, buying=1, hr=1")
diff --git a/erpnext/patches/v12_0/add_document_type_field_for_italy_einvoicing.py b/erpnext/patches/v12_0/add_document_type_field_for_italy_einvoicing.py
index 4d649dd..6fe578d 100644
--- a/erpnext/patches/v12_0/add_document_type_field_for_italy_einvoicing.py
+++ b/erpnext/patches/v12_0/add_document_type_field_for_italy_einvoicing.py
@@ -15,4 +15,4 @@
 		]
 	}
 
-	create_custom_fields(custom_fields, update=True)
\ No newline at end of file
+	create_custom_fields(custom_fields, update=True)
diff --git a/erpnext/patches/v12_0/add_einvoice_status_field.py b/erpnext/patches/v12_0/add_einvoice_status_field.py
deleted file mode 100644
index 387e885..0000000
--- a/erpnext/patches/v12_0/add_einvoice_status_field.py
+++ /dev/null
@@ -1,69 +0,0 @@
-from __future__ import unicode_literals
-import json
-import frappe
-from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
-
-def execute():
-	company = frappe.get_all('Company', filters = {'country': 'India'})
-	if not company:
-		return
-
-	# move hidden einvoice fields to a different section
-	custom_fields = {
-		'Sales Invoice': [
-			dict(fieldname='einvoice_section', label='E-Invoice Fields', fieldtype='Section Break', insert_after='gst_vehicle_type',
-			print_hide=1, hidden=1),
-		
-			dict(fieldname='ack_no', label='Ack. No.', fieldtype='Data', read_only=1, hidden=1, insert_after='einvoice_section',
-				no_copy=1, print_hide=1),
-			
-			dict(fieldname='ack_date', label='Ack. Date', fieldtype='Data', read_only=1, hidden=1, insert_after='ack_no', no_copy=1, print_hide=1),
-
-			dict(fieldname='irn_cancel_date', label='Cancel Date', fieldtype='Data', read_only=1, hidden=1, insert_after='ack_date', 
-				no_copy=1, print_hide=1),
-
-			dict(fieldname='signed_einvoice', label='Signed E-Invoice', fieldtype='Code', options='JSON', hidden=1, insert_after='irn_cancel_date',
-				no_copy=1, print_hide=1, read_only=1),
-
-			dict(fieldname='signed_qr_code', label='Signed QRCode', fieldtype='Code', options='JSON', hidden=1, insert_after='signed_einvoice',
-				no_copy=1, print_hide=1, read_only=1),
-
-			dict(fieldname='qrcode_image', label='QRCode', fieldtype='Attach Image', hidden=1, insert_after='signed_qr_code',
-				no_copy=1, print_hide=1, read_only=1),
-
-			dict(fieldname='einvoice_status', label='E-Invoice Status', fieldtype='Select', insert_after='qrcode_image',
-				options='\nPending\nGenerated\nCancelled\nFailed', default=None, hidden=1, no_copy=1, print_hide=1, read_only=1),
-
-			dict(fieldname='failure_description', label='E-Invoice Failure Description', fieldtype='Code', options='JSON',
-				hidden=1, insert_after='einvoice_status', no_copy=1, print_hide=1, read_only=1)
-		]
-	}
-	create_custom_fields(custom_fields, update=True)
-
-	if frappe.db.exists('E Invoice Settings') and frappe.db.get_single_value('E Invoice Settings', 'enable'):
-		frappe.db.sql('''
-			UPDATE `tabSales Invoice` SET einvoice_status = 'Pending'
-			WHERE
-				posting_date >= '2021-04-01'
-				AND ifnull(irn, '') = ''
-				AND ifnull(`billing_address_gstin`, '') != ifnull(`company_gstin`, '')
-				AND ifnull(gst_category, '') in ('Registered Regular', 'SEZ', 'Overseas', 'Deemed Export')
-		''')
-
-		# set appropriate statuses
-		frappe.db.sql('''UPDATE `tabSales Invoice` SET einvoice_status = 'Generated'
-			WHERE ifnull(irn, '') != '' AND ifnull(irn_cancelled, 0) = 0''')
-
-		frappe.db.sql('''UPDATE `tabSales Invoice` SET einvoice_status = 'Cancelled'
-			WHERE ifnull(irn_cancelled, 0) = 1''')
-
-	# set correct acknowledgement in e-invoices
-	einvoices = frappe.get_all('Sales Invoice', {'irn': ['is', 'set']}, ['name', 'signed_einvoice'])
-
-	if einvoices:
-		for inv in einvoices:
-			signed_einvoice = inv.get('signed_einvoice')
-			if signed_einvoice:
-				signed_einvoice = json.loads(signed_einvoice)
-				frappe.db.set_value('Sales Invoice', inv.get('name'), 'ack_no', signed_einvoice.get('AckNo'), update_modified=False)
-				frappe.db.set_value('Sales Invoice', inv.get('name'), 'ack_date', signed_einvoice.get('AckDt'), update_modified=False)
\ No newline at end of file
diff --git a/erpnext/patches/v12_0/add_einvoice_summary_report_permissions.py b/erpnext/patches/v12_0/add_einvoice_summary_report_permissions.py
deleted file mode 100644
index bf8f566..0000000
--- a/erpnext/patches/v12_0/add_einvoice_summary_report_permissions.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from __future__ import unicode_literals
-import frappe
-
-def execute():
-	company = frappe.get_all('Company', filters = {'country': 'India'})
-	if not company:
-		return
-
-	if frappe.db.exists('Report', 'E-Invoice Summary') and \
-		not frappe.db.get_value('Custom Role', dict(report='E-Invoice Summary')):
-		frappe.get_doc(dict(
-			doctype='Custom Role',
-			report='E-Invoice Summary',
-			roles= [
-				dict(role='Accounts User'),
-				dict(role='Accounts Manager')
-			]
-		)).insert()	
\ No newline at end of file
diff --git a/erpnext/patches/v12_0/add_eway_bill_in_delivery_note.py b/erpnext/patches/v12_0/add_eway_bill_in_delivery_note.py
index bb4b038..cf1ed36 100644
--- a/erpnext/patches/v12_0/add_eway_bill_in_delivery_note.py
+++ b/erpnext/patches/v12_0/add_eway_bill_in_delivery_note.py
@@ -16,4 +16,4 @@
         'insert_after': 'customer_name_in_arabic',
         'translatable': 0,
         'owner': 'Administrator'
-    })
\ No newline at end of file
+    })
diff --git a/erpnext/patches/v12_0/add_ewaybill_validity_field.py b/erpnext/patches/v12_0/add_ewaybill_validity_field.py
deleted file mode 100644
index 87d98f1..0000000
--- a/erpnext/patches/v12_0/add_ewaybill_validity_field.py
+++ /dev/null
@@ -1,16 +0,0 @@
-from __future__ import unicode_literals
-import frappe
-from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
-
-def execute():
-	company = frappe.get_all('Company', filters = {'country': 'India'})
-	if not company:
-		return
-
-	custom_fields = {
-		'Sales Invoice': [
-			dict(fieldname='eway_bill_validity', label='E-Way Bill Validity', fieldtype='Data', no_copy=1, print_hide=1,
-				depends_on='ewaybill', read_only=1, allow_on_submit=1, insert_after='ewaybill')
-		]
-	}
-	create_custom_fields(custom_fields, update=True)
\ No newline at end of file
diff --git a/erpnext/patches/v12_0/add_export_type_field_in_party_master.py b/erpnext/patches/v12_0/add_export_type_field_in_party_master.py
index 5bb6e3f..a0b1f87 100644
--- a/erpnext/patches/v12_0/add_export_type_field_in_party_master.py
+++ b/erpnext/patches/v12_0/add_export_type_field_in_party_master.py
@@ -38,5 +38,3 @@
 			WHERE fieldname = 'is_inter_state'
 			AND dt IN ('Sales Taxes and Charges Template', 'Purchase Taxes and Charges Template')
 		""")
-
-
diff --git a/erpnext/patches/v12_0/add_gst_category_in_delivery_note.py b/erpnext/patches/v12_0/add_gst_category_in_delivery_note.py
index 1208222..c908192 100644
--- a/erpnext/patches/v12_0/add_gst_category_in_delivery_note.py
+++ b/erpnext/patches/v12_0/add_gst_category_in_delivery_note.py
@@ -16,4 +16,4 @@
 		]
 	}
 
-	create_custom_fields(custom_fields, update=True)
\ No newline at end of file
+	create_custom_fields(custom_fields, update=True)
diff --git a/erpnext/patches/v12_0/add_item_name_in_work_orders.py b/erpnext/patches/v12_0/add_item_name_in_work_orders.py
index 485dd31..d765b93 100644
--- a/erpnext/patches/v12_0/add_item_name_in_work_orders.py
+++ b/erpnext/patches/v12_0/add_item_name_in_work_orders.py
@@ -11,4 +11,4 @@
 		SET
 			wo.item_name = item.item_name
 	""")
-	frappe.db.commit()
\ No newline at end of file
+	frappe.db.commit()
diff --git a/erpnext/patches/v12_0/add_permission_in_lower_deduction.py b/erpnext/patches/v12_0/add_permission_in_lower_deduction.py
index af9bf74..2e42368 100644
--- a/erpnext/patches/v12_0/add_permission_in_lower_deduction.py
+++ b/erpnext/patches/v12_0/add_permission_in_lower_deduction.py
@@ -10,4 +10,4 @@
 
 	add_permission('Lower Deduction Certificate', 'Accounts Manager', 0)
 	update_permission_property('Lower Deduction Certificate', 'Accounts Manager', 0, 'write', 1)
-	update_permission_property('Lower Deduction Certificate', 'Accounts Manager', 0, 'create', 1)
\ No newline at end of file
+	update_permission_property('Lower Deduction Certificate', 'Accounts Manager', 0, 'create', 1)
diff --git a/erpnext/patches/v12_0/create_accounting_dimensions_in_missing_doctypes.py b/erpnext/patches/v12_0/create_accounting_dimensions_in_missing_doctypes.py
index 657decf..f171542 100644
--- a/erpnext/patches/v12_0/create_accounting_dimensions_in_missing_doctypes.py
+++ b/erpnext/patches/v12_0/create_accounting_dimensions_in_missing_doctypes.py
@@ -39,4 +39,4 @@
 			create_custom_field(doctype, df)
 			frappe.clear_cache(doctype=doctype)
 
-		count += 1
\ No newline at end of file
+		count += 1
diff --git a/erpnext/patches/v12_0/create_default_energy_point_rules.py b/erpnext/patches/v12_0/create_default_energy_point_rules.py
index 88233b4..93d2576 100644
--- a/erpnext/patches/v12_0/create_default_energy_point_rules.py
+++ b/erpnext/patches/v12_0/create_default_energy_point_rules.py
@@ -3,4 +3,4 @@
 
 def execute():
 	frappe.reload_doc('social', 'doctype', 'energy_point_rule')
-	create_default_energy_point_rules()
\ No newline at end of file
+	create_default_energy_point_rules()
diff --git a/erpnext/patches/v12_0/create_irs_1099_field_united_states.py b/erpnext/patches/v12_0/create_irs_1099_field_united_states.py
index 7feaffd..23a8f24 100644
--- a/erpnext/patches/v12_0/create_irs_1099_field_united_states.py
+++ b/erpnext/patches/v12_0/create_irs_1099_field_united_states.py
@@ -13,4 +13,4 @@
 	if not company:
 		return
 
-	make_custom_fields()
\ No newline at end of file
+	make_custom_fields()
diff --git a/erpnext/patches/v12_0/create_itc_reversal_custom_fields.py b/erpnext/patches/v12_0/create_itc_reversal_custom_fields.py
index 0078a53..a6230f4 100644
--- a/erpnext/patches/v12_0/create_itc_reversal_custom_fields.py
+++ b/erpnext/patches/v12_0/create_itc_reversal_custom_fields.py
@@ -112,4 +112,4 @@
 				'itc_central_tax': values.get('itc_central_tax'),
 				'itc_state_tax': values['itc_state_tax'],
 				'itc_cess_amount': values['itc_cess_amount'],
-			})
\ No newline at end of file
+			})
diff --git a/erpnext/patches/v12_0/create_taxable_value_field.py b/erpnext/patches/v12_0/create_taxable_value_field.py
index a0c9fcf..b9ee81d 100644
--- a/erpnext/patches/v12_0/create_taxable_value_field.py
+++ b/erpnext/patches/v12_0/create_taxable_value_field.py
@@ -15,4 +15,4 @@
 		]
 	}
 
-	create_custom_fields(custom_fields, update=True)
\ No newline at end of file
+	create_custom_fields(custom_fields, update=True)
diff --git a/erpnext/patches/v12_0/delete_priority_property_setter.py b/erpnext/patches/v12_0/delete_priority_property_setter.py
index 5927267..1638557 100644
--- a/erpnext/patches/v12_0/delete_priority_property_setter.py
+++ b/erpnext/patches/v12_0/delete_priority_property_setter.py
@@ -6,4 +6,4 @@
 		WHERE `tabProperty Setter`.doc_type='Issue'
 			AND `tabProperty Setter`.field_name='priority'
 			AND `tabProperty Setter`.property='options'
-	""")
\ No newline at end of file
+	""")
diff --git a/erpnext/patches/v12_0/fix_quotation_expired_status.py b/erpnext/patches/v12_0/fix_quotation_expired_status.py
index c8708d8..ac7e82d 100644
--- a/erpnext/patches/v12_0/fix_quotation_expired_status.py
+++ b/erpnext/patches/v12_0/fix_quotation_expired_status.py
@@ -6,23 +6,23 @@
 	# filter out submitted expired quotations which has sales order created
 	cond = "qo.docstatus = 1 and qo.status = 'Expired'"
 	invalid_so_against_quo = """
-		SELECT 
+		SELECT
 			so.name FROM `tabSales Order` so, `tabSales Order Item` so_item
-		WHERE 
+		WHERE
 			so_item.docstatus = 1 and so.docstatus = 1
 			and so_item.parent = so.name
 			and so_item.prevdoc_docname = qo.name
 			and qo.valid_till < so.transaction_date""" # check if SO was created after quotation expired
-		
+
 	frappe.db.sql(
 		"""UPDATE `tabQuotation` qo SET qo.status = 'Expired' WHERE {cond} and exists({invalid_so_against_quo})"""
 			.format(cond=cond, invalid_so_against_quo=invalid_so_against_quo)
 		)
-	
+
 	valid_so_against_quo = """
-		SELECT 
+		SELECT
 			so.name FROM `tabSales Order` so, `tabSales Order Item` so_item
-		WHERE 
+		WHERE
 			so_item.docstatus = 1 and so.docstatus = 1
 			and so_item.parent = so.name
 			and so_item.prevdoc_docname = qo.name
diff --git a/erpnext/patches/v12_0/move_target_distribution_from_parent_to_child.py b/erpnext/patches/v12_0/move_target_distribution_from_parent_to_child.py
index 548c1a4..97badf3 100644
--- a/erpnext/patches/v12_0/move_target_distribution_from_parent_to_child.py
+++ b/erpnext/patches/v12_0/move_target_distribution_from_parent_to_child.py
@@ -19,4 +19,4 @@
 
     frappe.delete_doc("Report", "Sales Partner-wise Transaction Summary")
     frappe.delete_doc("Report", "Sales Person Target Variance Item Group-Wise")
-    frappe.delete_doc("Report", "Territory Target Variance Item Group-Wise")
\ No newline at end of file
+    frappe.delete_doc("Report", "Territory Target Variance Item Group-Wise")
diff --git a/erpnext/patches/v12_0/recalculate_requested_qty_in_bin.py b/erpnext/patches/v12_0/recalculate_requested_qty_in_bin.py
index 8267df9..46794be 100644
--- a/erpnext/patches/v12_0/recalculate_requested_qty_in_bin.py
+++ b/erpnext/patches/v12_0/recalculate_requested_qty_in_bin.py
@@ -10,4 +10,4 @@
 	for entry in bin_details:
 		update_bin_qty(entry.get("item_code"), entry.get("warehouse"), {
 			"indented_qty": get_indented_qty(entry.get("item_code"), entry.get("warehouse"))
-		})
\ No newline at end of file
+		})
diff --git a/erpnext/patches/v12_0/remove_bank_remittance_custom_fields.py b/erpnext/patches/v12_0/remove_bank_remittance_custom_fields.py
index d1446b3..be884f9 100644
--- a/erpnext/patches/v12_0/remove_bank_remittance_custom_fields.py
+++ b/erpnext/patches/v12_0/remove_bank_remittance_custom_fields.py
@@ -11,4 +11,4 @@
 	if frappe.db.exists("Custom Field", "Company-bank_remittance_section"):
 		deprecated_fields = ['bank_remittance_section', 'client_code', 'remittance_column_break', 'product_code']
 		for i in range(len(deprecated_fields)):
-			frappe.delete_doc("Custom Field", 'Company-'+deprecated_fields[i])
\ No newline at end of file
+			frappe.delete_doc("Custom Field", 'Company-'+deprecated_fields[i])
diff --git a/erpnext/patches/v12_0/remove_denied_leaves_from_leave_ledger.py b/erpnext/patches/v12_0/remove_denied_leaves_from_leave_ledger.py
index 7859606..4fcffb7 100644
--- a/erpnext/patches/v12_0/remove_denied_leaves_from_leave_ledger.py
+++ b/erpnext/patches/v12_0/remove_denied_leaves_from_leave_ledger.py
@@ -25,4 +25,4 @@
 			WHERE
 				transaction_type = 'Leave Application'
 				AND transaction_name in (%s) ''' % (', '.join(['%s'] * len(leave_application_list))), #nosec
-				tuple(leave_application_list))
\ No newline at end of file
+				tuple(leave_application_list))
diff --git a/erpnext/patches/v12_0/remove_duplicate_leave_ledger_entries.py b/erpnext/patches/v12_0/remove_duplicate_leave_ledger_entries.py
index 24286dc..6b1b601 100644
--- a/erpnext/patches/v12_0/remove_duplicate_leave_ledger_entries.py
+++ b/erpnext/patches/v12_0/remove_duplicate_leave_ledger_entries.py
@@ -43,4 +43,4 @@
 				AND is_carry_forward = %s
 				AND from_date = %s
 				AND to_date = %s
-		''', tuple(d))
\ No newline at end of file
+		''', tuple(d))
diff --git a/erpnext/patches/v12_0/rename_account_type_doctype.py b/erpnext/patches/v12_0/rename_account_type_doctype.py
index ffb4e93..9a08ad4 100644
--- a/erpnext/patches/v12_0/rename_account_type_doctype.py
+++ b/erpnext/patches/v12_0/rename_account_type_doctype.py
@@ -4,4 +4,4 @@
 def execute():
 	frappe.rename_doc('DocType', 'Account Type', 'Bank Account Type', force=True)
 	frappe.rename_doc('DocType', 'Account Subtype', 'Bank Account Subtype', force=True)
-	frappe.reload_doc('accounts', 'doctype', 'bank_account')
\ No newline at end of file
+	frappe.reload_doc('accounts', 'doctype', 'bank_account')
diff --git a/erpnext/patches/v12_0/rename_bank_account_field_in_journal_entry_account.py b/erpnext/patches/v12_0/rename_bank_account_field_in_journal_entry_account.py
index 4230cb8..7489ea3 100644
--- a/erpnext/patches/v12_0/rename_bank_account_field_in_journal_entry_account.py
+++ b/erpnext/patches/v12_0/rename_bank_account_field_in_journal_entry_account.py
@@ -14,4 +14,4 @@
 def update_journal_entry_account_fieldname():
 	''' maps data from old field to the new field '''
 	if frappe.db.has_column('Journal Entry Account', 'bank_account_no'):
-		rename_field("Journal Entry Account", "bank_account_no", "bank_account")
\ No newline at end of file
+		rename_field("Journal Entry Account", "bank_account_no", "bank_account")
diff --git a/erpnext/patches/v12_0/rename_lost_reason_detail.py b/erpnext/patches/v12_0/rename_lost_reason_detail.py
index d0dc356..c71b91c 100644
--- a/erpnext/patches/v12_0/rename_lost_reason_detail.py
+++ b/erpnext/patches/v12_0/rename_lost_reason_detail.py
@@ -15,4 +15,4 @@
             SELECT o.`name`, o.`creation`, o.`modified`, o.`modified_by`, o.`owner`, o.`docstatus`, o.`parent`, o.`parentfield`, o.`parenttype`, o.`idx`, o.`_comments`, o.`_assign`, o.`_user_tags`, o.`_liked_by`, o.`lost_reason`
             FROM `tabOpportunity Lost Reason` o LEFT JOIN `tabQuotation Lost Reason` q ON q.name = o.name WHERE q.name IS NULL""")
 
-        frappe.delete_doc("DocType", "Lost Reason Detail")
\ No newline at end of file
+        frappe.delete_doc("DocType", "Lost Reason Detail")
diff --git a/erpnext/patches/v12_0/rename_pos_closing_doctype.py b/erpnext/patches/v12_0/rename_pos_closing_doctype.py
index 0577f81..9d8626b 100644
--- a/erpnext/patches/v12_0/rename_pos_closing_doctype.py
+++ b/erpnext/patches/v12_0/rename_pos_closing_doctype.py
@@ -7,10 +7,10 @@
 	if frappe.db.table_exists("POS Closing Voucher"):
 		if not frappe.db.exists("DocType", "POS Closing Entry"):
 			frappe.rename_doc('DocType', 'POS Closing Voucher', 'POS Closing Entry', force=True)
-		
+
 		if not frappe.db.exists('DocType', 'POS Closing Entry Taxes'):
 			frappe.rename_doc('DocType', 'POS Closing Voucher Taxes', 'POS Closing Entry Taxes', force=True)
-		
+
 		if not frappe.db.exists('DocType', 'POS Closing Voucher Details'):
 			frappe.rename_doc('DocType', 'POS Closing Voucher Details', 'POS Closing Entry Detail', force=True)
 
@@ -22,4 +22,4 @@
 		frappe.delete_doc("DocType", "POS Closing Voucher")
 		frappe.delete_doc("DocType", "POS Closing Voucher Taxes")
 		frappe.delete_doc("DocType", "POS Closing Voucher Details")
-		frappe.delete_doc("DocType", "POS Closing Voucher Invoices")
\ No newline at end of file
+		frappe.delete_doc("DocType", "POS Closing Voucher Invoices")
diff --git a/erpnext/patches/v12_0/rename_tolerance_fields.py b/erpnext/patches/v12_0/rename_tolerance_fields.py
index aa2fff4..20b0963 100644
--- a/erpnext/patches/v12_0/rename_tolerance_fields.py
+++ b/erpnext/patches/v12_0/rename_tolerance_fields.py
@@ -12,4 +12,4 @@
 	qty_allowance = frappe.db.get_single_value("Stock Settings", "over_delivery_receipt_allowance")
 	frappe.db.set_value("Accounts Settings", None, "over_delivery_receipt_allowance", qty_allowance)
 
-	frappe.db.sql("update tabItem set over_billing_allowance=over_delivery_receipt_allowance")
\ No newline at end of file
+	frappe.db.sql("update tabItem set over_billing_allowance=over_delivery_receipt_allowance")
diff --git a/erpnext/patches/v12_0/replace_accounting_with_accounts_in_home_settings.py b/erpnext/patches/v12_0/replace_accounting_with_accounts_in_home_settings.py
index 09fc4c1..f88a22f 100644
--- a/erpnext/patches/v12_0/replace_accounting_with_accounts_in_home_settings.py
+++ b/erpnext/patches/v12_0/replace_accounting_with_accounts_in_home_settings.py
@@ -2,4 +2,4 @@
 
 def execute():
 	frappe.db.sql("""UPDATE `tabUser` SET `home_settings` = REPLACE(`home_settings`, 'Accounting', 'Accounts')""")
-	frappe.cache().delete_key('home_settings')
\ No newline at end of file
+	frappe.cache().delete_key('home_settings')
diff --git a/erpnext/patches/v12_0/repost_stock_ledger_entries_for_target_warehouse.py b/erpnext/patches/v12_0/repost_stock_ledger_entries_for_target_warehouse.py
index 13e935b..c52f380 100644
--- a/erpnext/patches/v12_0/repost_stock_ledger_entries_for_target_warehouse.py
+++ b/erpnext/patches/v12_0/repost_stock_ledger_entries_for_target_warehouse.py
@@ -66,6 +66,3 @@
 
 		frappe.db.sql(""" UPDATE `tabPacked Item` set target_warehouse = null
 			WHERE creation > '2020-04-16' and docstatus < 2 and parenttype = 'Sales Order' """)
-
-
-
diff --git a/erpnext/patches/v12_0/set_automatically_process_deferred_accounting_in_accounts_settings.py b/erpnext/patches/v12_0/set_automatically_process_deferred_accounting_in_accounts_settings.py
index 5ee75be..b5d7e3d 100644
--- a/erpnext/patches/v12_0/set_automatically_process_deferred_accounting_in_accounts_settings.py
+++ b/erpnext/patches/v12_0/set_automatically_process_deferred_accounting_in_accounts_settings.py
@@ -4,4 +4,4 @@
 def execute():
 	frappe.reload_doc("accounts", "doctype", "accounts_settings")
 
-	frappe.db.set_value("Accounts Settings", None, "automatically_process_deferred_accounting_entry", 1)
\ No newline at end of file
+	frappe.db.set_value("Accounts Settings", None, "automatically_process_deferred_accounting_entry", 1)
diff --git a/erpnext/patches/v12_0/set_cost_center_in_child_table_of_expense_claim.py b/erpnext/patches/v12_0/set_cost_center_in_child_table_of_expense_claim.py
index 8ba0d79..4415cfe 100644
--- a/erpnext/patches/v12_0/set_cost_center_in_child_table_of_expense_claim.py
+++ b/erpnext/patches/v12_0/set_cost_center_in_child_table_of_expense_claim.py
@@ -5,4 +5,4 @@
 		UPDATE `tabExpense Claim Detail` child, `tabExpense Claim` par
 		SET child.cost_center = par.cost_center
 		WHERE child.parent = par.name
-	""")
\ No newline at end of file
+	""")
diff --git a/erpnext/patches/v12_0/set_cwip_and_delete_asset_settings.py b/erpnext/patches/v12_0/set_cwip_and_delete_asset_settings.py
index 4d4fc7c..13110df 100644
--- a/erpnext/patches/v12_0/set_cwip_and_delete_asset_settings.py
+++ b/erpnext/patches/v12_0/set_cwip_and_delete_asset_settings.py
@@ -10,8 +10,8 @@
 	if frappe.db.exists("DocType", "Asset Settings"):
 		frappe.reload_doctype("Asset Category")
 		cwip_value = frappe.db.get_single_value("Asset Settings", "disable_cwip_accounting")
-		
+
 		frappe.db.sql("""UPDATE `tabAsset Category` SET enable_cwip_accounting = %s""", cint(cwip_value))
 
 		frappe.db.sql("""DELETE FROM `tabSingles` where doctype = 'Asset Settings'""")
-		frappe.delete_doc_if_exists("DocType", "Asset Settings")
\ No newline at end of file
+		frappe.delete_doc_if_exists("DocType", "Asset Settings")
diff --git a/erpnext/patches/v12_0/set_default_homepage_type.py b/erpnext/patches/v12_0/set_default_homepage_type.py
index 241e4b9..a290e31 100644
--- a/erpnext/patches/v12_0/set_default_homepage_type.py
+++ b/erpnext/patches/v12_0/set_default_homepage_type.py
@@ -1,4 +1,4 @@
 import frappe
 
 def execute():
-	frappe.db.set_value('Homepage', 'Homepage', 'hero_section_based_on', 'Default')
\ No newline at end of file
+	frappe.db.set_value('Homepage', 'Homepage', 'hero_section_based_on', 'Default')
diff --git a/erpnext/patches/v12_0/set_default_payroll_based_on.py b/erpnext/patches/v12_0/set_default_payroll_based_on.py
index 04b54a6..038bd6d 100644
--- a/erpnext/patches/v12_0/set_default_payroll_based_on.py
+++ b/erpnext/patches/v12_0/set_default_payroll_based_on.py
@@ -3,4 +3,4 @@
 
 def execute():
 	frappe.reload_doc("hr", "doctype", "hr_settings")
-	frappe.db.set_value("HR Settings", None, "payroll_based_on", "Leave")
\ No newline at end of file
+	frappe.db.set_value("HR Settings", None, "payroll_based_on", "Leave")
diff --git a/erpnext/patches/v12_0/set_expense_account_in_landed_cost_voucher_taxes.py b/erpnext/patches/v12_0/set_expense_account_in_landed_cost_voucher_taxes.py
index a996a69..a27c7b2 100644
--- a/erpnext/patches/v12_0/set_expense_account_in_landed_cost_voucher_taxes.py
+++ b/erpnext/patches/v12_0/set_expense_account_in_landed_cost_voucher_taxes.py
@@ -30,4 +30,4 @@
 				s.docstatus = 1
 				AND s.company = %s
 				AND t.parent = s.name
-		""", (account, company))
\ No newline at end of file
+		""", (account, company))
diff --git a/erpnext/patches/v12_0/set_gst_category.py b/erpnext/patches/v12_0/set_gst_category.py
index 55bbdee..cc09395 100644
--- a/erpnext/patches/v12_0/set_gst_category.py
+++ b/erpnext/patches/v12_0/set_gst_category.py
@@ -48,5 +48,3 @@
 
 		frappe.db.sql(""" UPDATE `tab{doctype}` t1, `tabAddress` t2, `tabDynamic Link` t3 SET t1.gst_category = "Overseas"
 			where t3.link_name = t1.name and t3.parent = t2.name and t2.country != 'India' """.format(doctype=doctype)) #nosec
-
-
diff --git a/erpnext/patches/v12_0/set_italian_import_supplier_invoice_permissions.py b/erpnext/patches/v12_0/set_italian_import_supplier_invoice_permissions.py
index a6011c4..8fdc73b 100644
--- a/erpnext/patches/v12_0/set_italian_import_supplier_invoice_permissions.py
+++ b/erpnext/patches/v12_0/set_italian_import_supplier_invoice_permissions.py
@@ -9,4 +9,4 @@
 	countries = frappe.get_all("Company", fields="country")
 	countries = [country["country"] for country in countries]
 	if "Italy" in countries:
-		add_permissions()
\ No newline at end of file
+		add_permissions()
diff --git a/erpnext/patches/v12_0/set_multi_uom_in_rfq.py b/erpnext/patches/v12_0/set_multi_uom_in_rfq.py
index 70ca6b2..a5c8f75 100644
--- a/erpnext/patches/v12_0/set_multi_uom_in_rfq.py
+++ b/erpnext/patches/v12_0/set_multi_uom_in_rfq.py
@@ -13,4 +13,4 @@
 			SET
 				stock_uom = uom,
 				conversion_factor = 1,
-				stock_qty = qty""")
\ No newline at end of file
+				stock_qty = qty""")
diff --git a/erpnext/patches/v12_0/set_payment_entry_status.py b/erpnext/patches/v12_0/set_payment_entry_status.py
index fafbec6..84645a3 100644
--- a/erpnext/patches/v12_0/set_payment_entry_status.py
+++ b/erpnext/patches/v12_0/set_payment_entry_status.py
@@ -6,4 +6,4 @@
 		WHEN docstatus = 1 THEN 'Submitted'
 		WHEN docstatus = 2 THEN 'Cancelled'
 		ELSE 'Draft'
-		END;""")
\ No newline at end of file
+		END;""")
diff --git a/erpnext/patches/v12_0/set_priority_for_support.py b/erpnext/patches/v12_0/set_priority_for_support.py
index a5490ef..66696be 100644
--- a/erpnext/patches/v12_0/set_priority_for_support.py
+++ b/erpnext/patches/v12_0/set_priority_for_support.py
@@ -81,4 +81,4 @@
 				doc.flags.ignore_validate = True
 				doc.save(ignore_permissions=True)
 	except frappe.db.TableMissingError:
-		frappe.reload_doc("support", "doctype", "service_level_agreement")
\ No newline at end of file
+		frappe.reload_doc("support", "doctype", "service_level_agreement")
diff --git a/erpnext/patches/v12_0/set_produced_qty_field_in_sales_order_for_work_order.py b/erpnext/patches/v12_0/set_produced_qty_field_in_sales_order_for_work_order.py
index 0702673..6c11cb4 100644
--- a/erpnext/patches/v12_0/set_produced_qty_field_in_sales_order_for_work_order.py
+++ b/erpnext/patches/v12_0/set_produced_qty_field_in_sales_order_for_work_order.py
@@ -11,4 +11,4 @@
 		filters={'sales_order': ('!=', ''), 'sales_order_item': ('!=', '')}):
 
 		# update produced qty in sales order
-		update_produced_qty_in_so_item(d.sales_order, d.sales_order_item)
\ No newline at end of file
+		update_produced_qty_in_so_item(d.sales_order, d.sales_order_item)
diff --git a/erpnext/patches/v12_0/set_production_capacity_in_workstation.py b/erpnext/patches/v12_0/set_production_capacity_in_workstation.py
index bae1e28..babaebe 100644
--- a/erpnext/patches/v12_0/set_production_capacity_in_workstation.py
+++ b/erpnext/patches/v12_0/set_production_capacity_in_workstation.py
@@ -5,4 +5,4 @@
     frappe.reload_doc("manufacturing", "doctype", "workstation")
 
     frappe.db.sql(""" UPDATE `tabWorkstation`
-        SET production_capacity = 1 """)
\ No newline at end of file
+        SET production_capacity = 1 """)
diff --git a/erpnext/patches/v12_0/set_quotation_status.py b/erpnext/patches/v12_0/set_quotation_status.py
index 64a9080..87643a2 100644
--- a/erpnext/patches/v12_0/set_quotation_status.py
+++ b/erpnext/patches/v12_0/set_quotation_status.py
@@ -4,4 +4,4 @@
 def execute():
 
 	frappe.db.sql(""" UPDATE `tabQuotation` set status = 'Open'
-		where docstatus = 1 and status = 'Submitted' """)
\ No newline at end of file
+		where docstatus = 1 and status = 'Submitted' """)
diff --git a/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py b/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py
index 63ca540..1cc37ca 100644
--- a/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py
+++ b/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py
@@ -8,4 +8,4 @@
 def execute():
     frappe.reload_doc("stock", "doctype", "pick_list")
     frappe.db.sql("""UPDATE `tabPick List` set purpose = 'Delivery'
-        WHERE docstatus = 1  and purpose = 'Delivery against Sales Order' """)
\ No newline at end of file
+        WHERE docstatus = 1  and purpose = 'Delivery against Sales Order' """)
diff --git a/erpnext/patches/v12_0/setup_einvoice_fields.py b/erpnext/patches/v12_0/setup_einvoice_fields.py
deleted file mode 100644
index 2474bc3..0000000
--- a/erpnext/patches/v12_0/setup_einvoice_fields.py
+++ /dev/null
@@ -1,56 +0,0 @@
-from __future__ import unicode_literals
-import frappe
-from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
-from erpnext.regional.india.setup import add_permissions, add_print_formats
-
-def execute():
-	company = frappe.get_all('Company', filters = {'country': 'India'})
-	if not company:
-		return
-
-	frappe.reload_doc("custom", "doctype", "custom_field")
-	frappe.reload_doc("regional", "doctype", "e_invoice_settings")
-	custom_fields = {
-		'Sales Invoice': [
-			dict(fieldname='irn', label='IRN', fieldtype='Data', read_only=1, insert_after='customer', no_copy=1, print_hide=1,
-				depends_on='eval:in_list(["Registered Regular", "SEZ", "Overseas", "Deemed Export"], doc.gst_category) && doc.irn_cancelled === 0'),
-			
-			dict(fieldname='ack_no', label='Ack. No.', fieldtype='Data', read_only=1, hidden=1, insert_after='irn', no_copy=1, print_hide=1),
-		
-			dict(fieldname='ack_date', label='Ack. Date', fieldtype='Data', read_only=1, hidden=1, insert_after='ack_no', no_copy=1, print_hide=1),
-
-			dict(fieldname='irn_cancelled', label='IRN Cancelled', fieldtype='Check', no_copy=1, print_hide=1,
-				depends_on='eval:(doc.irn_cancelled === 1)', read_only=1, allow_on_submit=1, insert_after='customer'),
-
-			dict(fieldname='eway_bill_cancelled', label='E-Way Bill Cancelled', fieldtype='Check', no_copy=1, print_hide=1,
-				depends_on='eval:(doc.eway_bill_cancelled === 1)', read_only=1, allow_on_submit=1, insert_after='customer'),
-
-			dict(fieldname='signed_einvoice', fieldtype='Code', options='JSON', hidden=1, no_copy=1, print_hide=1, read_only=1),
-
-			dict(fieldname='signed_qr_code', fieldtype='Code', options='JSON', hidden=1, no_copy=1, print_hide=1, read_only=1),
-
-			dict(fieldname='qrcode_image', label='QRCode', fieldtype='Attach Image', hidden=1, no_copy=1, print_hide=1, read_only=1)
-		]
-	}
-	create_custom_fields(custom_fields, update=True)
-	add_permissions()
-	add_print_formats()
-
-	einvoice_cond = 'in_list(["Registered Regular", "SEZ", "Overseas", "Deemed Export"], doc.gst_category)'
-	t = {
-		'mode_of_transport': [{'default': None}],
-		'distance': [{'mandatory_depends_on': f'eval:{einvoice_cond} && doc.transporter'}],
-		'gst_vehicle_type': [{'mandatory_depends_on': f'eval:{einvoice_cond} && doc.mode_of_transport == "Road"'}],
-		'lr_date': [{'mandatory_depends_on': f'eval:{einvoice_cond} && in_list(["Air", "Ship", "Rail"], doc.mode_of_transport)'}],
-		'lr_no': [{'mandatory_depends_on': f'eval:{einvoice_cond} && in_list(["Air", "Ship", "Rail"], doc.mode_of_transport)'}],
-		'vehicle_no': [{'mandatory_depends_on': f'eval:{einvoice_cond} && doc.mode_of_transport == "Road"'}],
-		'ewaybill': [
-			{'read_only_depends_on': 'eval:doc.irn && doc.ewaybill'},
-			{'depends_on': 'eval:((doc.docstatus === 1 || doc.ewaybill) && doc.eway_bill_cancelled === 0)'}
-		]
-	}
-
-	for field, conditions in t.items():
-		for c in conditions:
-			[(prop, value)] = c.items()
-			frappe.db.set_value('Custom Field', { 'fieldname': field }, prop, value)
diff --git a/erpnext/patches/v12_0/show_einvoice_irn_cancelled_field.py b/erpnext/patches/v12_0/show_einvoice_irn_cancelled_field.py
deleted file mode 100644
index 2319c17..0000000
--- a/erpnext/patches/v12_0/show_einvoice_irn_cancelled_field.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from __future__ import unicode_literals
-import frappe
-
-def execute():
-	company = frappe.get_all('Company', filters = {'country': 'India'})
-	if not company:
-		return
-
-	irn_cancelled_field = frappe.db.exists('Custom Field', {'dt': 'Sales Invoice', 'fieldname': 'irn_cancelled'})
-	if irn_cancelled_field:
-		frappe.db.set_value('Custom Field', irn_cancelled_field, 'depends_on', 'eval: doc.irn')
-		frappe.db.set_value('Custom Field', irn_cancelled_field, 'read_only', 0)
diff --git a/erpnext/patches/v12_0/stock_entry_enhancements.py b/erpnext/patches/v12_0/stock_entry_enhancements.py
index 847d928..17fdcd9 100644
--- a/erpnext/patches/v12_0/stock_entry_enhancements.py
+++ b/erpnext/patches/v12_0/stock_entry_enhancements.py
@@ -49,4 +49,4 @@
 			`tabStock Entry Detail`.gst_hsn_code = `tabItem`.gst_hsn_code
 		Where
 			`tabItem`.name = `tabStock Entry Detail`.item_code and `tabItem`.gst_hsn_code is not null
-	""")
\ No newline at end of file
+	""")
diff --git a/erpnext/patches/v12_0/unhide_cost_center_field.py b/erpnext/patches/v12_0/unhide_cost_center_field.py
index 6005ab7..3474a34 100644
--- a/erpnext/patches/v12_0/unhide_cost_center_field.py
+++ b/erpnext/patches/v12_0/unhide_cost_center_field.py
@@ -10,4 +10,4 @@
 		WHERE doc_type in ('Sales Invoice', 'Purchase Invoice', 'Payment Entry')
 		AND field_name = 'cost_center'
 		AND property = 'hidden'
-	""")
\ No newline at end of file
+	""")
diff --git a/erpnext/patches/v12_0/update_appointment_reminder_scheduler_entry.py b/erpnext/patches/v12_0/update_appointment_reminder_scheduler_entry.py
index 91931ee..f451664 100644
--- a/erpnext/patches/v12_0/update_appointment_reminder_scheduler_entry.py
+++ b/erpnext/patches/v12_0/update_appointment_reminder_scheduler_entry.py
@@ -4,4 +4,4 @@
 	job = frappe.db.exists('Scheduled Job Type', 'patient_appointment.send_appointment_reminder')
 	if job:
 		method = 'erpnext.healthcare.doctype.patient_appointment.patient_appointment.send_appointment_reminder'
-		frappe.db.set_value('Scheduled Job Type', job, 'method', method)
\ No newline at end of file
+		frappe.db.set_value('Scheduled Job Type', job, 'method', method)
diff --git a/erpnext/patches/v12_0/update_bom_in_so_mr.py b/erpnext/patches/v12_0/update_bom_in_so_mr.py
index 309ae4c..8a87171 100644
--- a/erpnext/patches/v12_0/update_bom_in_so_mr.py
+++ b/erpnext/patches/v12_0/update_bom_in_so_mr.py
@@ -16,4 +16,4 @@
 			WHERE
 				child_doc.item_code = item.name and child_doc.docstatus < 2
 				and item.default_bom is not null and item.default_bom != '' {cond}
-		""".format(doc = doctype, cond = condition))
\ No newline at end of file
+		""".format(doc = doctype, cond = condition))
diff --git a/erpnext/patches/v12_0/update_end_date_and_status_in_email_campaign.py b/erpnext/patches/v12_0/update_end_date_and_status_in_email_campaign.py
index db71a73..c45f622 100644
--- a/erpnext/patches/v12_0/update_end_date_and_status_in_email_campaign.py
+++ b/erpnext/patches/v12_0/update_end_date_and_status_in_email_campaign.py
@@ -21,4 +21,4 @@
             elif end_date >= today_date:
                 doc.db_set("status", "In Progress")
             elif end_date < today_date:
-                doc.db_set("status", "Completed") 
\ No newline at end of file
+                doc.db_set("status", "Completed")
diff --git a/erpnext/patches/v12_0/update_ewaybill_field_position.py b/erpnext/patches/v12_0/update_ewaybill_field_position.py
index c0230c4..9e5f599 100644
--- a/erpnext/patches/v12_0/update_ewaybill_field_position.py
+++ b/erpnext/patches/v12_0/update_ewaybill_field_position.py
@@ -25,4 +25,4 @@
 			'translatable': 0
 		})
 
-		ewaybill_field.save()
\ No newline at end of file
+		ewaybill_field.save()
diff --git a/erpnext/patches/v12_0/update_gst_category.py b/erpnext/patches/v12_0/update_gst_category.py
index 963edad..1a54216 100644
--- a/erpnext/patches/v12_0/update_gst_category.py
+++ b/erpnext/patches/v12_0/update_gst_category.py
@@ -16,4 +16,4 @@
     frappe.db.sql(""" UPDATE `tabPurchase Invoice` set gst_category = 'Unregistered'
         where gst_category = 'Registered Regular'
         and ifnull(supplier_gstin, '')=''
-    """)
\ No newline at end of file
+    """)
diff --git a/erpnext/patches/v12_0/update_healthcare_refactored_changes.py b/erpnext/patches/v12_0/update_healthcare_refactored_changes.py
index d06c571..d0b0443 100644
--- a/erpnext/patches/v12_0/update_healthcare_refactored_changes.py
+++ b/erpnext/patches/v12_0/update_healthcare_refactored_changes.py
@@ -134,4 +134,4 @@
 				status = (CASE WHEN visited >= max_visits THEN 'Completed'
 								ELSE 'Pending'
 							END)
-		""")
\ No newline at end of file
+		""")
diff --git a/erpnext/patches/v12_0/update_is_cancelled_field.py b/erpnext/patches/v12_0/update_is_cancelled_field.py
index 0b2e827..4bbec44 100644
--- a/erpnext/patches/v12_0/update_is_cancelled_field.py
+++ b/erpnext/patches/v12_0/update_is_cancelled_field.py
@@ -12,4 +12,4 @@
 		frappe.reload_doc("stock", "doctype", "stock_ledger_entry")
 		frappe.reload_doc("stock", "doctype", "serial_no")
 	except:
-		pass
\ No newline at end of file
+		pass
diff --git a/erpnext/patches/v12_0/update_item_tax_template_company.py b/erpnext/patches/v12_0/update_item_tax_template_company.py
index f749699..e15894d 100644
--- a/erpnext/patches/v12_0/update_item_tax_template_company.py
+++ b/erpnext/patches/v12_0/update_item_tax_template_company.py
@@ -10,4 +10,4 @@
         for tax in doc.taxes:
             doc.company = frappe.get_value('Account', tax.tax_type, 'company')
             break
-        doc.save()
\ No newline at end of file
+        doc.save()
diff --git a/erpnext/patches/v12_0/update_owner_fields_in_acc_dimension_custom_fields.py b/erpnext/patches/v12_0/update_owner_fields_in_acc_dimension_custom_fields.py
index e4dcecd..6ebaf48 100644
--- a/erpnext/patches/v12_0/update_owner_fields_in_acc_dimension_custom_fields.py
+++ b/erpnext/patches/v12_0/update_owner_fields_in_acc_dimension_custom_fields.py
@@ -14,4 +14,4 @@
 			SET owner = 'Administrator'
 			WHERE fieldname = %s
 			AND dt IN (%s)""" %			#nosec
-			('%s', ', '.join(['%s']* len(doclist))), tuple([dimension.fieldname] + doclist))
\ No newline at end of file
+			('%s', ', '.join(['%s']* len(doclist))), tuple([dimension.fieldname] + doclist))
diff --git a/erpnext/patches/v12_0/update_price_list_currency_in_bom.py b/erpnext/patches/v12_0/update_price_list_currency_in_bom.py
index f5e7b94..09f0707 100644
--- a/erpnext/patches/v12_0/update_price_list_currency_in_bom.py
+++ b/erpnext/patches/v12_0/update_price_list_currency_in_bom.py
@@ -28,4 +28,4 @@
 			plc_conversion_rate = get_exchange_rate(d.currency,
 				d.company_currency, getdate(d.creation), "for_buying")
 
-			frappe.db.set_value("BOM", d.name, "plc_conversion_rate", plc_conversion_rate)
\ No newline at end of file
+			frappe.db.set_value("BOM", d.name, "plc_conversion_rate", plc_conversion_rate)
diff --git a/erpnext/patches/v12_0/update_state_code_for_daman_and_diu.py b/erpnext/patches/v12_0/update_state_code_for_daman_and_diu.py
index 7450e9c..8dbfa18 100644
--- a/erpnext/patches/v12_0/update_state_code_for_daman_and_diu.py
+++ b/erpnext/patches/v12_0/update_state_code_for_daman_and_diu.py
@@ -19,4 +19,4 @@
 			gst_state = 'Dadra and Nagar Haveli and Daman and Diu',
 			gst_state_number = 26
 		WHERE gst_state = 'Daman and Diu'
-	""")
\ No newline at end of file
+	""")
diff --git a/erpnext/patches/v12_0/update_uom_conversion_factor.py b/erpnext/patches/v12_0/update_uom_conversion_factor.py
index b5a20aa..24914fd 100644
--- a/erpnext/patches/v12_0/update_uom_conversion_factor.py
+++ b/erpnext/patches/v12_0/update_uom_conversion_factor.py
@@ -8,4 +8,4 @@
 	frappe.reload_doc("setup", "doctype", "UOM")
 	frappe.reload_doc("stock", "doctype", "UOM Category")
 
-	add_uom_data()
\ No newline at end of file
+	add_uom_data()
diff --git a/erpnext/patches/v13_0/add_doctype_to_sla.py b/erpnext/patches/v13_0/add_doctype_to_sla.py
index e2c7fd2..cdc5a1e 100644
--- a/erpnext/patches/v13_0/add_doctype_to_sla.py
+++ b/erpnext/patches/v13_0/add_doctype_to_sla.py
@@ -18,4 +18,4 @@
 		agreement.apply_sla_for_resolution = 1
 		agreement.append('sla_fulfilled_on', {'status': 'Resolved'})
 		agreement.append('sla_fulfilled_on', {'status': 'Closed'})
-		agreement.save()
\ No newline at end of file
+		agreement.save()
diff --git a/erpnext/patches/v13_0/add_naming_series_to_old_projects.py b/erpnext/patches/v13_0/add_naming_series_to_old_projects.py
index 5ed9040..a7b66f0 100644
--- a/erpnext/patches/v13_0/add_naming_series_to_old_projects.py
+++ b/erpnext/patches/v13_0/add_naming_series_to_old_projects.py
@@ -10,4 +10,3 @@
 			naming_series = 'PROJ-.####'
 		WHERE
 			naming_series is NULL""")
-
diff --git a/erpnext/patches/v13_0/change_default_pos_print_format.py b/erpnext/patches/v13_0/change_default_pos_print_format.py
index 605a29e..1e4f383 100644
--- a/erpnext/patches/v13_0/change_default_pos_print_format.py
+++ b/erpnext/patches/v13_0/change_default_pos_print_format.py
@@ -5,4 +5,4 @@
 	frappe.db.sql(
 		"""UPDATE `tabPOS Profile` profile
 		SET profile.`print_format` = 'POS Invoice'
-		WHERE profile.`print_format` = 'Point of Sale'""")
\ No newline at end of file
+		WHERE profile.`print_format` = 'Point of Sale'""")
diff --git a/erpnext/patches/v13_0/check_is_income_tax_component.py b/erpnext/patches/v13_0/check_is_income_tax_component.py
index c92d52d..ebae3ad 100644
--- a/erpnext/patches/v13_0/check_is_income_tax_component.py
+++ b/erpnext/patches/v13_0/check_is_income_tax_component.py
@@ -43,4 +43,4 @@
 		if frappe.db.exists("Salary Component", "Provident Fund"):
 			frappe.db.set_value("Salary Component", "Provident Fund", "component_type", "Provident Fund")
 		if frappe.db.exists("Salary Component", "Professional Tax"):
-			frappe.db.set_value("Salary Component", "Professional Tax", "component_type", "Professional Tax")
\ No newline at end of file
+			frappe.db.set_value("Salary Component", "Professional Tax", "component_type", "Professional Tax")
diff --git a/erpnext/patches/v13_0/convert_qi_parameter_to_link_field.py b/erpnext/patches/v13_0/convert_qi_parameter_to_link_field.py
index 289b6a7..341955a 100644
--- a/erpnext/patches/v13_0/convert_qi_parameter_to_link_field.py
+++ b/erpnext/patches/v13_0/convert_qi_parameter_to_link_field.py
@@ -20,4 +20,4 @@
 				"doctype": "Quality Inspection Parameter",
 				"parameter": parameter,
 				"description": parameter
-			}).insert(ignore_permissions=True)
\ No newline at end of file
+			}).insert(ignore_permissions=True)
diff --git a/erpnext/patches/v13_0/create_healthcare_custom_fields_in_stock_entry_detail.py b/erpnext/patches/v13_0/create_healthcare_custom_fields_in_stock_entry_detail.py
index 585e540..08d4876 100644
--- a/erpnext/patches/v13_0/create_healthcare_custom_fields_in_stock_entry_detail.py
+++ b/erpnext/patches/v13_0/create_healthcare_custom_fields_in_stock_entry_detail.py
@@ -7,4 +7,4 @@
 		return
 
 	if data['custom_fields']:
-		create_custom_fields(data['custom_fields'])
\ No newline at end of file
+		create_custom_fields(data['custom_fields'])
diff --git a/erpnext/patches/v13_0/create_leave_policy_assignment_based_on_employee_current_leave_policy.py b/erpnext/patches/v13_0/create_leave_policy_assignment_based_on_employee_current_leave_policy.py
index 90dc0e2..9a35453 100644
--- a/erpnext/patches/v13_0/create_leave_policy_assignment_based_on_employee_current_leave_policy.py
+++ b/erpnext/patches/v13_0/create_leave_policy_assignment_based_on_employee_current_leave_policy.py
@@ -74,6 +74,3 @@
 
 def get_employee_with_grade(grade):
     return frappe.get_list("Employee", filters = {"grade": grade})
-
-
-
diff --git a/erpnext/patches/v13_0/create_uae_pos_invoice_fields.py b/erpnext/patches/v13_0/create_uae_pos_invoice_fields.py
index 59b2e49..6ad3402 100644
--- a/erpnext/patches/v13_0/create_uae_pos_invoice_fields.py
+++ b/erpnext/patches/v13_0/create_uae_pos_invoice_fields.py
@@ -15,4 +15,4 @@
 	frappe.reload_doc('accounts', 'doctype', 'pos_invoice')
 	frappe.reload_doc('accounts', 'doctype', 'pos_invoice_item')
 
-	make_custom_fields()
\ No newline at end of file
+	make_custom_fields()
diff --git a/erpnext/patches/v13_0/delete_old_purchase_reports.py b/erpnext/patches/v13_0/delete_old_purchase_reports.py
index 8bdc07e..c17aad0 100644
--- a/erpnext/patches/v13_0/delete_old_purchase_reports.py
+++ b/erpnext/patches/v13_0/delete_old_purchase_reports.py
@@ -20,4 +20,4 @@
 	""" Check for one or multiple Auto Email Reports and delete """
 	auto_email_reports = frappe.db.get_values("Auto Email Report", {"report": report}, ["name"])
 	for auto_email_report in auto_email_reports:
-		frappe.delete_doc("Auto Email Report", auto_email_report[0])
\ No newline at end of file
+		frappe.delete_doc("Auto Email Report", auto_email_report[0])
diff --git a/erpnext/patches/v13_0/delete_old_sales_reports.py b/erpnext/patches/v13_0/delete_old_sales_reports.py
index 0f44865..671c012 100644
--- a/erpnext/patches/v13_0/delete_old_sales_reports.py
+++ b/erpnext/patches/v13_0/delete_old_sales_reports.py
@@ -18,4 +18,4 @@
 	""" Check for one or multiple Auto Email Reports and delete """
 	auto_email_reports = frappe.db.get_values("Auto Email Report", {"report": report}, ["name"])
 	for auto_email_report in auto_email_reports:
-		frappe.delete_doc("Auto Email Report", auto_email_report[0])
\ No newline at end of file
+		frappe.delete_doc("Auto Email Report", auto_email_report[0])
diff --git a/erpnext/patches/v13_0/delete_orphaned_tables.py b/erpnext/patches/v13_0/delete_orphaned_tables.py
index 1d6eebe..50a4a0e 100644
--- a/erpnext/patches/v13_0/delete_orphaned_tables.py
+++ b/erpnext/patches/v13_0/delete_orphaned_tables.py
@@ -28,9 +28,9 @@
 def get_child_doctypes_whose_parent_doctypes_were_affected():
     parent_doctypes = get_affected_doctypes()
     child_doctypes = frappe.get_all(
-        'DocField', 
+        'DocField',
         filters={
-            'fieldtype': 'Table', 
+            'fieldtype': 'Table',
             'parent':['in', parent_doctypes]
         }, pluck='options')
 
@@ -39,7 +39,7 @@
 def get_affected_doctypes():
     affected_doctypes = []
     tdr_docs = frappe.get_all('Transaction Deletion Record', pluck="name")
-    
+
     for tdr in tdr_docs:
         tdr_doc = frappe.get_doc("Transaction Deletion Record", tdr)
 
@@ -66,4 +66,4 @@
     parent_creation_time = frappe.db.get_value(doc['parenttype'], doc['parent'], 'creation')
     child_creation_time = doc['creation']
 
-    return getdate(parent_creation_time) > getdate(child_creation_time)
\ No newline at end of file
+    return getdate(parent_creation_time) > getdate(child_creation_time)
diff --git a/erpnext/patches/v13_0/delete_report_requested_items_to_order.py b/erpnext/patches/v13_0/delete_report_requested_items_to_order.py
index 94a9fa8..8d6340d 100644
--- a/erpnext/patches/v13_0/delete_report_requested_items_to_order.py
+++ b/erpnext/patches/v13_0/delete_report_requested_items_to_order.py
@@ -9,4 +9,4 @@
 	frappe.db.sql("""
 		DELETE FROM `tabReport`
 		WHERE name = 'Requested Items to Order'
-	""")
\ No newline at end of file
+	""")
diff --git a/erpnext/patches/v13_0/drop_razorpay_payload_column.py b/erpnext/patches/v13_0/drop_razorpay_payload_column.py
index 8980fd0..76b8041 100644
--- a/erpnext/patches/v13_0/drop_razorpay_payload_column.py
+++ b/erpnext/patches/v13_0/drop_razorpay_payload_column.py
@@ -4,4 +4,4 @@
 def execute():
 	if frappe.db.exists("DocType", "Membership"):
 		if 'webhook_payload' in frappe.db.get_table_columns("Membership"):
-			frappe.db.sql("alter table `tabMembership` drop column webhook_payload")
\ No newline at end of file
+			frappe.db.sql("alter table `tabMembership` drop column webhook_payload")
diff --git a/erpnext/patches/v13_0/einvoicing_deprecation_warning.py b/erpnext/patches/v13_0/einvoicing_deprecation_warning.py
new file mode 100644
index 0000000..e123a55
--- /dev/null
+++ b/erpnext/patches/v13_0/einvoicing_deprecation_warning.py
@@ -0,0 +1,9 @@
+import click
+
+
+def execute():
+	click.secho(
+		"Indian E-Invoicing integration is moved to a separate app and will be removed from ERPNext in version-14.\n"
+		"Please install the app to continue using the integration: https://github.com/frappe/erpnext_gst_compliance",
+		fg="yellow",
+	)
diff --git a/erpnext/patches/v13_0/fix_non_unique_represents_company.py b/erpnext/patches/v13_0/fix_non_unique_represents_company.py
index 61dc824..f20c73a 100644
--- a/erpnext/patches/v13_0/fix_non_unique_represents_company.py
+++ b/erpnext/patches/v13_0/fix_non_unique_represents_company.py
@@ -5,4 +5,4 @@
 		update tabCustomer
 		set represents_company = NULL
 		where represents_company = ''
-	""")
\ No newline at end of file
+	""")
diff --git a/erpnext/patches/v13_0/germany_fill_debtor_creditor_number.py b/erpnext/patches/v13_0/germany_fill_debtor_creditor_number.py
index 11e1e9b..dca43b4 100644
--- a/erpnext/patches/v13_0/germany_fill_debtor_creditor_number.py
+++ b/erpnext/patches/v13_0/germany_fill_debtor_creditor_number.py
@@ -12,7 +12,7 @@
 	German companies used to use a dedicated payable/receivable account for
 	every party to mimick party accounts in the external accounting software
 	"DATEV". This is no longer necessary. The reference ID for DATEV will be
-	stored in a new custom field "debtor_creditor_number". 
+	stored in a new custom field "debtor_creditor_number".
 	"""
 	company_list = frappe.get_all('Company', filters={'country': 'Germany'})
 
diff --git a/erpnext/patches/v13_0/item_reposting_for_incorrect_sl_and_gl.py b/erpnext/patches/v13_0/item_reposting_for_incorrect_sl_and_gl.py
index 021bb72..c4ad1b7 100644
--- a/erpnext/patches/v13_0/item_reposting_for_incorrect_sl_and_gl.py
+++ b/erpnext/patches/v13_0/item_reposting_for_incorrect_sl_and_gl.py
@@ -67,4 +67,4 @@
 
 def get_creation_time():
 	return frappe.db.sql(''' SELECT create_time FROM
-		INFORMATION_SCHEMA.TABLES where TABLE_NAME = "tabRepost Item Valuation" ''', as_list=1)[0][0]
\ No newline at end of file
+		INFORMATION_SCHEMA.TABLES where TABLE_NAME = "tabRepost Item Valuation" ''', as_list=1)[0][0]
diff --git a/erpnext/patches/v13_0/loyalty_points_entry_for_pos_invoice.py b/erpnext/patches/v13_0/loyalty_points_entry_for_pos_invoice.py
index ee77340..d2228c3 100644
--- a/erpnext/patches/v13_0/loyalty_points_entry_for_pos_invoice.py
+++ b/erpnext/patches/v13_0/loyalty_points_entry_for_pos_invoice.py
@@ -9,7 +9,7 @@
 	'''`sales_invoice` field from loyalty point entry is splitted into `invoice_type` & `invoice` fields'''
 
 	frappe.reload_doc("Accounts", "doctype", "loyalty_point_entry")
-	
+
 	if not frappe.db.has_column('Loyalty Point Entry', 'sales_invoice'):
 		return
 
@@ -17,4 +17,4 @@
 		"""UPDATE `tabLoyalty Point Entry` lpe
 		SET lpe.`invoice_type` = 'Sales Invoice', lpe.`invoice` = lpe.`sales_invoice`
 		WHERE lpe.`sales_invoice` IS NOT NULL
-		AND (lpe.`invoice` IS NULL OR lpe.`invoice` = '')""")
\ No newline at end of file
+		AND (lpe.`invoice` IS NULL OR lpe.`invoice` = '')""")
diff --git a/erpnext/patches/v13_0/make_non_standard_user_type.py b/erpnext/patches/v13_0/make_non_standard_user_type.py
index a9d7883..73361f0 100644
--- a/erpnext/patches/v13_0/make_non_standard_user_type.py
+++ b/erpnext/patches/v13_0/make_non_standard_user_type.py
@@ -21,4 +21,4 @@
 	frappe.flags.ignore_select_perm = True
 	frappe.flags.update_select_perm_after_migrate = True
 
-	add_non_standard_user_types()
\ No newline at end of file
+	add_non_standard_user_types()
diff --git a/erpnext/patches/v13_0/move_branch_code_to_bank_account.py b/erpnext/patches/v13_0/move_branch_code_to_bank_account.py
index 833ae2a..24d9196 100644
--- a/erpnext/patches/v13_0/move_branch_code_to_bank_account.py
+++ b/erpnext/patches/v13_0/move_branch_code_to_bank_account.py
@@ -14,4 +14,4 @@
 		frappe.db.sql("""UPDATE `tabBank` b, `tabBank Account` ba
 			SET ba.branch_code = b.branch_code
 			WHERE ba.bank = b.name AND
-			ifnull(b.branch_code, '') != '' AND ifnull(ba.branch_code, '') = ''""")
\ No newline at end of file
+			ifnull(b.branch_code, '') != '' AND ifnull(ba.branch_code, '') = ''""")
diff --git a/erpnext/patches/v13_0/patch_to_fix_reverse_linking_in_additional_salary_encashment_and_incentive.py b/erpnext/patches/v13_0/patch_to_fix_reverse_linking_in_additional_salary_encashment_and_incentive.py
index fde8f86..15aeb76 100644
--- a/erpnext/patches/v13_0/patch_to_fix_reverse_linking_in_additional_salary_encashment_and_incentive.py
+++ b/erpnext/patches/v13_0/patch_to_fix_reverse_linking_in_additional_salary_encashment_and_incentive.py
@@ -51,4 +51,3 @@
 					and parent = %s
 					and salary_component = %s
 			""", (salary["name"], comp_type, salary["salary_slip"], salary["salary_component"]))
-
diff --git a/erpnext/patches/v13_0/rename_issue_status_hold_to_on_hold.py b/erpnext/patches/v13_0/rename_issue_status_hold_to_on_hold.py
index 48325fc..4ef04ad 100644
--- a/erpnext/patches/v13_0/rename_issue_status_hold_to_on_hold.py
+++ b/erpnext/patches/v13_0/rename_issue_status_hold_to_on_hold.py
@@ -17,4 +17,4 @@
 			status = 'On Hold'
 		WHERE
 			status = 'Hold'
-	""")
\ No newline at end of file
+	""")
diff --git a/erpnext/patches/v13_0/rename_membership_settings_to_non_profit_settings.py b/erpnext/patches/v13_0/rename_membership_settings_to_non_profit_settings.py
index 3fa09a7..f60567b 100644
--- a/erpnext/patches/v13_0/rename_membership_settings_to_non_profit_settings.py
+++ b/erpnext/patches/v13_0/rename_membership_settings_to_non_profit_settings.py
@@ -19,4 +19,4 @@
 		}
 
 		for old_name, new_name in rename_fields_map.items():
-			rename_field("Non Profit Settings", old_name, new_name)
\ No newline at end of file
+			rename_field("Non Profit Settings", old_name, new_name)
diff --git a/erpnext/patches/v13_0/replace_pos_page_with_point_of_sale_page.py b/erpnext/patches/v13_0/replace_pos_page_with_point_of_sale_page.py
index 390e217..d8bcd7f 100644
--- a/erpnext/patches/v13_0/replace_pos_page_with_point_of_sale_page.py
+++ b/erpnext/patches/v13_0/replace_pos_page_with_point_of_sale_page.py
@@ -3,4 +3,4 @@
 
 def execute():
 	if frappe.db.exists("Page", "point-of-sale"):
-		frappe.rename_doc("Page", "pos", "point-of-sale", 1, 1)
\ No newline at end of file
+		frappe.rename_doc("Page", "pos", "point-of-sale", 1, 1)
diff --git a/erpnext/patches/v13_0/replace_pos_payment_mode_table.py b/erpnext/patches/v13_0/replace_pos_payment_mode_table.py
index 7cb2648..bc1fc98 100644
--- a/erpnext/patches/v13_0/replace_pos_payment_mode_table.py
+++ b/erpnext/patches/v13_0/replace_pos_payment_mode_table.py
@@ -23,5 +23,5 @@
 				pos_payment_method.parentfield = payment_mode.parentfield
 				pos_payment_method.parenttype = payment_mode.parenttype
 				pos_payment_method.db_insert()
-		
+
 		frappe.db.sql("""delete from `tabSales Invoice Payment` where parent=%s""", pos_profile.name)
diff --git a/erpnext/patches/v13_0/set_company_in_leave_ledger_entry.py b/erpnext/patches/v13_0/set_company_in_leave_ledger_entry.py
index 66857c4..13ec41e 100644
--- a/erpnext/patches/v13_0/set_company_in_leave_ledger_entry.py
+++ b/erpnext/patches/v13_0/set_company_in_leave_ledger_entry.py
@@ -4,4 +4,4 @@
 	frappe.reload_doc('HR', 'doctype', 'Leave Allocation')
 	frappe.reload_doc('HR', 'doctype', 'Leave Ledger Entry')
 	frappe.db.sql("""update `tabLeave Ledger Entry` as lle set company = (select company from `tabEmployee` where employee = lle.employee)""")
-	frappe.db.sql("""update `tabLeave Allocation` as la set company = (select company from `tabEmployee` where employee = la.employee)""")
\ No newline at end of file
+	frappe.db.sql("""update `tabLeave Allocation` as la set company = (select company from `tabEmployee` where employee = la.employee)""")
diff --git a/erpnext/patches/v13_0/set_payment_channel_in_payment_gateway_account.py b/erpnext/patches/v13_0/set_payment_channel_in_payment_gateway_account.py
index edca238..7f75946 100644
--- a/erpnext/patches/v13_0/set_payment_channel_in_payment_gateway_account.py
+++ b/erpnext/patches/v13_0/set_payment_channel_in_payment_gateway_account.py
@@ -14,4 +14,4 @@
 	frappe.db.sql("""
 		UPDATE `tabPayment Gateway Account`
 		SET `payment_channel` = "Email"
-	""")
\ No newline at end of file
+	""")
diff --git a/erpnext/patches/v13_0/set_pos_closing_as_failed.py b/erpnext/patches/v13_0/set_pos_closing_as_failed.py
index 1c576db..7968e74 100644
--- a/erpnext/patches/v13_0/set_pos_closing_as_failed.py
+++ b/erpnext/patches/v13_0/set_pos_closing_as_failed.py
@@ -4,4 +4,4 @@
 def execute():
     frappe.reload_doc('accounts', 'doctype', 'pos_closing_entry')
 
-    frappe.db.sql("update `tabPOS Closing Entry` set `status` = 'Failed' where `status` = 'Queued'")
\ No newline at end of file
+    frappe.db.sql("update `tabPOS Closing Entry` set `status` = 'Failed' where `status` = 'Queued'")
diff --git a/erpnext/patches/v13_0/set_training_event_attendance.py b/erpnext/patches/v13_0/set_training_event_attendance.py
index 18cad8d..3db183f 100644
--- a/erpnext/patches/v13_0/set_training_event_attendance.py
+++ b/erpnext/patches/v13_0/set_training_event_attendance.py
@@ -6,4 +6,4 @@
     frappe.reload_doc('hr', 'doctype', 'training_event_employee')
 
     frappe.db.sql("update `tabTraining Event Employee` set `attendance` = 'Present'")
-    frappe.db.sql("update `tabTraining Event Employee` set `is_mandatory` = 1 where `attendance` = 'Mandatory'")
\ No newline at end of file
+    frappe.db.sql("update `tabTraining Event Employee` set `is_mandatory` = 1 where `attendance` = 'Mandatory'")
diff --git a/erpnext/patches/v13_0/set_youtube_video_id.py b/erpnext/patches/v13_0/set_youtube_video_id.py
index c3b49eb..f6104d1 100644
--- a/erpnext/patches/v13_0/set_youtube_video_id.py
+++ b/erpnext/patches/v13_0/set_youtube_video_id.py
@@ -7,4 +7,4 @@
 
 	for video in frappe.get_all("Video", fields=["name", "url", "youtube_video_id"]):
 		if video.url and not video.youtube_video_id:
-			frappe.db.set_value("Video", video.name, "youtube_video_id", get_id_from_url(video.url))
\ No newline at end of file
+			frappe.db.set_value("Video", video.name, "youtube_video_id", get_id_from_url(video.url))
diff --git a/erpnext/patches/v13_0/setting_custom_roles_for_some_regional_reports.py b/erpnext/patches/v13_0/setting_custom_roles_for_some_regional_reports.py
index ecc7822..c8c160f 100644
--- a/erpnext/patches/v13_0/setting_custom_roles_for_some_regional_reports.py
+++ b/erpnext/patches/v13_0/setting_custom_roles_for_some_regional_reports.py
@@ -7,4 +7,4 @@
     if not company:
         return
 
-    add_custom_roles_for_reports()
\ No newline at end of file
+    add_custom_roles_for_reports()
diff --git a/erpnext/patches/v13_0/setup_patient_history_settings_for_standard_doctypes.py b/erpnext/patches/v13_0/setup_patient_history_settings_for_standard_doctypes.py
index d927524..83581dd 100644
--- a/erpnext/patches/v13_0/setup_patient_history_settings_for_standard_doctypes.py
+++ b/erpnext/patches/v13_0/setup_patient_history_settings_for_standard_doctypes.py
@@ -13,4 +13,4 @@
 	frappe.reload_doc("healthcare", "doctype", "Patient History Standard Document Type")
 	frappe.reload_doc("healthcare", "doctype", "Patient History Custom Document Type")
 
-	setup_patient_history_settings()
\ No newline at end of file
+	setup_patient_history_settings()
diff --git a/erpnext/patches/v13_0/stock_entry_enhancements.py b/erpnext/patches/v13_0/stock_entry_enhancements.py
index 0bdcc9c..7b93ce3 100644
--- a/erpnext/patches/v13_0/stock_entry_enhancements.py
+++ b/erpnext/patches/v13_0/stock_entry_enhancements.py
@@ -8,18 +8,18 @@
     frappe.reload_doc("stock", "doctype", "stock_entry")
     if frappe.db.has_column("Stock Entry", "add_to_transit"):
         frappe.db.sql("""
-            UPDATE `tabStock Entry` SET 
+            UPDATE `tabStock Entry` SET
             stock_entry_type = 'Material Transfer',
             purpose = 'Material Transfer',
             add_to_transit = 1 WHERE stock_entry_type = 'Send to Warehouse'
             """)
 
-        frappe.db.sql("""UPDATE `tabStock Entry` SET 
+        frappe.db.sql("""UPDATE `tabStock Entry` SET
             stock_entry_type = 'Material Transfer',
             purpose = 'Material Transfer'
             WHERE stock_entry_type = 'Receive at Warehouse'
             """)
-        
+
         frappe.reload_doc("stock", "doctype", "warehouse_type")
         if not frappe.db.exists('Warehouse Type', 'Transit'):
             doc = frappe.new_doc('Warehouse Type')
@@ -28,4 +28,4 @@
 
         frappe.reload_doc("stock", "doctype", "stock_entry_type")
         frappe.delete_doc_if_exists("Stock Entry Type", "Send to Warehouse")
-        frappe.delete_doc_if_exists("Stock Entry Type", "Receive at Warehouse")
\ No newline at end of file
+        frappe.delete_doc_if_exists("Stock Entry Type", "Receive at Warehouse")
diff --git a/erpnext/patches/v13_0/update_actual_start_and_end_date_in_wo.py b/erpnext/patches/v13_0/update_actual_start_and_end_date_in_wo.py
index adfa20e..50f233d 100644
--- a/erpnext/patches/v13_0/update_actual_start_and_end_date_in_wo.py
+++ b/erpnext/patches/v13_0/update_actual_start_and_end_date_in_wo.py
@@ -38,4 +38,4 @@
 			jc.production_item = wo.production_item, jc.item_name = wo.item_name
 		WHERE
 			jc.work_order = wo.name and IFNULL(jc.production_item, "") = ""
-	""")
\ No newline at end of file
+	""")
diff --git a/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py b/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py
index eae5ff6..dc9ed18 100644
--- a/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py
+++ b/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py
@@ -7,4 +7,3 @@
 	frappe.reload_doc("manufacturing", "doctype", "work_order_item")
 
 	frappe.db.sql("""UPDATE `tabWork Order Item` SET amount = rate * required_qty""")
-
diff --git a/erpnext/patches/v13_0/update_deferred_settings.py b/erpnext/patches/v13_0/update_deferred_settings.py
index a7d8207..bcc0952 100644
--- a/erpnext/patches/v13_0/update_deferred_settings.py
+++ b/erpnext/patches/v13_0/update_deferred_settings.py
@@ -8,4 +8,4 @@
 	accounts_settings.book_deferred_entries_based_on = 'Days'
 	accounts_settings.book_deferred_entries_via_journal_entry = 0
 	accounts_settings.submit_journal_entries = 0
-	accounts_settings.save()
\ No newline at end of file
+	accounts_settings.save()
diff --git a/erpnext/patches/v13_0/update_export_type_for_gst.py b/erpnext/patches/v13_0/update_export_type_for_gst.py
index 3e20212..ef70b55 100644
--- a/erpnext/patches/v13_0/update_export_type_for_gst.py
+++ b/erpnext/patches/v13_0/update_export_type_for_gst.py
@@ -8,7 +8,7 @@
 	# Update custom fields
 	fieldname = frappe.db.get_value('Custom Field', {'dt': 'Customer', 'fieldname': 'export_type'})
 	if fieldname:
-		frappe.db.set_value('Custom Field', fieldname, 
+		frappe.db.set_value('Custom Field', fieldname,
 			{
 				'default': '',
 				'mandatory_depends_on': 'eval:in_list(["SEZ", "Overseas", "Deemed Export"], doc.gst_category)'
@@ -16,7 +16,7 @@
 
 	fieldname = frappe.db.get_value('Custom Field', {'dt': 'Supplier', 'fieldname': 'export_type'})
 	if fieldname:
-		frappe.db.set_value('Custom Field', fieldname, 
+		frappe.db.set_value('Custom Field', fieldname,
 			{
 				'default': '',
 				'mandatory_depends_on': 'eval:in_list(["SEZ", "Overseas"], doc.gst_category)'
@@ -29,4 +29,4 @@
 
 	frappe.db.sql("""
 		UPDATE `tabSupplier` set export_type = '' WHERE gst_category NOT IN ('SEZ', 'Overseas')
-	""")
\ No newline at end of file
+	""")
diff --git a/erpnext/patches/v13_0/update_job_card_details.py b/erpnext/patches/v13_0/update_job_card_details.py
index d4e65c6..733b3a9 100644
--- a/erpnext/patches/v13_0/update_job_card_details.py
+++ b/erpnext/patches/v13_0/update_job_card_details.py
@@ -13,4 +13,4 @@
 		SET	jc.hour_rate =  wo.hour_rate
 		WHERE
 			jc.operation_id = wo.name and jc.docstatus < 2 and wo.hour_rate > 0
-	""")
\ No newline at end of file
+	""")
diff --git a/erpnext/patches/v13_0/update_project_template_tasks.py b/erpnext/patches/v13_0/update_project_template_tasks.py
index 8cc27d2..b41b742 100644
--- a/erpnext/patches/v13_0/update_project_template_tasks.py
+++ b/erpnext/patches/v13_0/update_project_template_tasks.py
@@ -44,4 +44,4 @@
 					"task": tsk.name,
 					"subject": tsk.subject
 				})
-			template.save()
\ No newline at end of file
+			template.save()
diff --git a/erpnext/patches/v13_0/update_reason_for_resignation_in_employee.py b/erpnext/patches/v13_0/update_reason_for_resignation_in_employee.py
index 792118f..ccdc334 100644
--- a/erpnext/patches/v13_0/update_reason_for_resignation_in_employee.py
+++ b/erpnext/patches/v13_0/update_reason_for_resignation_in_employee.py
@@ -12,4 +12,3 @@
             SET reason_for_leaving = reason_for_resignation
             WHERE status = 'Left' and reason_for_leaving is null and reason_for_resignation is not null
         """)
-
diff --git a/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py b/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py
index 7f42cd9..e642547 100644
--- a/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py
+++ b/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py
@@ -1,8 +1,7 @@
-# Copyright (c) 2019, Frappe and Contributors
+# Copyright (c) 2021, Frappe and Contributors
 # License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
 import frappe
+from erpnext.controllers.status_updater import OverAllowanceError
 
 def execute():
 	frappe.reload_doc('stock', 'doctype', 'purchase_receipt')
@@ -14,9 +13,15 @@
 		for return_doc in frappe.get_all(doctype, filters={'is_return' : 1, 'docstatus' : 1}):
 			# Update original receipt/delivery document from return
 			return_doc = frappe.get_cached_doc(doctype, return_doc.name)
-			return_doc.update_prevdoc_status()
+			try:
+				return_doc.update_prevdoc_status()
+			except OverAllowanceError:
+				frappe.db.rollback()
+				continue
+
 			return_against = frappe.get_doc(doctype, return_doc.return_against)
 			return_against.update_billing_status()
+			frappe.db.commit()
 
 	# Set received qty in stock uom in PR, as returned qty is checked against it
 	frappe.db.sql(""" update `tabPurchase Receipt Item`
@@ -24,4 +29,4 @@
 		where docstatus = 1 """)
 
 	for doctype in ('Purchase Receipt', 'Delivery Note'):
-		update_from_return_docs(doctype)
\ No newline at end of file
+		update_from_return_docs(doctype)
diff --git a/erpnext/patches/v13_0/update_subscription.py b/erpnext/patches/v13_0/update_subscription.py
index 871ebf1..d25e9c8 100644
--- a/erpnext/patches/v13_0/update_subscription.py
+++ b/erpnext/patches/v13_0/update_subscription.py
@@ -38,4 +38,4 @@
 			UPDATE `tabSubscription Plan`
 			SET price_determination = %s
 			WHERE price_determination = %s
-		""", (value, key))
\ No newline at end of file
+		""", (value, key))
diff --git a/erpnext/patches/v13_0/update_subscription_status_in_memberships.py b/erpnext/patches/v13_0/update_subscription_status_in_memberships.py
index 28e650e..d9c3e45 100644
--- a/erpnext/patches/v13_0/update_subscription_status_in_memberships.py
+++ b/erpnext/patches/v13_0/update_subscription_status_in_memberships.py
@@ -6,4 +6,4 @@
 
 		if frappe.db.has_column('Member', 'subscription_activated'):
 			frappe.db.sql('UPDATE `tabMember` SET subscription_status = "Active" WHERE subscription_activated = 1')
-			frappe.db.sql_ddl('ALTER table `tabMember` DROP COLUMN subscription_activated')
\ No newline at end of file
+			frappe.db.sql_ddl('ALTER table `tabMember` DROP COLUMN subscription_activated')
diff --git a/erpnext/patches/v13_0/update_tds_check_field.py b/erpnext/patches/v13_0/update_tds_check_field.py
index 3d14958..341b0e8 100644
--- a/erpnext/patches/v13_0/update_tds_check_field.py
+++ b/erpnext/patches/v13_0/update_tds_check_field.py
@@ -6,4 +6,4 @@
 		frappe.db.sql("""
 			UPDATE `tabTax Withholding Category` set round_off_tax_amount = 0
 			WHERE round_off_tax_amount IS NULL
-		""")
\ No newline at end of file
+		""")
diff --git a/erpnext/patches/v13_0/update_timesheet_changes.py b/erpnext/patches/v13_0/update_timesheet_changes.py
index 93b7f8e..a36c84e 100644
--- a/erpnext/patches/v13_0/update_timesheet_changes.py
+++ b/erpnext/patches/v13_0/update_timesheet_changes.py
@@ -22,4 +22,4 @@
 			exchange_rate = 1.0,
 			base_total_billable_amount = total_billable_amount,
 			base_total_billed_amount = total_billed_amount,
-			base_total_costing_amount = total_costing_amount""".format(base_currency))
\ No newline at end of file
+			base_total_costing_amount = total_costing_amount""".format(base_currency))
diff --git a/erpnext/patches/v13_0/updates_for_multi_currency_payroll.py b/erpnext/patches/v13_0/updates_for_multi_currency_payroll.py
index 340bf49..7d344f9 100644
--- a/erpnext/patches/v13_0/updates_for_multi_currency_payroll.py
+++ b/erpnext/patches/v13_0/updates_for_multi_currency_payroll.py
@@ -96,8 +96,8 @@
 
 		# update currency in following doctypes based on company currency
 		doctypes_for_currency = ['Employee Advance', 'Leave Encashment', 'Employee Benefit Application',
-			'Employee Benefit Claim', 'Employee Incentive', 'Additional Salary', 
-			'Employee Tax Exemption Declaration', 'Employee Tax Exemption Proof Submission', 
+			'Employee Benefit Claim', 'Employee Incentive', 'Additional Salary',
+			'Employee Tax Exemption Declaration', 'Employee Tax Exemption Proof Submission',
 			'Income Tax Slab', 'Retention Bonus', 'Salary Structure']
 
 		for dt in doctypes_for_currency:
diff --git a/erpnext/regional/india/e_invoice/__init__.py b/erpnext/patches/v14_0/__init__.py
similarity index 100%
rename from erpnext/regional/india/e_invoice/__init__.py
rename to erpnext/patches/v14_0/__init__.py
diff --git a/erpnext/patches/v14_0/delete_einvoicing_doctypes.py b/erpnext/patches/v14_0/delete_einvoicing_doctypes.py
new file mode 100644
index 0000000..b77d244
--- /dev/null
+++ b/erpnext/patches/v14_0/delete_einvoicing_doctypes.py
@@ -0,0 +1,9 @@
+import frappe
+
+def execute():
+	frappe.delete_doc('DocType', 'E Invoice Settings', ignore_missing=True)
+	frappe.delete_doc('DocType', 'E Invoice User', ignore_missing=True)
+	frappe.delete_doc('Report', 'E-Invoice Summary', ignore_missing=True)
+	frappe.delete_doc('Print Format', 'GST E-Invoice', ignore_missing=True)
+	frappe.delete_doc('Custom Field', 'Sales Invoice-eway_bill_cancelled', ignore_missing=True)
+	frappe.delete_doc('Custom Field', 'Sales Invoice-irn_cancelled', ignore_missing=True)
\ No newline at end of file
diff --git a/erpnext/patches/v8_1/removed_roles_from_gst_report_non_indian_account.py b/erpnext/patches/v8_1/removed_roles_from_gst_report_non_indian_account.py
index ccb2e0e..55f5f82 100644
--- a/erpnext/patches/v8_1/removed_roles_from_gst_report_non_indian_account.py
+++ b/erpnext/patches/v8_1/removed_roles_from_gst_report_non_indian_account.py
@@ -15,4 +15,4 @@
 			where
 				parenttype = 'Report' and parent in('GST Sales Register',
 					'GST Purchase Register', 'GST Itemised Sales Register',
-					'GST Itemised Purchase Register', 'Eway Bill')""")
\ No newline at end of file
+					'GST Itemised Purchase Register', 'Eway Bill')""")
diff --git a/erpnext/patches/v8_1/setup_gst_india.py b/erpnext/patches/v8_1/setup_gst_india.py
index e8b017d..c214990 100644
--- a/erpnext/patches/v8_1/setup_gst_india.py
+++ b/erpnext/patches/v8_1/setup_gst_india.py
@@ -50,4 +50,4 @@
 	try:
 		sendmail_to_system_managers("[Important] ERPNext GST updates", message)
 	except Exception as e:
-		pass
\ No newline at end of file
+		pass
diff --git a/erpnext/payroll/doctype/additional_salary/test_additional_salary.py b/erpnext/payroll/doctype/additional_salary/test_additional_salary.py
index 4d47f25..2a9c561 100644
--- a/erpnext/payroll/doctype/additional_salary/test_additional_salary.py
+++ b/erpnext/payroll/doctype/additional_salary/test_additional_salary.py
@@ -27,7 +27,7 @@
 		frappe.db.set_value("Employee", emp_id, "relieving_date", add_days(nowdate(), 1800))
 		salary_structure = make_salary_structure("Test Salary Structure Additional Salary", "Monthly", employee=emp_id)
 		add_sal = get_additional_salary(emp_id)
-		
+
 		ss = make_employee_salary_slip("test_additional@salary.com", "Monthly", salary_structure=salary_structure.name)
 		for earning in ss.earnings:
 			if earning.salary_component == "Recurring Salary Component":
diff --git a/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.py b/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.py
index 5ebe514..c7fbb06 100644
--- a/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.py
+++ b/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.py
@@ -253,4 +253,4 @@
 			order by name
 		""", salary_structure, earning_component)
 
-	return amount if amount else 0
\ No newline at end of file
+	return amount if amount else 0
diff --git a/erpnext/payroll/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.py b/erpnext/payroll/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.py
index a8dd7e4..d3f24c9 100644
--- a/erpnext/payroll/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.py
+++ b/erpnext/payroll/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.py
@@ -13,4 +13,4 @@
 		category_max_amount = frappe.db.get_value("Employee Tax Exemption Category", self.exemption_category, "max_amount")
 		if flt(self.max_amount) > flt(category_max_amount):
 			frappe.throw(_("Max Exemption Amount cannot be greater than maximum exemption amount {0} of Tax Exemption Category {1}")
-				.format(category_max_amount, self.exemption_category))
\ No newline at end of file
+				.format(category_max_amount, self.exemption_category))
diff --git a/erpnext/payroll/doctype/gratuity/gratuity.js b/erpnext/payroll/doctype/gratuity/gratuity.js
index 565d2c4..377f3c6 100644
--- a/erpnext/payroll/doctype/gratuity/gratuity.js
+++ b/erpnext/payroll/doctype/gratuity/gratuity.js
@@ -69,4 +69,4 @@
 		}
 	}
 
-});
\ No newline at end of file
+});
diff --git a/erpnext/payroll/doctype/gratuity/gratuity.py b/erpnext/payroll/doctype/gratuity/gratuity.py
index 1acd6e3..8cb804d 100644
--- a/erpnext/payroll/doctype/gratuity/gratuity.py
+++ b/erpnext/payroll/doctype/gratuity/gratuity.py
@@ -246,4 +246,3 @@
 			"employee": employee, 'docstatus': 1
 		},
 		order_by = "start_date desc")[0].name
-
diff --git a/erpnext/payroll/doctype/gratuity/gratuity_dashboard.py b/erpnext/payroll/doctype/gratuity/gratuity_dashboard.py
index 5b2489f..483e346 100644
--- a/erpnext/payroll/doctype/gratuity/gratuity_dashboard.py
+++ b/erpnext/payroll/doctype/gratuity/gratuity_dashboard.py
@@ -17,4 +17,4 @@
 				'items': ['Additional Salary']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/payroll/doctype/gratuity_rule/gratuity_rule.js b/erpnext/payroll/doctype/gratuity_rule/gratuity_rule.js
index ee6c5df..014a121 100644
--- a/erpnext/payroll/doctype/gratuity_rule/gratuity_rule.js
+++ b/erpnext/payroll/doctype/gratuity_rule/gratuity_rule.js
@@ -37,4 +37,4 @@
 			frappe.throw(__("To(Year) year can not be less than From(year) "));
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/payroll/doctype/gratuity_rule/gratuity_rule_dashboard.py b/erpnext/payroll/doctype/gratuity_rule/gratuity_rule_dashboard.py
index 0d70163..0f27315 100644
--- a/erpnext/payroll/doctype/gratuity_rule/gratuity_rule_dashboard.py
+++ b/erpnext/payroll/doctype/gratuity_rule/gratuity_rule_dashboard.py
@@ -10,4 +10,4 @@
 				'items': ['Gratuity']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/payroll/doctype/payroll_entry/payroll_entry_dashboard.py b/erpnext/payroll/doctype/payroll_entry/payroll_entry_dashboard.py
index 7af507d..0346a7c 100644
--- a/erpnext/payroll/doctype/payroll_entry/payroll_entry_dashboard.py
+++ b/erpnext/payroll/doctype/payroll_entry/payroll_entry_dashboard.py
@@ -13,4 +13,4 @@
 				'items': ['Salary Slip', 'Journal Entry']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/payroll/doctype/payroll_period/payroll_period_dashboard.py b/erpnext/payroll/doctype/payroll_period/payroll_period_dashboard.py
index 4e9c7c9..e332995 100644
--- a/erpnext/payroll/doctype/payroll_period/payroll_period_dashboard.py
+++ b/erpnext/payroll/doctype/payroll_period/payroll_period_dashboard.py
@@ -9,4 +9,4 @@
                 'items': ['Employee Tax Exemption Proof Submission', 'Employee Tax Exemption Declaration']
             },
         ],
-    }
\ No newline at end of file
+    }
diff --git a/erpnext/payroll/doctype/salary_component/salary_component.js b/erpnext/payroll/doctype/salary_component/salary_component.js
index e9e6f81..dbf7514 100644
--- a/erpnext/payroll/doctype/salary_component/salary_component.js
+++ b/erpnext/payroll/doctype/salary_component/salary_component.js
@@ -4,18 +4,11 @@
 frappe.ui.form.on('Salary Component', {
 	setup: function(frm) {
 		frm.set_query("account", "accounts", function(doc, cdt, cdn) {
-			let d = frappe.get_doc(cdt, cdn);
-
-			let root_type = "Liability";
-			if (frm.doc.type == "Deduction") {
-				root_type = "Expense";
-			}
-
+			var d = locals[cdt][cdn];
 			return {
 				filters: {
 					"is_group": 0,
-					"company": d.company,
-					"root_type": root_type
+					"company": d.company
 				}
 			};
 		});
diff --git a/erpnext/payroll/doctype/salary_slip/salary_slip.py b/erpnext/payroll/doctype/salary_slip/salary_slip.py
index bd982cf..5f5fdd5 100644
--- a/erpnext/payroll/doctype/salary_slip/salary_slip.py
+++ b/erpnext/payroll/doctype/salary_slip/salary_slip.py
@@ -680,7 +680,6 @@
 				component_row.set(attr, component_data.get(attr))
 
 		if additional_salary:
-			component_row.is_recurring_additional_salary = is_recurring
 			if additional_salary.overwrite:
 				component_row.additional_amount = flt(flt(amount) - flt(component_row.get("default_amount", 0)),
 					component_row.precision("additional_amount"))
diff --git a/erpnext/payroll/doctype/salary_slip/test_salary_slip.js b/erpnext/payroll/doctype/salary_slip/test_salary_slip.js
index 06a1c7d..a47eba1 100644
--- a/erpnext/payroll/doctype/salary_slip/test_salary_slip.js
+++ b/erpnext/payroll/doctype/salary_slip/test_salary_slip.js
@@ -52,4 +52,4 @@
 		() => frappe.click_button('Yes'),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/payroll/doctype/salary_structure/condition_and_formula_help.html b/erpnext/payroll/doctype/salary_structure/condition_and_formula_help.html
index d07a1ab..0f6cc37 100644
--- a/erpnext/payroll/doctype/salary_structure/condition_and_formula_help.html
+++ b/erpnext/payroll/doctype/salary_structure/condition_and_formula_help.html
@@ -44,4 +44,4 @@
         <pre><code>Condition: annual_taxable_earning > 20000000</code></pre>
         <pre><code>Formula: annual_taxable_earning * 0.10 </code></pre>
     </li>
-</ul>
\ No newline at end of file
+</ul>
diff --git a/erpnext/payroll/doctype/salary_structure/salary_structure.py b/erpnext/payroll/doctype/salary_structure/salary_structure.py
index 58c445f..6dfb3a5 100644
--- a/erpnext/payroll/doctype/salary_structure/salary_structure.py
+++ b/erpnext/payroll/doctype/salary_structure/salary_structure.py
@@ -206,4 +206,3 @@
 			salary_structure, salary_structure))
 
 	return list(set([d.employee for d in employees]))
-
diff --git a/erpnext/payroll/doctype/salary_structure/salary_structure_dashboard.py b/erpnext/payroll/doctype/salary_structure/salary_structure_dashboard.py
index 547f2b8..0159e35 100644
--- a/erpnext/payroll/doctype/salary_structure/salary_structure_dashboard.py
+++ b/erpnext/payroll/doctype/salary_structure/salary_structure_dashboard.py
@@ -15,4 +15,4 @@
 				'items': ['Employee Grade']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.py b/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.py
index a0c3013..5fb3ce2 100644
--- a/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.py
+++ b/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.py
@@ -36,7 +36,7 @@
 	def validate_income_tax_slab(self):
 		if not self.income_tax_slab:
 			return
-		
+
 		income_tax_slab_currency = frappe.db.get_value('Income Tax Slab', self.income_tax_slab, 'currency')
 		if self.currency != income_tax_slab_currency:
 			frappe.throw(_("Currency of selected Income Tax Slab should be {0} instead of {1}").format(self.currency, income_tax_slab_currency))
@@ -69,4 +69,4 @@
 	employee_currency = frappe.db.get_value('Salary Structure Assignment', {'employee': employee}, 'currency')
 	if not employee_currency:
 		frappe.throw(_("There is no Salary Structure assigned to {0}. First assign a Salary Stucture.").format(employee))
-	return employee_currency
\ No newline at end of file
+	return employee_currency
diff --git a/erpnext/payroll/notification/as b/erpnext/payroll/notification/as
index 7a39557..05c2c1b 100644
--- a/erpnext/payroll/notification/as
+++ b/erpnext/payroll/notification/as
@@ -1 +1 @@
-update from `tabNotification` set module='Payroll' where name = "Retention Bonus"
\ No newline at end of file
+update from `tabNotification` set module='Payroll' where name = "Retention Bonus"
diff --git a/erpnext/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json b/erpnext/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json
index ceaf4a6..d5fee6b 100644
--- a/erpnext/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json
+++ b/erpnext/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json
@@ -13,6 +13,6 @@
  "name": "Salary Slip based on Timesheet",
  "owner": "Administrator",
  "print_format_builder": 1,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/payroll/print_format/salary_slip_standard/salary_slip_standard.json b/erpnext/payroll/print_format/salary_slip_standard/salary_slip_standard.json
index b01239f..98a4435 100644
--- a/erpnext/payroll/print_format/salary_slip_standard/salary_slip_standard.json
+++ b/erpnext/payroll/print_format/salary_slip_standard/salary_slip_standard.json
@@ -16,7 +16,7 @@
  "name": "Salary Slip Standard",
  "owner": "Administrator",
  "print_format_builder": 1,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
  "show_section_headings": 0,
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/payroll/report/bank_remittance/bank_remittance.js b/erpnext/payroll/report/bank_remittance/bank_remittance.js
index 6482ed3..8b75b4f 100644
--- a/erpnext/payroll/report/bank_remittance/bank_remittance.js
+++ b/erpnext/payroll/report/bank_remittance/bank_remittance.js
@@ -25,4 +25,3 @@
 
 	]
 }
-
diff --git a/erpnext/payroll/report/income_tax_deductions/income_tax_deductions.js b/erpnext/payroll/report/income_tax_deductions/income_tax_deductions.js
index 4bbb7f6..6ecf2b1 100644
--- a/erpnext/payroll/report/income_tax_deductions/income_tax_deductions.js
+++ b/erpnext/payroll/report/income_tax_deductions/income_tax_deductions.js
@@ -4,4 +4,4 @@
 
 frappe.require("assets/erpnext/js/salary_slip_deductions_report_filters.js", function() {
 	frappe.query_reports["Income Tax Deductions"] = erpnext.salary_slip_deductions_report_filters;
-});
\ No newline at end of file
+});
diff --git a/erpnext/payroll/report/salary_payments_based_on_payment_mode/salary_payments_based_on_payment_mode.js b/erpnext/payroll/report/salary_payments_based_on_payment_mode/salary_payments_based_on_payment_mode.js
index 166d982..9b82954 100644
--- a/erpnext/payroll/report/salary_payments_based_on_payment_mode/salary_payments_based_on_payment_mode.js
+++ b/erpnext/payroll/report/salary_payments_based_on_payment_mode/salary_payments_based_on_payment_mode.js
@@ -4,4 +4,4 @@
 
 frappe.require("assets/erpnext/js/salary_slip_deductions_report_filters.js", function() {
 	frappe.query_reports["Salary Payments Based On Payment Mode"] = erpnext.salary_slip_deductions_report_filters;
-});
\ No newline at end of file
+});
diff --git a/erpnext/portal/doctype/homepage/homepage.py b/erpnext/portal/doctype/homepage/homepage.py
index 4e4d477..54ea7c6 100644
--- a/erpnext/portal/doctype/homepage/homepage.py
+++ b/erpnext/portal/doctype/homepage/homepage.py
@@ -23,4 +23,3 @@
 				doc.save()
 			self.append('products', dict(item_code=d.name,
 				item_name=d.item_name, description=d.description, image=d.image))
-
diff --git a/erpnext/portal/product_configurator/test_product_configurator.py b/erpnext/portal/product_configurator/test_product_configurator.py
index 8aa0734..ec7c83a 100644
--- a/erpnext/portal/product_configurator/test_product_configurator.py
+++ b/erpnext/portal/product_configurator/test_product_configurator.py
@@ -139,4 +139,4 @@
 
 		# teardown
 		doc.delete()
-		item_group_doc.delete()
\ No newline at end of file
+		item_group_doc.delete()
diff --git a/erpnext/projects/doctype/activity_cost/activity_cost.js b/erpnext/projects/doctype/activity_cost/activity_cost.js
index ba10153..2d22caa 100644
--- a/erpnext/projects/doctype/activity_cost/activity_cost.js
+++ b/erpnext/projects/doctype/activity_cost/activity_cost.js
@@ -1 +1 @@
-cur_frm.add_fetch('employee', 'employee_name', 'employee_name');
\ No newline at end of file
+cur_frm.add_fetch('employee', 'employee_name', 'employee_name');
diff --git a/erpnext/projects/doctype/activity_cost/activity_cost.py b/erpnext/projects/doctype/activity_cost/activity_cost.py
index 862a707..99226ea 100644
--- a/erpnext/projects/doctype/activity_cost/activity_cost.py
+++ b/erpnext/projects/doctype/activity_cost/activity_cost.py
@@ -13,7 +13,7 @@
 	def validate(self):
 		self.set_title()
 		self.check_unique()
-		
+
 	def set_title(self):
 		if self.employee:
 			if not self.employee_name:
diff --git a/erpnext/projects/doctype/activity_cost/test_activity_cost.py b/erpnext/projects/doctype/activity_cost/test_activity_cost.py
index 67d76eb..5f35f29 100644
--- a/erpnext/projects/doctype/activity_cost/test_activity_cost.py
+++ b/erpnext/projects/doctype/activity_cost/test_activity_cost.py
@@ -22,4 +22,4 @@
 		activity_cost1.insert()
 		activity_cost2 = frappe.copy_doc(activity_cost1)
 		self.assertRaises(DuplicationError, activity_cost2.insert )
-		frappe.db.sql("delete from `tabActivity Cost`")
\ No newline at end of file
+		frappe.db.sql("delete from `tabActivity Cost`")
diff --git a/erpnext/projects/doctype/activity_type/activity_type.py b/erpnext/projects/doctype/activity_type/activity_type.py
index 8b610c2..50e18ef 100644
--- a/erpnext/projects/doctype/activity_type/activity_type.py
+++ b/erpnext/projects/doctype/activity_type/activity_type.py
@@ -5,4 +5,4 @@
 from frappe.model.document import Document
 
 class ActivityType(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/projects/doctype/activity_type/test_activity_type.py b/erpnext/projects/doctype/activity_type/test_activity_type.py
index 3ea28df..dcb0101 100644
--- a/erpnext/projects/doctype/activity_type/test_activity_type.py
+++ b/erpnext/projects/doctype/activity_type/test_activity_type.py
@@ -4,4 +4,4 @@
 
 
 import frappe
-test_records = frappe.get_test_records('Activity Type')
\ No newline at end of file
+test_records = frappe.get_test_records('Activity Type')
diff --git a/erpnext/projects/doctype/project/project_dashboard.html b/erpnext/projects/doctype/project/project_dashboard.html
index f5bfbb7..1f299e3 100644
--- a/erpnext/projects/doctype/project/project_dashboard.html
+++ b/erpnext/projects/doctype/project/project_dashboard.html
@@ -23,4 +23,4 @@
 		</span>
 	</div>
 </div>
-{% endfor %}
\ No newline at end of file
+{% endfor %}
diff --git a/erpnext/projects/doctype/project_template/project_template.py b/erpnext/projects/doctype/project_template/project_template.py
index aace402..2426fd2 100644
--- a/erpnext/projects/doctype/project_template/project_template.py
+++ b/erpnext/projects/doctype/project_template/project_template.py
@@ -22,7 +22,7 @@
 						task_details_format = get_link_to_form("Task",task_details.name)
 						dependency_task_format = get_link_to_form("Task", dependency_task.task)
 						frappe.throw(_("Task {0} depends on Task {1}. Please add Task {1} to the Tasks list.").format(frappe.bold(task_details_format), frappe.bold(dependency_task_format)))
-	
+
 	def check_dependent_task_presence(self, task):
 		for task_details in self.tasks:
 			if task_details.task == task:
diff --git a/erpnext/projects/doctype/project_template/test_project_template.py b/erpnext/projects/doctype/project_template/test_project_template.py
index 95663cd..d546fd0 100644
--- a/erpnext/projects/doctype/project_template/test_project_template.py
+++ b/erpnext/projects/doctype/project_template/test_project_template.py
@@ -26,4 +26,4 @@
 			})
 		doc.insert()
 
-	return frappe.get_doc('Project Template', project_template_name)
\ No newline at end of file
+	return frappe.get_doc('Project Template', project_template_name)
diff --git a/erpnext/projects/doctype/project_type/project_type.js b/erpnext/projects/doctype/project_type/project_type.js
index a1f941f..e3dda5e 100644
--- a/erpnext/projects/doctype/project_type/project_type.js
+++ b/erpnext/projects/doctype/project_type/project_type.js
@@ -3,4 +3,4 @@
 
 frappe.ui.form.on('Project Type', {
 
-});
\ No newline at end of file
+});
diff --git a/erpnext/projects/doctype/project_type/project_type.py b/erpnext/projects/doctype/project_type/project_type.py
index f46876e..36137ca 100644
--- a/erpnext/projects/doctype/project_type/project_type.py
+++ b/erpnext/projects/doctype/project_type/project_type.py
@@ -10,4 +10,4 @@
 class ProjectType(Document):
 	def on_trash(self):
 		if self.name == "External":
-			frappe.throw(_("You cannot delete Project Type 'External'"))
\ No newline at end of file
+			frappe.throw(_("You cannot delete Project Type 'External'"))
diff --git a/erpnext/projects/doctype/project_update/project_update.py b/erpnext/projects/doctype/project_update/project_update.py
index faa4bf1..2e1ec74 100644
--- a/erpnext/projects/doctype/project_update/project_update.py
+++ b/erpnext/projects/doctype/project_update/project_update.py
@@ -39,4 +39,4 @@
         for emails in email:
             frappe.sendmail(recipients=emails,subject=frappe._(project_name + ' ' + 'Summary'),message = msg)
     else:
-    	pass
\ No newline at end of file
+    	pass
diff --git a/erpnext/projects/doctype/project_update/test_project_update.py b/erpnext/projects/doctype/project_update/test_project_update.py
index d5d0919..2edd2f8 100644
--- a/erpnext/projects/doctype/project_update/test_project_update.py
+++ b/erpnext/projects/doctype/project_update/test_project_update.py
@@ -10,4 +10,4 @@
 	pass
 
 test_records = frappe.get_test_records('Project Update')
-test_ignore = ["Sales Order"]
\ No newline at end of file
+test_ignore = ["Sales Order"]
diff --git a/erpnext/projects/doctype/task/task_tree.js b/erpnext/projects/doctype/task/task_tree.js
index d1d872f..9ebfcdd 100644
--- a/erpnext/projects/doctype/task/task_tree.js
+++ b/erpnext/projects/doctype/task/task_tree.js
@@ -81,4 +81,4 @@
 		}
 	],
 	extend_toolbar: true
-};
\ No newline at end of file
+};
diff --git a/erpnext/projects/doctype/timesheet/timesheet.css b/erpnext/projects/doctype/timesheet/timesheet.css
index 3a38415..1e05562 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.css
+++ b/erpnext/projects/doctype/timesheet/timesheet.css
@@ -20,4 +20,4 @@
 .playpause {
 	border-right: 1px dashed #fff;
 	border-bottom: 1px dashed #fff;
-}
\ No newline at end of file
+}
diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js
index 84c7b81..1655b76 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.js
+++ b/erpnext/projects/doctype/timesheet/timesheet.js
@@ -399,4 +399,4 @@
 			frappe.model.set_value(item.doctype, item.name, "project", frm.doc.parent_project);
 		});
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index a0042eb..5f569d6 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -238,9 +238,9 @@
 
 @frappe.whitelist()
 def get_timesheet_detail_rate(timelog, currency):
-	timelog_detail = frappe.db.sql("""SELECT tsd.billing_amount as billing_amount, 
-		ts.currency as currency FROM `tabTimesheet Detail` tsd 
-		INNER JOIN `tabTimesheet` ts ON ts.name=tsd.parent 
+	timelog_detail = frappe.db.sql("""SELECT tsd.billing_amount as billing_amount,
+		ts.currency as currency FROM `tabTimesheet Detail` tsd
+		INNER JOIN `tabTimesheet` ts ON ts.name=tsd.parent
 		WHERE tsd.name = '{0}'""".format(timelog), as_dict = 1)[0]
 
 	if timelog_detail.currency:
diff --git a/erpnext/projects/doctype/timesheet/timesheet_calendar.js b/erpnext/projects/doctype/timesheet/timesheet_calendar.js
index 14f016a..80967ed 100644
--- a/erpnext/projects/doctype/timesheet/timesheet_calendar.js
+++ b/erpnext/projects/doctype/timesheet/timesheet_calendar.js
@@ -9,8 +9,8 @@
 		"title": "title"
 	},
 	style_map: {
-		"0": "info", 
-		"1": "standard", 
+		"0": "info",
+		"1": "standard",
 		"2": "danger"
 	},
 	gantt: true,
diff --git a/erpnext/projects/doctype/timesheet/timesheet_dashboard.py b/erpnext/projects/doctype/timesheet/timesheet_dashboard.py
index acff97a..088d98c 100644
--- a/erpnext/projects/doctype/timesheet/timesheet_dashboard.py
+++ b/erpnext/projects/doctype/timesheet/timesheet_dashboard.py
@@ -10,4 +10,4 @@
 				'items': ['Sales Invoice', 'Salary Slip']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/projects/doctype/timesheet/timesheet_list.js b/erpnext/projects/doctype/timesheet/timesheet_list.js
index 1b200f8..b59fdc9 100644
--- a/erpnext/projects/doctype/timesheet/timesheet_list.js
+++ b/erpnext/projects/doctype/timesheet/timesheet_list.js
@@ -4,13 +4,13 @@
 		if (doc.status== "Billed") {
 			return [__("Billed"), "green", "status,=," + "Billed"]
 		}
-		
+
 		if (doc.status== "Payslip") {
 			return [__("Payslip"), "green", "status,=," + "Payslip"]
 		}
-		
+
 		if (doc.status== "Completed") {
 			return [__("Completed"), "green", "status,=," + "Completed"]
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/projects/report/billing_summary.py b/erpnext/projects/report/billing_summary.py
index 5efde41..a22ed7b 100644
--- a/erpnext/projects/report/billing_summary.py
+++ b/erpnext/projects/report/billing_summary.py
@@ -144,4 +144,4 @@
 		if activity_duration != activity.billing_hours:
 			billing_duration = activity_duration * activity.billing_hours / activity.hours
 
-	return flt(activity_duration, precision), flt(billing_duration, precision)
\ No newline at end of file
+	return flt(activity_duration, precision), flt(billing_duration, precision)
diff --git a/erpnext/projects/report/daily_timesheet_summary/daily_timesheet_summary.py b/erpnext/projects/report/daily_timesheet_summary/daily_timesheet_summary.py
index 682fb2e..3dcae5b 100644
--- a/erpnext/projects/report/daily_timesheet_summary/daily_timesheet_summary.py
+++ b/erpnext/projects/report/daily_timesheet_summary/daily_timesheet_summary.py
@@ -20,8 +20,8 @@
 	return columns, data
 
 def get_column():
-	return [_("Timesheet") + ":Link/Timesheet:120", _("Employee") + "::150", _("Employee Name") + "::150", 
-		_("From Datetime") + "::140", _("To Datetime") + "::140", _("Hours") + "::70", 
+	return [_("Timesheet") + ":Link/Timesheet:120", _("Employee") + "::150", _("Employee Name") + "::150",
+		_("From Datetime") + "::140", _("To Datetime") + "::140", _("Hours") + "::70",
 		_("Activity Type") + "::120", _("Task") + ":Link/Task:150",
 		_("Project") + ":Link/Project:120", _("Status") + "::70"]
 
@@ -45,4 +45,4 @@
 	if match_conditions:
 		conditions += " and %s" % match_conditions
 
-	return conditions
\ No newline at end of file
+	return conditions
diff --git a/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py b/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py
index dbeedb4..78291b2 100644
--- a/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py
+++ b/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py
@@ -10,7 +10,7 @@
 	def setUp(self):
 		task1 = create_task("_Test Task 98", add_days(nowdate(), -10), nowdate())
 		create_task("_Test Task 99", add_days(nowdate(), -10), add_days(nowdate(), -1))
-		
+
 		task1.status = "Completed"
 		task1.completed_on = add_days(nowdate(), -1)
 		task1.save()
@@ -38,7 +38,7 @@
 		]
 		report = execute(filters)
 		data = list(filter(lambda x: x.subject == "_Test Task 99", report[1]))[0]
-		
+
 		for key in ["subject", "status", "priority", "delay"]:
 			self.assertEqual(expected_data[0].get(key), data.get(key))
 
@@ -51,4 +51,4 @@
 
 	def tearDown(self):
 		for task in ["_Test Task 98", "_Test Task 99"]:
-			frappe.get_doc("Task", {"subject": task}).delete()
\ No newline at end of file
+			frappe.get_doc("Task", {"subject": task}).delete()
diff --git a/erpnext/projects/report/employee_billing_summary/employee_billing_summary.py b/erpnext/projects/report/employee_billing_summary/employee_billing_summary.py
index cd5ad78..17c92c2 100644
--- a/erpnext/projects/report/employee_billing_summary/employee_billing_summary.py
+++ b/erpnext/projects/report/employee_billing_summary/employee_billing_summary.py
@@ -11,4 +11,4 @@
 	columns = get_columns()
 
 	data = get_data(filters)
-	return columns, data
\ No newline at end of file
+	return columns, data
diff --git a/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/test_employee_util.py b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/test_employee_util.py
index 0e5a597..969fc55 100644
--- a/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/test_employee_util.py
+++ b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/test_employee_util.py
@@ -195,4 +195,4 @@
                 'per_util': 27.78,
                 'per_util_billed_only': 27.78
             }
-        ]
\ No newline at end of file
+        ]
diff --git a/erpnext/projects/report/project_billing_summary/project_billing_summary.py b/erpnext/projects/report/project_billing_summary/project_billing_summary.py
index cd5ad78..17c92c2 100644
--- a/erpnext/projects/report/project_billing_summary/project_billing_summary.py
+++ b/erpnext/projects/report/project_billing_summary/project_billing_summary.py
@@ -11,4 +11,4 @@
 	columns = get_columns()
 
 	data = get_data(filters)
-	return columns, data
\ No newline at end of file
+	return columns, data
diff --git a/erpnext/projects/report/project_profitability/project_profitability.py b/erpnext/projects/report/project_profitability/project_profitability.py
index 9139d84..0a52f7b 100644
--- a/erpnext/projects/report/project_profitability/project_profitability.py
+++ b/erpnext/projects/report/project_profitability/project_profitability.py
@@ -208,4 +208,4 @@
 			"options": "Currency",
 			"width": 80
 		}
-	]
\ No newline at end of file
+	]
diff --git a/erpnext/projects/web_form/tasks/tasks.js b/erpnext/projects/web_form/tasks/tasks.js
index 699703c..ffc5e98 100644
--- a/erpnext/projects/web_form/tasks/tasks.js
+++ b/erpnext/projects/web_form/tasks/tasks.js
@@ -1,3 +1,3 @@
 frappe.ready(function() {
 	// bind events here
-})
\ No newline at end of file
+})
diff --git a/erpnext/projects/web_form/tasks/tasks.py b/erpnext/projects/web_form/tasks/tasks.py
index e97f36d..e5a9404 100644
--- a/erpnext/projects/web_form/tasks/tasks.py
+++ b/erpnext/projects/web_form/tasks/tasks.py
@@ -6,7 +6,7 @@
 	if frappe.form_dict.project:
 		context.parents = [{'title': frappe.form_dict.project, 'route': '/projects?project='+ frappe.form_dict.project}]
 		context.success_url = "/projects?project=" + frappe.form_dict.project
-		
+
 	elif context.doc and context.doc.get('project'):
 		context.parents = [{'title': context.doc.project, 'route': '/projects?project='+ context.doc.project}]
 		context.success_url = "/projects?project=" + context.doc.project
diff --git a/erpnext/public/images/erpnext-favicon.svg b/erpnext/public/images/erpnext-favicon.svg
index a3ac3bb..6bc6b2c 100644
--- a/erpnext/public/images/erpnext-favicon.svg
+++ b/erpnext/public/images/erpnext-favicon.svg
@@ -2,4 +2,4 @@
 <path d="M0 12C0 5.37258 5.37258 0 12 0H88C94.6274 0 100 5.37258 100 12V88C100 94.6274 94.6274 100 88 100H12C5.37258 100 0 94.6274 0 88V12Z" fill="#0089FF"/>
 <path d="M65.7097 32.9462H67.3871V24H33V32.9462H43.9032H65.7097Z" fill="white"/>
 <path d="M43.9032 66.2151V53.914H65.7097V44.9677H43.9032H33V75.1613H67.6667V66.2151H43.9032Z" fill="white"/>
-</svg>
\ No newline at end of file
+</svg>
diff --git a/erpnext/public/images/erpnext-logo.svg b/erpnext/public/images/erpnext-logo.svg
index a3ac3bb..6bc6b2c 100644
--- a/erpnext/public/images/erpnext-logo.svg
+++ b/erpnext/public/images/erpnext-logo.svg
@@ -2,4 +2,4 @@
 <path d="M0 12C0 5.37258 5.37258 0 12 0H88C94.6274 0 100 5.37258 100 12V88C100 94.6274 94.6274 100 88 100H12C5.37258 100 0 94.6274 0 88V12Z" fill="#0089FF"/>
 <path d="M65.7097 32.9462H67.3871V24H33V32.9462H43.9032H65.7097Z" fill="white"/>
 <path d="M43.9032 66.2151V53.914H65.7097V44.9677H43.9032H33V75.1613H67.6667V66.2151H43.9032Z" fill="white"/>
-</svg>
\ No newline at end of file
+</svg>
diff --git a/erpnext/public/images/pos.svg b/erpnext/public/images/pos.svg
index 3d12d9c..90714e9 100644
--- a/erpnext/public/images/pos.svg
+++ b/erpnext/public/images/pos.svg
@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
 <rect fill="none" width="100" height="100"/>
 <path d="M73.617,42.921H53.671c-0.788,0-1.423,0.636-1.423,1.423v7.238c0,0.788,0.635,1.424,1.423,1.424h19.946  c0.788,0,1.429-0.636,1.429-1.424v-7.238C75.046,43.557,74.405,42.921,73.617,42.921z M72.194,50.16H55.099v-4.392h17.096V50.16z   M58.494,57.78c0,0.788-0.635,1.423-1.423,1.423h-3.4c-0.788,0-1.423-0.635-1.423-1.423s0.635-1.429,1.423-1.429h3.4  C57.859,56.352,58.494,56.992,58.494,57.78z M66.771,57.78c0,0.788-0.636,1.423-1.424,1.423h-3.4c-0.788,0-1.429-0.635-1.429-1.423  s0.641-1.429,1.429-1.429h3.4C66.135,56.352,66.771,56.992,66.771,57.78z M75.046,57.78c0,0.788-0.641,1.423-1.429,1.423h-3.396  c-0.788,0-1.423-0.635-1.423-1.423s0.635-1.429,1.423-1.429h3.396C74.405,56.352,75.046,56.992,75.046,57.78z M58.494,64.058  c0,0.788-0.635,1.429-1.423,1.429h-3.4c-0.788,0-1.423-0.641-1.423-1.429s0.635-1.423,1.423-1.423h3.4  C57.859,62.635,58.494,63.27,58.494,64.058z M66.771,64.058c0,0.788-0.636,1.429-1.424,1.429h-3.4c-0.788,0-1.429-0.641-1.429-1.429  s0.641-1.423,1.429-1.423h3.4C66.135,62.635,66.771,63.27,66.771,64.058z M75.046,64.058c0,0.788-0.641,1.429-1.429,1.429h-3.396  c-0.788,0-1.423-0.641-1.423-1.429s0.635-1.423,1.423-1.423h3.396C74.405,62.635,75.046,63.27,75.046,64.058z M87.271,72.227  c-0.239-13.364-2.135-26.347-5.562-37.713c-0.366-1.2-1.474-2.028-2.729-2.028H66.496V22.334h11.636c1.57,0,2.847-1.276,2.847-2.852  V7.847C80.979,6.276,79.702,5,78.132,5H49.163c-1.576,0-2.852,1.276-2.852,2.847v11.636c0,1.576,1.276,2.852,2.852,2.852h11.634  v10.151H44.255c0.902-1.006,1.896-1.789,2.977-2.257c0.623-0.264,0.971-0.93,0.833-1.591c-0.137-0.666-0.722-1.139-1.398-1.139  H33.028c-0.193,0-0.386,0.041-0.564,0.117c-2.104,0.91-3.896,2.587-5.315,4.87h-6.133c-1.253,0-2.364,0.829-2.725,2.028  c-3.431,11.366-5.327,24.349-5.566,37.713c-1.515,0.066-2.732,1.297-2.732,2.826v17.096c0,1.575,1.276,2.852,2.849,2.852h74.312  c1.576,0,2.852-1.276,2.852-2.852V75.053C90.006,73.523,88.791,72.293,87.271,72.227z M52.012,10.698h23.268v5.938H52.012V10.698z   M33.338,30.351h8.998c-2.229,2.389-3.922,5.901-4.85,10.182c-1.281,5.922-0.854,11.94,0.976,15.819H29  c-2.336-3.151-3.134-10.07-1.807-16.201C28.248,35.276,30.482,31.723,33.338,30.351z M23.157,38.189h1.604  c-0.122,0.447-0.251,0.884-0.353,1.357c-1.332,6.161-0.732,12.663,1.332,16.805h-1.271c-0.788,0-1.426,0.641-1.426,1.429  s0.638,1.423,1.426,1.423h3.858H41.06h3.116c0.788,0,1.423-0.635,1.423-1.423s-0.636-1.429-1.423-1.429h-2.389  c-2.14-2.897-2.809-9.241-1.515-15.214c0.227-1.052,0.516-2.018,0.834-2.948H76.84c2.903,10.339,4.529,22.005,4.753,34.012H18.404  C18.627,60.194,20.257,48.528,23.157,38.189z M84.308,89.302H15.694V77.899h68.613V89.302z M45.45,83.598  c0-1.57,1.276-2.846,2.849-2.846h3.4c1.575,0,2.851,1.275,2.851,2.846c0,1.576-1.275,2.853-2.851,2.853h-3.4  C46.726,86.45,45.45,85.174,45.45,83.598z"/>
-</svg>
\ No newline at end of file
+</svg>
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index e8f3122..702064f 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -754,8 +754,6 @@
 			}
 		});
 		this.frm.refresh_fields();
-
-		this.calculate_paid_amount();
 	}
 
 	set_default_payment(total_amount_to_pay, update_paid_amount) {
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 3c6c347..2538852 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -342,30 +342,6 @@
 		this.set_dynamic_labels();
 		this.setup_sms();
 		this.setup_quality_inspection();
-		let scan_barcode_field = this.frm.get_field('scan_barcode');
-		if (scan_barcode_field && scan_barcode_field.get_value()) {
-			scan_barcode_field.set_value("");
-			scan_barcode_field.set_new_description("");
-
-			if (frappe.is_mobile()) {
-				if (scan_barcode_field.$input_wrapper.find('.input-group').length) return;
-
-				let $input_group = $('<div class="input-group">');
-				scan_barcode_field.$input_wrapper.find('.control-input').append($input_group);
-				$input_group.append(scan_barcode_field.$input);
-				$(`<span class="input-group-btn" style="vertical-align: top">
-						<button class="btn btn-default border" type="button">
-							<i class="fa fa-camera text-muted"></i>
-						</button>
-					</span>`)
-					.on('click', '.btn', () => {
-						frappe.barcode.scan_barcode().then(barcode => {
-							scan_barcode_field.set_value(barcode);
-						});
-					})
-					.appendTo($input_group);
-			}
-		}
 	}
 
 	scan_barcode() {
@@ -2266,12 +2242,19 @@
 
 	coupon_code() {
 		var me = this;
-		frappe.run_serially([
-			() => this.frm.doc.ignore_pricing_rule=1,
-			() => me.ignore_pricing_rule(),
-			() => this.frm.doc.ignore_pricing_rule=0,
-			() => me.apply_pricing_rule()
-		]);
+		if (this.frm.doc.coupon_code) {
+			frappe.run_serially([
+				() => this.frm.doc.ignore_pricing_rule=1,
+				() => me.ignore_pricing_rule(),
+				() => this.frm.doc.ignore_pricing_rule=0,
+				() => me.apply_pricing_rule()
+			]);
+		} else {
+			frappe.run_serially([
+				() => this.frm.doc.ignore_pricing_rule=1,
+				() => me.ignore_pricing_rule()
+			]);
+		}
 	}
 };
 
diff --git a/erpnext/public/js/education/assessment_result_tool.html b/erpnext/public/js/education/assessment_result_tool.html
index b591010..f7d1ab3 100644
--- a/erpnext/public/js/education/assessment_result_tool.html
+++ b/erpnext/public/js/education/assessment_result_tool.html
@@ -69,4 +69,4 @@
 		</tr>
 		{% endfor %}
 	</tbody>
-</table>
\ No newline at end of file
+</table>
diff --git a/erpnext/public/js/education/student_button.html b/erpnext/public/js/education/student_button.html
index 3cf2592..b64c73a 100644
--- a/erpnext/public/js/education/student_button.html
+++ b/erpnext/public/js/education/student_button.html
@@ -1,12 +1,12 @@
 <div class="col-sm-3">
     <div class="checkbox">
         <label>
-            <input 
+            <input
                 type="checkbox"
-                data-group_roll_number="{{group_roll_number}}" 
+                data-group_roll_number="{{group_roll_number}}"
                 data-student="{{student}}"
                 data-student-name="{{student_name}}"
-                class="students-check" 
+                class="students-check"
                 {% if status === "Present" %}
                 checked
                 {% endif %}
@@ -14,4 +14,4 @@
             {{ group_roll_number }} - {{ student_name }}
         </label>
     </div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/public/js/erpnext.bundle.js b/erpnext/public/js/erpnext.bundle.js
index 519cfca..9f7f29a 100644
--- a/erpnext/public/js/erpnext.bundle.js
+++ b/erpnext/public/js/erpnext.bundle.js
@@ -24,4 +24,3 @@
 import "./templates/call_link.html";
 
 // import { sum } from 'frappe/public/utils/util.js'
-
diff --git a/erpnext/public/js/financial_statements.js b/erpnext/public/js/financial_statements.js
index b2f7afe..0d79b10 100644
--- a/erpnext/public/js/financial_statements.js
+++ b/erpnext/public/js/financial_statements.js
@@ -176,5 +176,3 @@
 
 	return filters;
 }
-
-
diff --git a/erpnext/public/js/hierarchy-chart.bundle.js b/erpnext/public/js/hierarchy-chart.bundle.js
index 26ab6d9..0270313 100644
--- a/erpnext/public/js/hierarchy-chart.bundle.js
+++ b/erpnext/public/js/hierarchy-chart.bundle.js
@@ -1,3 +1,3 @@
 import "./hierarchy_chart/hierarchy_chart_desktop.js";
 import "./hierarchy_chart/hierarchy_chart_mobile.js";
-import "./templates/node_card.html";
\ No newline at end of file
+import "./templates/node_card.html";
diff --git a/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js b/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js
index da050ab..23ec2fd 100644
--- a/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js
+++ b/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js
@@ -597,4 +597,4 @@
 			$(path).remove();
 		});
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/public/js/hierarchy_chart/hierarchy_chart_mobile.js b/erpnext/public/js/hierarchy_chart/hierarchy_chart_mobile.js
index bd7946a..b1b78c0 100644
--- a/erpnext/public/js/hierarchy_chart/hierarchy_chart_mobile.js
+++ b/erpnext/public/js/hierarchy_chart/hierarchy_chart_mobile.js
@@ -548,4 +548,4 @@
 		$(`path[data-parent="${node_parent}"]`).remove();
 		this.add_connector(node_parent, node_id);
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/public/js/hub/components/ReviewArea.vue b/erpnext/public/js/hub/components/ReviewArea.vue
index 5e4e439..aa83bb0 100644
--- a/erpnext/public/js/hub/components/ReviewArea.vue
+++ b/erpnext/public/js/hub/components/ReviewArea.vue
@@ -137,4 +137,4 @@
 		}
 	}
 }
-</script>
\ No newline at end of file
+</script>
diff --git a/erpnext/public/js/hub/components/ReviewTimelineItem.vue b/erpnext/public/js/hub/components/ReviewTimelineItem.vue
index f0fe001..d0e83f3 100644
--- a/erpnext/public/js/hub/components/ReviewTimelineItem.vue
+++ b/erpnext/public/js/hub/components/ReviewTimelineItem.vue
@@ -51,4 +51,3 @@
     }
 }
 </script>
-
diff --git a/erpnext/public/js/hub/pages/FeaturedItems.vue b/erpnext/public/js/hub/pages/FeaturedItems.vue
index 63ae7e9..8380b2b 100644
--- a/erpnext/public/js/hub/pages/FeaturedItems.vue
+++ b/erpnext/public/js/hub/pages/FeaturedItems.vue
@@ -69,7 +69,7 @@
 
 			const item_name = this.items.filter(item => item.hub_item_name === hub_item_name);
 
-			alert_message = __('{0} removed. {1}', [item_name, 
+			alert_message = __('{0} removed. {1}', [item_name,
 				`<a href="#" data-action="undo-remove"><b>${__('Undo')}</b></a>`]);
 			alert = frappe.show_alert(alert_message, grace_period / 1000,
 				{
diff --git a/erpnext/public/js/hub/pages/Publish.vue b/erpnext/public/js/hub/pages/Publish.vue
index 96fa0aa..ecba4b1 100644
--- a/erpnext/public/js/hub/pages/Publish.vue
+++ b/erpnext/public/js/hub/pages/Publish.vue
@@ -78,7 +78,7 @@
 			empty_state_message: __('No Items selected yet. Browse and click on items below to publish.'),
 			valid_items_instruction: __('Only items with an image and description can be published. Please update them if an item in your inventory does not appear.'),
 			last_sync_message: (hub.settings.last_sync_datetime)
-				? __('Last sync was {0}.', [`<a href="#marketplace/profile">${comment_when(hub.settings.last_sync_datetime)}</a>`]) + 
+				? __('Last sync was {0}.', [`<a href="#marketplace/profile">${comment_when(hub.settings.last_sync_datetime)}</a>`]) +
 				  ` <a href="#marketplace/published-items">${__('See your Published Items.')}</a>`
 				: ''
 		};
diff --git a/erpnext/public/js/hub/pages/Seller.vue b/erpnext/public/js/hub/pages/Seller.vue
index c0903c6..3c9b800 100644
--- a/erpnext/public/js/hub/pages/Seller.vue
+++ b/erpnext/public/js/hub/pages/Seller.vue
@@ -24,7 +24,7 @@
 
 		<div v-if="items.length">
 			<h5>
-				{{ item_container_heading }} 
+				{{ item_container_heading }}
 				<small v-if="is_user_registered() && is_own_company">
 					<a class="pull-right" href="#marketplace/featured-items">Customize your Featured Items</a>
 				</small>
@@ -160,7 +160,7 @@
 				];
 
 				setTimeout(() => this.init_seller_traffic_chart(), 1);
-				
+
 			});
 		},
 
diff --git a/erpnext/public/js/hub/vue-plugins.js b/erpnext/public/js/hub/vue-plugins.js
index 6e6a7cb..4912d68 100644
--- a/erpnext/public/js/hub/vue-plugins.js
+++ b/erpnext/public/js/hub/vue-plugins.js
@@ -55,4 +55,4 @@
 
 Vue.filter('striphtml', function (text) {
 	return strip_html(text || '');
-});
\ No newline at end of file
+});
diff --git a/erpnext/public/js/leaflet/leaflet.draw.js b/erpnext/public/js/leaflet/leaflet.draw.js
index 4352f70..26f1e19 100755
--- a/erpnext/public/js/leaflet/leaflet.draw.js
+++ b/erpnext/public/js/leaflet/leaflet.draw.js
@@ -140,4 +140,4 @@
             e.on("click", this._removeLayer, this) }, _disableLayerDelete: function(t) { var e = t.layer || t.target || t;
             e.off("click", this._removeLayer, this), this._deletedLayers.removeLayer(e) }, _removeLayer: function(t) { var e = t.layer || t.target || t;
             this._deletableLayers.removeLayer(e), this._deletedLayers.addLayer(e) }, _onMouseMove: function(t) { this._tooltip.updatePosition(t.latlng) }, _hasAvailableLayers: function() { return 0 !== this._deletableLayers.getLayers().length } })
-}(window, document);
\ No newline at end of file
+}(window, document);
diff --git a/erpnext/public/js/leaflet/leaflet.js b/erpnext/public/js/leaflet/leaflet.js
index 41d9bb9..91dd3d4 100755
--- a/erpnext/public/js/leaflet/leaflet.js
+++ b/erpnext/public/js/leaflet/leaflet.js
@@ -768,4 +768,4 @@
                 r = this._locateOptions; if (r.setView) { var a = this.getBoundsZoom(s);
                 this.setView(n, r.maxZoom ? Math.min(a, r.maxZoom) : a) } var h = { latlng: n, bounds: s, timestamp: t.timestamp }; for (var l in t.coords) "number" == typeof t.coords[l] && (h[l] = t.coords[l]);
             this.fire("locationfound", h) } })
-}(window, document);
\ No newline at end of file
+}(window, document);
diff --git a/erpnext/public/js/projects/timer.js b/erpnext/public/js/projects/timer.js
index 26be997..0e5c0d3 100644
--- a/erpnext/public/js/projects/timer.js
+++ b/erpnext/public/js/projects/timer.js
@@ -159,4 +159,4 @@
 		$btn_complete.hide();
 		$btn_start.show();
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js
index 6f5d67c..38e1eb5 100644
--- a/erpnext/public/js/setup_wizard.js
+++ b/erpnext/public/js/setup_wizard.js
@@ -147,7 +147,7 @@
 			}
 
 			// Validate bank name
-			if(me.values.bank_account) { 
+			if(me.values.bank_account) {
 				frappe.call({
 					async: false,
 					method: "erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts.validate_bank_account",
diff --git a/erpnext/public/js/stock_analytics.js b/erpnext/public/js/stock_analytics.js
index dfe2c88..a343c34 100644
--- a/erpnext/public/js/stock_analytics.js
+++ b/erpnext/public/js/stock_analytics.js
@@ -204,4 +204,3 @@
 		frappe.set_route("query-report", "Stock Ledger");
 	}
 };
-
diff --git a/erpnext/public/js/templates/item_quick_entry.html b/erpnext/public/js/templates/item_quick_entry.html
index 6a5f36d..e5e7869 100644
--- a/erpnext/public/js/templates/item_quick_entry.html
+++ b/erpnext/public/js/templates/item_quick_entry.html
@@ -1,3 +1,3 @@
 <div class="h6 uppercase" style="margin-top: 30px;">{{ __("Variant Attributes") }}</div>
 <div class="attributes hide-control">
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/public/js/templates/item_selector.html b/erpnext/public/js/templates/item_selector.html
index 58fb26c..86a15f4 100644
--- a/erpnext/public/js/templates/item_selector.html
+++ b/erpnext/public/js/templates/item_selector.html
@@ -34,4 +34,4 @@
 	</div>
 	{% if ((i % 4 === 3) || (i===data.length - 1)) { %}</div>{% } %}
 {% endfor %}
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/public/js/templates/node_card.html b/erpnext/public/js/templates/node_card.html
index fb94df8..4cb6ee0 100644
--- a/erpnext/public/js/templates/node_card.html
+++ b/erpnext/public/js/templates/node_card.html
@@ -30,4 +30,4 @@
 			</div>
 		</div>
 	</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index db7c034..f240b8c 100755
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -465,7 +465,23 @@
 		in_list_view: 1,
 		read_only: 0,
 		disabled: 0,
-		label: __('Item Code')
+		label: __('Item Code'),
+		get_query: function() {
+			let filters;
+			if (frm.doc.doctype == 'Sales Order') {
+				filters = {"is_sales_item": 1};
+			} else if (frm.doc.doctype == 'Purchase Order') {
+				if (frm.doc.is_subcontracted == "Yes") {
+					filters = {"is_sub_contracted_item": 1};
+				} else {
+					filters = {"is_purchase_item": 1};
+				}
+			}
+			return {
+				query: "erpnext.controllers.queries.item_query",
+				filters: filters
+			};
+		}
 	}, {
 		fieldtype:'Link',
 		fieldname:'uom',
@@ -547,7 +563,7 @@
 			},
 		],
 		primary_action: function() {
-			const trans_items = this.get_values()["trans_items"];
+			const trans_items = this.get_values()["trans_items"].filter((item) => !!item.item_code);
 			frappe.call({
 				method: 'erpnext.controllers.accounts_controller.update_child_qty_rate',
 				freeze: true,
diff --git a/erpnext/public/js/utils/dimension_tree_filter.js b/erpnext/public/js/utils/dimension_tree_filter.js
index 96e1817..bb23f15 100644
--- a/erpnext/public/js/utils/dimension_tree_filter.js
+++ b/erpnext/public/js/utils/dimension_tree_filter.js
@@ -100,4 +100,4 @@
 			});
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/public/scss/hierarchy_chart.scss b/erpnext/public/scss/hierarchy_chart.scss
index a66d647..57d5e84 100644
--- a/erpnext/public/scss/hierarchy_chart.scss
+++ b/erpnext/public/scss/hierarchy_chart.scss
@@ -310,4 +310,4 @@
 	display: flex;
 	flex-direction: column;
 	align-items: center;
-}
\ No newline at end of file
+}
diff --git a/erpnext/public/scss/point-of-sale.scss b/erpnext/public/scss/point-of-sale.scss
index c77b2ce..1677e9b 100644
--- a/erpnext/public/scss/point-of-sale.scss
+++ b/erpnext/public/scss/point-of-sale.scss
@@ -860,6 +860,8 @@
 
 				.invoice-fields {
 					overflow-y: scroll;
+					height: 100%;
+					padding-right: var(--padding-sm);
 				}
 			}
 
diff --git a/erpnext/public/scss/shopping_cart.scss b/erpnext/public/scss/shopping_cart.scss
index 5962859..490a7c4 100644
--- a/erpnext/public/scss/shopping_cart.scss
+++ b/erpnext/public/scss/shopping_cart.scss
@@ -483,4 +483,3 @@
 		border: 1px solid var(--dark-border-color);
 	}
 }
-
diff --git a/erpnext/public/scss/website.scss b/erpnext/public/scss/website.scss
index f4325c0..9ea8416 100644
--- a/erpnext/public/scss/website.scss
+++ b/erpnext/public/scss/website.scss
@@ -67,4 +67,4 @@
 	.card-body > .card-title {
 		line-height: 1.3;
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/quality_management/doctype/quality_action/quality_action.js b/erpnext/quality_management/doctype/quality_action/quality_action.js
index e216a75..b44f2a2 100644
--- a/erpnext/quality_management/doctype/quality_action/quality_action.js
+++ b/erpnext/quality_management/doctype/quality_action/quality_action.js
@@ -3,4 +3,4 @@
 
 frappe.ui.form.on('Quality Action', {
 
-});
\ No newline at end of file
+});
diff --git a/erpnext/quality_management/doctype/quality_action/quality_action.py b/erpnext/quality_management/doctype/quality_action/quality_action.py
index d6fa505..02401ba 100644
--- a/erpnext/quality_management/doctype/quality_action/quality_action.py
+++ b/erpnext/quality_management/doctype/quality_action/quality_action.py
@@ -8,4 +8,4 @@
 
 class QualityAction(Document):
 	def validate(self):
-		self.status = 'Open' if any([d.status=='Open' for d in self.resolutions]) else 'Completed'
\ No newline at end of file
+		self.status = 'Open' if any([d.status=='Open' for d in self.resolutions]) else 'Completed'
diff --git a/erpnext/quality_management/doctype/quality_action/test_quality_action.py b/erpnext/quality_management/doctype/quality_action/test_quality_action.py
index 24b97ca..98d665f 100644
--- a/erpnext/quality_management/doctype/quality_action/test_quality_action.py
+++ b/erpnext/quality_management/doctype/quality_action/test_quality_action.py
@@ -8,4 +8,4 @@
 
 class TestQualityAction(unittest.TestCase):
 	# quality action has no code
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/quality_management/doctype/quality_feedback/quality_feedback.py b/erpnext/quality_management/doctype/quality_feedback/quality_feedback.py
index 5a8ec73..d3e96cf 100644
--- a/erpnext/quality_management/doctype/quality_feedback/quality_feedback.py
+++ b/erpnext/quality_management/doctype/quality_feedback/quality_feedback.py
@@ -21,4 +21,3 @@
 			self.document_type ='User'
 			self.document_name = frappe.session.user
 		self.set_parameters()
-
diff --git a/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py b/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py
index b3eed10..afed14b 100644
--- a/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py
+++ b/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py
@@ -7,4 +7,4 @@
 import unittest
 
 class TestQualityFeedbackTemplate(unittest.TestCase):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/quality_management/doctype/quality_goal/quality_goal.py b/erpnext/quality_management/doctype/quality_goal/quality_goal.py
index f3fe986..3e616b7 100644
--- a/erpnext/quality_management/doctype/quality_goal/quality_goal.py
+++ b/erpnext/quality_management/doctype/quality_goal/quality_goal.py
@@ -9,4 +9,4 @@
 
 class QualityGoal(Document):
 	def validate(self):
-		pass
\ No newline at end of file
+		pass
diff --git a/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py b/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py
index f61d6e5..0e135b5 100644
--- a/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py
+++ b/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py
@@ -22,4 +22,4 @@
 		objectives = [
 			dict(objective = 'Check test cases', target='100', uom='Percent')
 		]
-	)).insert()
\ No newline at end of file
+	)).insert()
diff --git a/erpnext/quality_management/doctype/quality_meeting/quality_meeting.py b/erpnext/quality_management/doctype/quality_meeting/quality_meeting.py
index f8de229..9e453eb 100644
--- a/erpnext/quality_management/doctype/quality_meeting/quality_meeting.py
+++ b/erpnext/quality_management/doctype/quality_meeting/quality_meeting.py
@@ -6,4 +6,4 @@
 from frappe.model.document import Document
 
 class QualityMeeting(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/quality_management/doctype/quality_meeting/quality_meeting_list.js b/erpnext/quality_management/doctype/quality_meeting/quality_meeting_list.js
index ff85c84..5fd1b30 100644
--- a/erpnext/quality_management/doctype/quality_meeting/quality_meeting_list.js
+++ b/erpnext/quality_management/doctype/quality_meeting/quality_meeting_list.js
@@ -8,4 +8,4 @@
 			return [__("Close"), "green", ",status=,Close"];
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py b/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py
index 754bccb..6bf4c17 100644
--- a/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py
+++ b/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py
@@ -8,4 +8,4 @@
 
 class TestQualityMeeting(unittest.TestCase):
 	# nothing to test
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.js b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.js
index ac87622..fd2b6a4 100644
--- a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.js
+++ b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.js
@@ -19,4 +19,4 @@
 			};
 		});
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py
index 53f4e6c..117db00 100644
--- a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py
+++ b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py
@@ -77,4 +77,4 @@
 	if args.parent_quality_procedure == 'All Quality Procedures':
 		args.parent_quality_procedure = None
 
-	return frappe.get_doc(args).insert()
\ No newline at end of file
+	return frappe.get_doc(args).insert()
diff --git a/erpnext/quality_management/doctype/quality_procedure/quality_procedure_tree.js b/erpnext/quality_management/doctype/quality_procedure/quality_procedure_tree.js
index eeb4cf6..2851fcc 100644
--- a/erpnext/quality_management/doctype/quality_procedure/quality_procedure_tree.js
+++ b/erpnext/quality_management/doctype/quality_procedure/quality_procedure_tree.js
@@ -31,4 +31,4 @@
 	onload: function(treeview) {
 		treeview.make_tree();
 	},
-};
\ No newline at end of file
+};
diff --git a/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py b/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py
index 36bdf26..4fa7734 100644
--- a/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py
+++ b/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py
@@ -47,4 +47,4 @@
 		processes = [
 			dict(process_description = 'Test Step 1')
 		]
-	)).insert()
\ No newline at end of file
+	)).insert()
diff --git a/erpnext/quality_management/doctype/quality_review/quality_review.js b/erpnext/quality_management/doctype/quality_review/quality_review.js
index 67371bf..0e6b703 100644
--- a/erpnext/quality_management/doctype/quality_review/quality_review.js
+++ b/erpnext/quality_management/doctype/quality_review/quality_review.js
@@ -22,4 +22,4 @@
 			}
 		});
 	},
-});
\ No newline at end of file
+});
diff --git a/erpnext/quality_management/doctype/quality_review/quality_review.py b/erpnext/quality_management/doctype/quality_review/quality_review.py
index e3a8b07..34cc890 100644
--- a/erpnext/quality_management/doctype/quality_review/quality_review.py
+++ b/erpnext/quality_management/doctype/quality_review/quality_review.py
@@ -61,4 +61,4 @@
 	if month in  ["January", "April", "July", "October"]:
 		return True
 	else:
-		return False
\ No newline at end of file
+		return False
diff --git a/erpnext/quality_management/doctype/quality_review/quality_review_list.js b/erpnext/quality_management/doctype/quality_review/quality_review_list.js
index e2eb31b..b0be783 100644
--- a/erpnext/quality_management/doctype/quality_review/quality_review_list.js
+++ b/erpnext/quality_management/doctype/quality_review/quality_review_list.js
@@ -9,4 +9,4 @@
 			return [__("Action Initialised"), "red", "action,=,Action Initialised"];
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/quality_management/doctype/quality_review/test_quality_review.py b/erpnext/quality_management/doctype/quality_review/test_quality_review.py
index a7d92da..161ecd0 100644
--- a/erpnext/quality_management/doctype/quality_review/test_quality_review.py
+++ b/erpnext/quality_management/doctype/quality_review/test_quality_review.py
@@ -19,4 +19,4 @@
 		self.assertEqual(quality_goal.objectives[0].target, quality_review.reviews[0].target)
 		quality_review.delete()
 
-		quality_goal.delete()
\ No newline at end of file
+		quality_goal.delete()
diff --git a/erpnext/regional/address_template/setup.py b/erpnext/regional/address_template/setup.py
index 9f318de..1b4087d 100644
--- a/erpnext/regional/address_template/setup.py
+++ b/erpnext/regional/address_template/setup.py
@@ -10,7 +10,7 @@
 def get_address_templates():
 	"""
 	Return country and path for all HTML files in this directory.
-	
+
 	Returns a list of dicts.
 	"""
 	def country(file_name):
diff --git a/erpnext/regional/address_template/templates/germany.html b/erpnext/regional/address_template/templates/germany.html
index 7fa4c32..25c9c9d 100644
--- a/erpnext/regional/address_template/templates/germany.html
+++ b/erpnext/regional/address_template/templates/germany.html
@@ -3,6 +3,6 @@
 {% if country in ["Germany", "Deutschland"] %}
     {{ pincode }} {{ city }}
 {% else %}
-    {{ pincode }} {{ city | upper }}<br>    
+    {{ pincode }} {{ city | upper }}<br>
     {{ country | upper }}
 {% endif %}
diff --git a/erpnext/regional/doctype/e_invoice_request_log/__init__.py b/erpnext/regional/doctype/e_invoice_request_log/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/regional/doctype/e_invoice_request_log/__init__.py
+++ /dev/null
diff --git a/erpnext/regional/doctype/e_invoice_request_log/e_invoice_request_log.js b/erpnext/regional/doctype/e_invoice_request_log/e_invoice_request_log.js
deleted file mode 100644
index 7b7ba96..0000000
--- a/erpnext/regional/doctype/e_invoice_request_log/e_invoice_request_log.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('E Invoice Request Log', {
-	// refresh: function(frm) {
-
-	// }
-});
diff --git a/erpnext/regional/doctype/e_invoice_request_log/e_invoice_request_log.json b/erpnext/regional/doctype/e_invoice_request_log/e_invoice_request_log.json
deleted file mode 100644
index 3034370..0000000
--- a/erpnext/regional/doctype/e_invoice_request_log/e_invoice_request_log.json
+++ /dev/null
@@ -1,102 +0,0 @@
-{
- "actions": [],
- "autoname": "EINV-REQ-.#####",
- "creation": "2020-12-08 12:54:08.175992",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
-  "user",
-  "url",
-  "headers",
-  "response",
-  "column_break_7",
-  "timestamp",
-  "reference_invoice",
-  "data"
- ],
- "fields": [
-  {
-   "fieldname": "user",
-   "fieldtype": "Link",
-   "label": "User",
-   "options": "User"
-  },
-  {
-   "fieldname": "reference_invoice",
-   "fieldtype": "Data",
-   "label": "Reference Invoice"
-  },
-  {
-   "fieldname": "headers",
-   "fieldtype": "Code",
-   "label": "Headers",
-   "options": "JSON"
-  },
-  {
-   "fieldname": "data",
-   "fieldtype": "Code",
-   "label": "Data",
-   "options": "JSON"
-  },
-  {
-   "default": "Now",
-   "fieldname": "timestamp",
-   "fieldtype": "Datetime",
-   "label": "Timestamp"
-  },
-  {
-   "fieldname": "response",
-   "fieldtype": "Code",
-   "label": "Response",
-   "options": "JSON"
-  },
-  {
-   "fieldname": "url",
-   "fieldtype": "Data",
-   "label": "URL"
-  },
-  {
-   "fieldname": "column_break_7",
-   "fieldtype": "Column Break"
-  }
- ],
- "index_web_pages_for_search": 1,
- "links": [],
- "modified": "2021-01-13 12:06:57.253111",
- "modified_by": "Administrator",
- "module": "Regional",
- "name": "E Invoice Request Log",
- "owner": "Administrator",
- "permissions": [
-  {
-   "email": 1,
-   "export": 1,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "System Manager",
-   "share": 1
-  },
-  {
-   "email": 1,
-   "export": 1,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Accounts User",
-   "share": 1
-  },
-  {
-   "email": 1,
-   "export": 1,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Accounts Manager",
-   "share": 1
-  }
- ],
- "sort_field": "modified",
- "sort_order": "DESC"
-}
\ No newline at end of file
diff --git a/erpnext/regional/doctype/e_invoice_request_log/e_invoice_request_log.py b/erpnext/regional/doctype/e_invoice_request_log/e_invoice_request_log.py
deleted file mode 100644
index 9150bdd..0000000
--- a/erpnext/regional/doctype/e_invoice_request_log/e_invoice_request_log.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2020, 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 EInvoiceRequestLog(Document):
-	pass
diff --git a/erpnext/regional/doctype/e_invoice_request_log/test_e_invoice_request_log.py b/erpnext/regional/doctype/e_invoice_request_log/test_e_invoice_request_log.py
deleted file mode 100644
index c84e9a2..0000000
--- a/erpnext/regional/doctype/e_invoice_request_log/test_e_invoice_request_log.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-# import frappe
-import unittest
-
-class TestEInvoiceRequestLog(unittest.TestCase):
-	pass
diff --git a/erpnext/regional/doctype/e_invoice_settings/__init__.py b/erpnext/regional/doctype/e_invoice_settings/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/regional/doctype/e_invoice_settings/__init__.py
+++ /dev/null
diff --git a/erpnext/regional/doctype/e_invoice_settings/e_invoice_settings.js b/erpnext/regional/doctype/e_invoice_settings/e_invoice_settings.js
deleted file mode 100644
index 54e4886..0000000
--- a/erpnext/regional/doctype/e_invoice_settings/e_invoice_settings.js
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('E Invoice Settings', {
-	refresh(frm) {
-		const docs_link = 'https://docs.erpnext.com/docs/v13/user/manual/en/regional/india/setup-e-invoicing';
-		frm.dashboard.set_headline(
-			__("Read {0} for more information on E Invoicing features.", [`<a href='${docs_link}'>documentation</a>`])
-		);
-	}
-});
diff --git a/erpnext/regional/doctype/e_invoice_settings/e_invoice_settings.json b/erpnext/regional/doctype/e_invoice_settings/e_invoice_settings.json
deleted file mode 100644
index 68ed339..0000000
--- a/erpnext/regional/doctype/e_invoice_settings/e_invoice_settings.json
+++ /dev/null
@@ -1,73 +0,0 @@
-{
- "actions": [],
- "creation": "2020-09-24 16:23:16.235722",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
-  "enable",
-  "section_break_2",
-  "sandbox_mode",
-  "applicable_from",
-  "credentials",
-  "auth_token",
-  "token_expiry"
- ],
- "fields": [
-  {
-   "default": "0",
-   "fieldname": "enable",
-   "fieldtype": "Check",
-   "label": "Enable"
-  },
-  {
-   "depends_on": "enable",
-   "fieldname": "section_break_2",
-   "fieldtype": "Section Break"
-  },
-  {
-   "fieldname": "auth_token",
-   "fieldtype": "Data",
-   "hidden": 1,
-   "read_only": 1
-  },
-  {
-   "fieldname": "token_expiry",
-   "fieldtype": "Datetime",
-   "hidden": 1,
-   "read_only": 1
-  },
-  {
-   "fieldname": "credentials",
-   "fieldtype": "Table",
-   "label": "Credentials",
-   "mandatory_depends_on": "enable",
-   "options": "E Invoice User"
-  },
-  {
-   "default": "0",
-   "fieldname": "sandbox_mode",
-   "fieldtype": "Check",
-   "label": "Sandbox Mode"
-  },
-  {
-   "fieldname": "applicable_from",
-   "fieldtype": "Date",
-   "in_list_view": 1,
-   "label": "Applicable From",
-   "reqd": 1
-  }
- ],
- "index_web_pages_for_search": 1,
- "issingle": 1,
- "links": [],
- "modified": "2021-03-30 12:26:25.538294",
- "modified_by": "Administrator",
- "module": "Regional",
- "name": "E Invoice Settings",
- "owner": "Administrator",
- "permissions": [],
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/regional/doctype/e_invoice_settings/e_invoice_settings.py b/erpnext/regional/doctype/e_invoice_settings/e_invoice_settings.py
deleted file mode 100644
index c24ad88..0000000
--- a/erpnext/regional/doctype/e_invoice_settings/e_invoice_settings.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
-# For license information, please see license.txt
-from __future__ import unicode_literals
-
-import frappe
-from frappe import _
-from frappe.model.document import Document
-
-class EInvoiceSettings(Document):
-	def validate(self):
-		if self.enable and not self.credentials:
-			frappe.throw(_('You must add atleast one credentials to be able to use E Invoicing.'))
-
diff --git a/erpnext/regional/doctype/e_invoice_settings/test_e_invoice_settings.py b/erpnext/regional/doctype/e_invoice_settings/test_e_invoice_settings.py
deleted file mode 100644
index a11ce63..0000000
--- a/erpnext/regional/doctype/e_invoice_settings/test_e_invoice_settings.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-# import frappe
-import unittest
-
-class TestEInvoiceSettings(unittest.TestCase):
-	pass
diff --git a/erpnext/regional/doctype/e_invoice_user/__init__.py b/erpnext/regional/doctype/e_invoice_user/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/regional/doctype/e_invoice_user/__init__.py
+++ /dev/null
diff --git a/erpnext/regional/doctype/e_invoice_user/e_invoice_user.json b/erpnext/regional/doctype/e_invoice_user/e_invoice_user.json
deleted file mode 100644
index a65b1ca..0000000
--- a/erpnext/regional/doctype/e_invoice_user/e_invoice_user.json
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "actions": [],
- "creation": "2020-12-22 15:02:46.229474",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
-  "company",
-  "gstin",
-  "username",
-  "password"
- ],
- "fields": [
-  {
-   "fieldname": "gstin",
-   "fieldtype": "Data",
-   "in_list_view": 1,
-   "label": "GSTIN",
-   "reqd": 1
-  },
-  {
-   "fieldname": "username",
-   "fieldtype": "Data",
-   "in_list_view": 1,
-   "label": "Username",
-   "reqd": 1
-  },
-  {
-   "fieldname": "password",
-   "fieldtype": "Password",
-   "in_list_view": 1,
-   "label": "Password",
-   "reqd": 1
-  },
-  {
-   "fieldname": "company",
-   "fieldtype": "Link",
-   "in_list_view": 1,
-   "label": "Company",
-   "options": "Company",
-   "reqd": 1
-  }
- ],
- "index_web_pages_for_search": 1,
- "istable": 1,
- "links": [],
- "modified": "2021-03-22 12:16:56.365616",
- "modified_by": "Administrator",
- "module": "Regional",
- "name": "E Invoice User",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/regional/doctype/e_invoice_user/e_invoice_user.py b/erpnext/regional/doctype/e_invoice_user/e_invoice_user.py
deleted file mode 100644
index 056c54f..0000000
--- a/erpnext/regional/doctype/e_invoice_user/e_invoice_user.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2020, 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 EInvoiceUser(Document):
-	pass
diff --git a/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.js b/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.js
index 7ff4de4..347fdfe 100644
--- a/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.js
+++ b/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.js
@@ -25,4 +25,4 @@
 			});
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.py b/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.py
index 86cd4d1..4791dc2 100644
--- a/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.py
+++ b/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.py
@@ -30,4 +30,4 @@
 				'tax_category': tax.tax_category,
 				'valid_from': tax.valid_from
 			})
-			item_to_be_updated.save()
\ No newline at end of file
+			item_to_be_updated.save()
diff --git a/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.html b/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.html
index 3b6a45a..f3fc60f 100644
--- a/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.html
+++ b/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.html
@@ -294,4 +294,4 @@
 	text-align: right;
 }
 
-</style>
\ No newline at end of file
+</style>
diff --git a/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.js b/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.js
index c2d6edf..5918ec8 100644
--- a/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.js
+++ b/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.js
@@ -43,4 +43,4 @@
 		}
 	}
 
-});
\ No newline at end of file
+});
diff --git a/erpnext/regional/doctype/lower_deduction_certificate/lower_deduction_certificate.py b/erpnext/regional/doctype/lower_deduction_certificate/lower_deduction_certificate.py
index ad60db0..656c329 100644
--- a/erpnext/regional/doctype/lower_deduction_certificate/lower_deduction_certificate.py
+++ b/erpnext/regional/doctype/lower_deduction_certificate/lower_deduction_certificate.py
@@ -13,7 +13,7 @@
 	def validate(self):
 		self.validate_dates()
 		self.validate_supplier_against_section_code()
-		
+
 	def validate_dates(self):
 		if getdate(self.valid_upto) < getdate(self.valid_from):
 			frappe.throw(_("Valid Upto date cannot be before Valid From date"))
@@ -44,4 +44,4 @@
 			return True
 		elif getdate(self.valid_from) <= valid_from and valid_upto <= getdate(self.valid_upto):
 			return True
-		return False
\ No newline at end of file
+		return False
diff --git a/erpnext/regional/doctype/tax_exemption_80g_certificate/test_tax_exemption_80g_certificate.py b/erpnext/regional/doctype/tax_exemption_80g_certificate/test_tax_exemption_80g_certificate.py
index c478b0f..41b4203 100644
--- a/erpnext/regional/doctype/tax_exemption_80g_certificate/test_tax_exemption_80g_certificate.py
+++ b/erpnext/regional/doctype/tax_exemption_80g_certificate/test_tax_exemption_80g_certificate.py
@@ -98,4 +98,4 @@
 
 	certificate.update(args)
 
-	return certificate
\ No newline at end of file
+	return certificate
diff --git a/erpnext/regional/germany/utils/datev/datev_constants.py b/erpnext/regional/germany/utils/datev/datev_constants.py
index 63f9a77..be3d7a3 100644
--- a/erpnext/regional/germany/utils/datev/datev_constants.py
+++ b/erpnext/regional/germany/utils/datev/datev_constants.py
@@ -455,7 +455,7 @@
 	"Konto",
 	# Account name
 	"Kontenbeschriftung",
-	# Language of the account name 
+	# Language of the account name
 	# "de-DE" or "en-GB"
 	"Sprach-ID"
 ]
diff --git a/erpnext/regional/india/e_invoice/einv_item_template.json b/erpnext/regional/india/e_invoice/einv_item_template.json
deleted file mode 100644
index 78e5651..0000000
--- a/erpnext/regional/india/e_invoice/einv_item_template.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{{
-    "SlNo": "{item.sr_no}",
-    "PrdDesc": "{item.description}",
-    "IsServc": "{item.is_service_item}",
-    "HsnCd": "{item.gst_hsn_code}",
-    "Barcde": "{item.barcode}",
-    "Unit": "{item.uom}",
-    "Qty": "{item.qty}",
-    "FreeQty": "{item.free_qty}",
-    "UnitPrice": "{item.unit_rate}",
-    "TotAmt": "{item.gross_amount}",
-    "Discount": "{item.discount_amount}",
-    "AssAmt": "{item.taxable_value}",
-    "PrdSlNo": "{item.serial_no}",
-    "GstRt": "{item.tax_rate}",
-    "IgstAmt": "{item.igst_amount}",
-    "CgstAmt": "{item.cgst_amount}",
-    "SgstAmt": "{item.sgst_amount}",
-    "CesRt": "{item.cess_rate}",
-    "CesAmt": "{item.cess_amount}",
-    "CesNonAdvlAmt": "{item.cess_nadv_amount}",
-    "StateCesRt": "{item.state_cess_rate}",
-    "StateCesAmt": "{item.state_cess_amount}",
-    "StateCesNonAdvlAmt": "{item.state_cess_nadv_amount}",
-    "OthChrg": "{item.other_charges}",
-    "TotItemVal": "{item.total_value}",
-    "BchDtls": {{
-        "Nm": "{item.batch_no}",
-        "ExpDt": "{item.batch_expiry_date}"
-    }}
-}}
\ No newline at end of file
diff --git a/erpnext/regional/india/e_invoice/einv_template.json b/erpnext/regional/india/e_invoice/einv_template.json
deleted file mode 100644
index 60f490d..0000000
--- a/erpnext/regional/india/e_invoice/einv_template.json
+++ /dev/null
@@ -1,110 +0,0 @@
-{{
-    "Version": "1.1",
-    "TranDtls": {{
-        "TaxSch": "{transaction_details.tax_scheme}",
-        "SupTyp": "{transaction_details.supply_type}",
-        "RegRev": "{transaction_details.reverse_charge}",
-        "EcmGstin": "{transaction_details.ecom_gstin}",
-        "IgstOnIntra": "{transaction_details.igst_on_intra}"
-    }},
-    "DocDtls": {{
-        "Typ": "{doc_details.invoice_type}",
-        "No": "{doc_details.invoice_name}",
-        "Dt": "{doc_details.invoice_date}"
-    }},
-    "SellerDtls": {{
-        "Gstin": "{seller_details.gstin}",
-        "LglNm": "{seller_details.legal_name}",
-        "TrdNm": "{seller_details.trade_name}",
-        "Loc": "{seller_details.location}",
-        "Pin": "{seller_details.pincode}",
-        "Stcd": "{seller_details.state_code}",
-        "Addr1": "{seller_details.address_line1}",
-        "Addr2": "{seller_details.address_line2}",
-        "Ph": "{seller_details.phone}",
-        "Em": "{seller_details.email}"
-    }},
-    "BuyerDtls": {{
-        "Gstin": "{buyer_details.gstin}",
-        "LglNm": "{buyer_details.legal_name}",
-        "TrdNm": "{buyer_details.trade_name}",
-        "Addr1": "{buyer_details.address_line1}",
-        "Addr2": "{buyer_details.address_line2}",
-        "Loc": "{buyer_details.location}",
-        "Pin": "{buyer_details.pincode}",
-        "Stcd": "{buyer_details.state_code}",
-        "Ph": "{buyer_details.phone}",
-        "Em": "{buyer_details.email}",
-        "Pos": "{buyer_details.place_of_supply}"
-    }},
-    "DispDtls": {{
-        "Nm": "{dispatch_details.company_name}",
-        "Addr1": "{dispatch_details.address_line1}",
-        "Addr2": "{dispatch_details.address_line2}",
-        "Loc": "{dispatch_details.location}",
-        "Pin": "{dispatch_details.pincode}",
-        "Stcd": "{dispatch_details.state_code}"
-    }},
-    "ShipDtls": {{
-        "Gstin": "{shipping_details.gstin}",
-        "LglNm": "{shipping_details.legal_name}",
-        "TrdNm": "{shipping_details.trader_name}",
-        "Addr1": "{shipping_details.address_line1}",
-        "Addr2": "{shipping_details.address_line2}",
-        "Loc": "{shipping_details.location}",
-        "Pin": "{shipping_details.pincode}",
-        "Stcd": "{shipping_details.state_code}"
-    }},
-    "ItemList": [
-        {item_list}
-    ],
-    "ValDtls": {{
-        "AssVal": "{invoice_value_details.base_total}",
-        "CgstVal": "{invoice_value_details.total_cgst_amt}",
-        "SgstVal": "{invoice_value_details.total_sgst_amt}",
-        "IgstVal": "{invoice_value_details.total_igst_amt}",
-        "CesVal": "{invoice_value_details.total_cess_amt}",
-        "Discount": "{invoice_value_details.invoice_discount_amt}",
-        "RndOffAmt": "{invoice_value_details.round_off}",
-        "OthChrg": "{invoice_value_details.total_other_charges}",
-        "TotInvVal": "{invoice_value_details.base_grand_total}",
-        "TotInvValFc": "{invoice_value_details.grand_total}"
-    }},
-    "PayDtls": {{
-        "Nm": "{payment_details.payee_name}",
-        "AccDet": "{payment_details.account_no}",
-        "Mode": "{payment_details.mode_of_payment}",
-        "FinInsBr": "{payment_details.ifsc_code}",
-        "PayTerm": "{payment_details.terms}",
-        "PaidAmt": "{payment_details.paid_amount}",
-        "PaymtDue": "{payment_details.outstanding_amount}"
-    }},
-    "RefDtls": {{
-        "DocPerdDtls": {{
-            "InvStDt": "{period_details.start_date}",
-            "InvEndDt": "{period_details.end_date}"
-        }},
-        "PrecDocDtls": [{{
-            "InvNo": "{prev_doc_details.invoice_name}",
-            "InvDt": "{prev_doc_details.invoice_date}"
-        }}]
-    }},
-    "ExpDtls": {{
-        "ShipBNo": "{export_details.bill_no}",
-        "ShipBDt": "{export_details.bill_date}",
-        "Port": "{export_details.port}",
-        "ForCur": "{export_details.foreign_curr_code}",
-        "CntCode": "{export_details.country_code}",
-        "ExpDuty": "{export_details.export_duty}"
-    }},
-    "EwbDtls": {{
-        "TransId": "{eway_bill_details.gstin}",
-        "TransName": "{eway_bill_details.name}",
-        "TransMode": "{eway_bill_details.mode_of_transport}",
-        "Distance": "{eway_bill_details.distance}",
-        "TransDocNo": "{eway_bill_details.document_name}",
-        "TransDocDt": "{eway_bill_details.document_date}",
-        "VehNo": "{eway_bill_details.vehicle_no}",
-        "VehType": "{eway_bill_details.vehicle_type}"
-    }}
-}}
\ No newline at end of file
diff --git a/erpnext/regional/india/e_invoice/einv_validation.json b/erpnext/regional/india/e_invoice/einv_validation.json
deleted file mode 100644
index f4a3542..0000000
--- a/erpnext/regional/india/e_invoice/einv_validation.json
+++ /dev/null
@@ -1,957 +0,0 @@
-{
-  "Version": {
-    "type": "string",
-    "minLength": 1,
-    "maxLength": 6,
-    "description": "Version of the schema"
-  },
-  "Irn": {
-    "type": "string",
-    "minLength": 64,
-    "maxLength": 64,
-    "description": "Invoice Reference Number"
-  },
-  "TranDtls": {
-    "type": "object",
-    "properties": {
-      "TaxSch": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 10,
-        "enum": ["GST"],
-        "description": "GST- Goods and Services Tax Scheme"
-      },
-      "SupTyp": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 10,
-        "enum": ["B2B", "SEZWP", "SEZWOP", "EXPWP", "EXPWOP", "DEXP"],
-        "description": "Type of Supply: B2B-Business to Business, SEZWP - SEZ with payment, SEZWOP - SEZ without payment, EXPWP - Export with Payment, EXPWOP - Export without payment,DEXP - Deemed Export"
-      },
-      "RegRev": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 1,
-        "enum": ["Y", "N"],
-        "description": "Y- whether the tax liability is payable under reverse charge"
-      },
-      "EcmGstin": {
-        "type": "string",
-        "minLength": 15,
-        "maxLength": 15,
-        "pattern": "([0-9]{2}[0-9A-Z]{13})",
-        "description": "E-Commerce GSTIN",
-        "validationMsg": "E-Commerce GSTIN is invalid"
-      },
-      "IgstOnIntra": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 1,
-        "enum": ["Y", "N"],
-        "description": "Y- indicates the supply is intra state but chargeable to IGST"
-      }
-    },
-    "required": ["TaxSch", "SupTyp"]
-  },
-  "DocDtls": {
-    "type": "object",
-    "properties": {
-      "Typ": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 3,
-        "enum": ["INV", "CRN", "DBN"],
-        "description": "Document Type"
-      },
-      "No": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 16,
-        "pattern": "^([A-Z1-9]{1}[A-Z0-9/-]{0,15})$",
-        "description": "Document Number",
-        "validationMsg": "Document Number should not be starting with 0, / and -"
-      },
-      "Dt": {
-        "type": "string",
-        "minLength": 10,
-        "maxLength": 10,
-        "pattern": "[0-3][0-9]/[0-1][0-9]/[2][0][1-2][0-9]",
-        "description": "Document Date"
-      }
-    },
-    "required": ["Typ", "No", "Dt"]
-  },
-  "SellerDtls": {
-    "type": "object",
-    "properties": {
-      "Gstin": {
-        "type": "string",
-        "minLength": 15,
-        "maxLength": 15,
-        "pattern": "([0-9]{2}[0-9A-Z]{13})",
-        "description": "Supplier GSTIN",
-        "validationMsg": "Company GSTIN is invalid"
-      },
-      "LglNm": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Legal Name"
-      },
-      "TrdNm": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Tradename"
-      },
-      "Addr1": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 100,
-        "description": "Address Line 1"
-      },
-      "Addr2": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Address Line 2"
-      },
-      "Loc": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 50,
-        "description": "Location"
-      },
-      "Pin": {
-        "type": "number",
-        "minimum": 100000,
-        "maximum": 999999,
-        "description": "Pincode"
-      },
-      "Stcd": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 2,
-        "description": "Supplier State Code"
-      },
-      "Ph": {
-        "type": "string",
-        "minLength": 6,
-        "maxLength": 12,
-        "description": "Phone"
-      },
-      "Em": {
-        "type": "string",
-        "minLength": 6,
-        "maxLength": 100,
-        "description": "Email-Id"
-      }
-    },
-    "required": ["Gstin", "LglNm", "Addr1", "Loc", "Pin", "Stcd"]
-  },
-  "BuyerDtls": {
-    "type": "object",
-    "properties": {
-      "Gstin": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 15,
-        "pattern": "^(([0-9]{2}[0-9A-Z]{13})|URP)$",
-        "description": "Buyer GSTIN",
-        "validationMsg": "Customer GSTIN is invalid"
-      },
-      "LglNm": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Legal Name"
-      },
-      "TrdNm": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Trade Name"
-      },
-      "Pos": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 2,
-        "description": "Place of Supply State code"
-      },
-      "Addr1": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 100,
-        "description": "Address Line 1"
-      },
-      "Addr2": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Address Line 2"
-      },
-      "Loc": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Location"
-      },
-      "Pin": {
-        "type": "number",
-        "minimum": 100000,
-        "maximum": 999999,
-        "description": "Pincode"
-      },
-      "Stcd": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 2,
-        "description": "Buyer State Code"
-      },
-      "Ph": {
-        "type": "string",
-        "minLength": 6,
-        "maxLength": 12,
-        "description": "Phone"
-      },
-      "Em": {
-        "type": "string",
-        "minLength": 6,
-        "maxLength": 100,
-        "description": "Email-Id"
-      }
-    },
-    "required": ["Gstin", "LglNm", "Pos", "Addr1", "Loc", "Stcd"]
-  },
-  "DispDtls": {
-    "type": "object",
-    "properties": {
-      "Nm": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Dispatch Address Name"
-      },
-      "Addr1": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 100,
-        "description": "Address Line 1"
-      },
-      "Addr2": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Address Line 2"
-      },
-      "Loc": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Location"
-      },
-      "Pin": {
-        "type": "number",
-        "minimum": 100000,
-        "maximum": 999999,
-        "description": "Pincode"
-      },
-      "Stcd": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 2,
-        "description": "State Code"
-      }
-    },
-    "required": ["Nm", "Addr1", "Loc", "Pin", "Stcd"]
-  },
-  "ShipDtls": {
-    "type": "object",
-    "properties": {
-      "Gstin": {
-        "type": "string",
-        "maxLength": 15,
-        "minLength": 3,
-        "pattern": "^(([0-9]{2}[0-9A-Z]{13})|URP)$",
-        "description": "Shipping Address GSTIN",
-        "validationMsg": "Shipping Address GSTIN is invalid"
-      },
-      "LglNm": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Legal Name"
-      },
-      "TrdNm": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Trade Name"
-      },
-      "Addr1": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 100,
-        "description": "Address Line 1"
-      },
-      "Addr2": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Address Line 2"
-      },
-      "Loc": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Location"
-      },
-      "Pin": {
-        "type": "number",
-        "minimum": 100000,
-        "maximum": 999999,
-        "description": "Pincode"
-      },
-      "Stcd": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 2,
-        "description": "State Code"
-      }
-    },
-    "required": ["LglNm", "Addr1", "Loc", "Pin", "Stcd"]
-  },
-  "ItemList": {
-    "type": "Array",
-    "properties": {
-      "SlNo": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 6,
-        "description": "Serial No. of Item"
-      },
-      "PrdDesc": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 300,
-        "description": "Item Name"
-      },
-      "IsServc": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 1,
-        "enum": ["Y", "N"],
-        "description": "Is Service Item"
-      },
-      "HsnCd": {
-        "type": "string",
-        "minLength": 4,
-        "maxLength": 8,
-        "description": "HSN Code"
-      },
-      "Barcde": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 30,
-        "description": "Barcode"
-      },
-      "Qty": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 9999999999.999,
-        "description": "Quantity"
-      },
-      "FreeQty": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 9999999999.999,
-        "description": "Free Quantity"
-      },
-      "Unit": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 8,
-        "description": "UOM"
-      },
-      "UnitPrice": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.999,
-        "description": "Rate"
-      },
-      "TotAmt": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.99,
-        "description": "Gross Amount"
-      },
-      "Discount": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.99,
-        "description": "Discount"
-      },
-      "PreTaxVal": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.99,
-        "description": "Pre tax value"
-      },
-      "AssAmt": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.99,
-        "description": "Taxable Value"
-      },
-      "GstRt": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999.999,
-        "description": "GST Rate"
-      },
-      "IgstAmt": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.99,
-        "description": "IGST Amount"
-      },
-      "CgstAmt": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.99,
-        "description": "CGST Amount"
-      },
-      "SgstAmt": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.99,
-        "description": "SGST Amount"
-      },
-      "CesRt": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999.999,
-        "description": "Cess Rate"
-      },
-      "CesAmt": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.99,
-        "description": "Cess Amount (Advalorem)"
-      },
-      "CesNonAdvlAmt": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.99,
-        "description": "Cess Amount (Non-Advalorem)"
-      },
-      "StateCesRt": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999.999,
-        "description": "State CESS Rate"
-      },
-      "StateCesAmt": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.99,
-        "description": "State CESS Amount"
-      },
-      "StateCesNonAdvlAmt": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.99,
-        "description": "State CESS Amount (Non Advalorem)"
-      },
-      "OthChrg": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.99,
-        "description": "Other Charges"
-      },
-      "TotItemVal": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.99,
-        "description": "Total Item Value"
-      },
-      "OrdLineRef": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 50,
-        "description": "Order line reference"
-      },
-      "OrgCntry": {
-        "type": "string",
-        "minLength": 2,
-        "maxLength": 2,
-        "description": "Origin Country"
-      },
-      "PrdSlNo": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 20,
-        "description": "Serial number"
-      },
-      "BchDtls": {
-        "type": "object",
-        "properties": {
-          "Nm": {
-            "type": "string",
-            "minLength": 3,
-            "maxLength": 20,
-            "description": "Batch number"
-          },
-          "ExpDt": {
-            "type": "string",
-            "maxLength": 10,
-            "minLength": 10,
-            "pattern": "[0-3][0-9]/[0-1][0-9]/[2][0][1-2][0-9]",
-            "description": "Batch Expiry Date"
-          },
-          "WrDt": {
-            "type": "string",
-            "maxLength": 10,
-            "minLength": 10,
-            "pattern": "[0-3][0-9]/[0-1][0-9]/[2][0][1-2][0-9]",
-            "description": "Warranty Date"
-          }
-        },
-        "required": ["Nm"]
-      },
-      "AttribDtls": {
-        "type": "Array",
-        "Attribute": {
-          "type": "object",
-          "properties": {
-            "Nm": {
-              "type": "string",
-              "minLength": 1,
-              "maxLength": 100,
-              "description": "Attribute name of the item"
-            },
-            "Val": {
-              "type": "string",
-              "minLength": 1,
-              "maxLength": 100,
-              "description": "Attribute value of the item"
-            }
-          }
-        }
-      }
-    },
-    "required": [
-      "SlNo",
-      "IsServc",
-      "HsnCd",
-      "UnitPrice",
-      "TotAmt",
-      "AssAmt",
-      "GstRt",
-      "TotItemVal"
-    ]
-  },
-  "ValDtls": {
-    "type": "object",
-    "properties": {
-      "AssVal": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 99999999999999.99,
-        "description": "Total Assessable value of all items"
-      },
-      "CgstVal": {
-        "type": "number",
-        "maximum": 99999999999999.99,
-        "minimum": 0,
-        "description": "Total CGST value of all items"
-      },
-      "SgstVal": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 99999999999999.99,
-        "description": "Total SGST value of all items"
-      },
-      "IgstVal": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 99999999999999.99,
-        "description": "Total IGST value of all items"
-      },
-      "CesVal": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 99999999999999.99,
-        "description": "Total CESS value of all items"
-      },
-      "StCesVal": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 99999999999999.99,
-        "description": "Total State CESS value of all items"
-      },
-      "Discount": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 99999999999999.99,
-        "description": "Invoice Discount"
-      },
-      "OthChrg": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 99999999999999.99,
-        "description": "Other Charges"
-      },
-      "RndOffAmt": {
-        "type": "number",
-        "minimum": -99.99,
-        "maximum": 99.99,
-        "description": "Rounded off Amount"
-      },
-      "TotInvVal": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 99999999999999.99,
-        "description": "Final Invoice Value "
-      },
-      "TotInvValFc": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 99999999999999.99,
-        "description": "Final Invoice value in Foreign Currency"
-      }
-    },
-    "required": ["AssVal", "TotInvVal"]
-  },
-  "PayDtls": {
-    "type": "object",
-    "properties": {
-      "Nm": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 100,
-        "description": "Payee Name"
-      },
-      "AccDet": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 18,
-        "description": "Bank Account Number of Payee"
-      },
-      "Mode": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 18,
-        "description": "Mode of Payment"
-      },
-      "FinInsBr": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 11,
-        "description": "Branch or IFSC code"
-      },
-      "PayTerm": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 100,
-        "description": "Terms of Payment"
-      },
-      "PayInstr": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 100,
-        "description": "Payment Instruction"
-      },
-      "CrTrn": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 100,
-        "description": "Credit Transfer"
-      },
-      "DirDr": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 100,
-        "description": "Direct Debit"
-      },
-      "CrDay": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 9999,
-        "description": "Credit Days"
-      },
-      "PaidAmt": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 99999999999999.99,
-        "description": "Advance Amount"
-      },
-      "PaymtDue": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 99999999999999.99,
-        "description": "Outstanding Amount"
-      }
-    }
-  },
-  "RefDtls": {
-    "type": "object",
-    "properties": {
-      "InvRm": {
-        "type": "string",
-        "maxLength": 100,
-        "minLength": 3,
-        "pattern": "^[0-9A-Za-z/-]{3,100}$",
-        "description": "Remarks/Note"
-      },
-      "DocPerdDtls": {
-        "type": "object",
-        "properties": {
-          "InvStDt": {
-            "type": "string",
-            "maxLength": 10,
-            "minLength": 10,
-            "pattern": "[0-3][0-9]/[0-1][0-9]/[2][0][1-2][0-9]",
-            "description": "Invoice Period Start Date"
-          },
-          "InvEndDt": {
-            "type": "string",
-            "maxLength": 10,
-            "minLength": 10,
-            "pattern": "[0-3][0-9]/[0-1][0-9]/[2][0][1-2][0-9]",
-            "description": "Invoice Period End Date"
-          }
-        },
-        "required": ["InvStDt ", "InvEndDt "]
-      },
-      "PrecDocDtls": {
-        "type": "object",
-        "properties": {
-          "InvNo": {
-            "type": "string",
-            "minLength": 1,
-            "maxLength": 16,
-            "pattern": "^[1-9A-Z]{1}[0-9A-Z/-]{1,15}$",
-            "description": "Reference of Original Invoice"
-          },
-          "InvDt": {
-            "type": "string",
-            "maxLength": 10,
-            "minLength": 10,
-            "pattern": "[0-3][0-9]/[0-1][0-9]/[2][0][1-2][0-9]",
-            "description": "Date of Orginal Invoice"
-          },
-          "OthRefNo": {
-            "type": "string",
-            "minLength": 1,
-            "maxLength": 20,
-            "description": "Other Reference"
-          }
-        }
-      },
-      "required": ["InvNo", "InvDt"],
-      "ContrDtls": {
-        "type": "object",
-        "properties": {
-          "RecAdvRefr": {
-            "type": "string",
-            "minLength": 1,
-            "maxLength": 20,
-            "pattern": "^([0-9A-Za-z/-]){1,20}$",
-            "description": "Receipt Advice No."
-          },
-          "RecAdvDt": {
-            "type": "string",
-            "minLength": 10,
-            "maxLength": 10,
-            "pattern": "[0-3][0-9]/[0-1][0-9]/[2][0][1-2][0-9]",
-            "description": "Date of receipt advice"
-          },
-          "TendRefr": {
-            "type": "string",
-            "minLength": 1,
-            "maxLength": 20,
-            "pattern": "^([0-9A-Za-z/-]){1,20}$",
-            "description": "Lot/Batch Reference No."
-          },
-          "ContrRefr": {
-            "type": "string",
-            "minLength": 1,
-            "maxLength": 20,
-            "pattern": "^([0-9A-Za-z/-]){1,20}$",
-            "description": "Contract Reference Number"
-          },
-          "ExtRefr": {
-            "type": "string",
-            "minLength": 1,
-            "maxLength": 20,
-            "pattern": "^([0-9A-Za-z/-]){1,20}$",
-            "description": "Any other reference"
-          },
-          "ProjRefr": {
-            "type": "string",
-            "minLength": 1,
-            "maxLength": 20,
-            "pattern": "^([0-9A-Za-z/-]){1,20}$",
-            "description": "Project Reference Number"
-          },
-          "PORefr": {
-            "type": "string",
-            "minLength": 1,
-            "maxLength": 16,
-            "pattern": "^([0-9A-Za-z/-]){1,16}$",
-            "description": "PO Reference Number"
-          },
-          "PORefDt": {
-            "type": "string",
-            "minLength": 10,
-            "maxLength": 10,
-            "pattern": "[0-3][0-9]/[0-1][0-9]/[2][0][1-2][0-9]",
-            "description": "PO Reference date"
-          }
-        }
-      }
-    }
-  },
-  "AddlDocDtls": {
-    "type": "Array",
-    "properties": {
-      "Url": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Supporting document URL"
-      },
-      "Docs": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 1000,
-        "description": "Supporting document in Base64 Format"
-      },
-      "Info": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 1000,
-        "description": "Any additional information"
-      }
-    }
-  },
-
-  "ExpDtls": {
-    "type": "object",
-    "properties": {
-      "ShipBNo": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 20,
-        "description": "Shipping Bill No."
-      },
-      "ShipBDt": {
-        "type": "string",
-        "minLength": 10,
-        "maxLength": 10,
-        "pattern": "[0-3][0-9]/[0-1][0-9]/[2][0][1-2][0-9]",
-        "description": "Shipping Bill Date"
-      },
-      "Port": {
-        "type": "string",
-        "minLength": 2,
-        "maxLength": 10,
-        "pattern": "^[0-9A-Za-z]{2,10}$",
-        "description": "Port Code. Refer the master"
-      },
-      "RefClm": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 1,
-        "description": "Claiming Refund. Y/N"
-      },
-      "ForCur": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 16,
-        "description": "Additional Currency Code. Refer the master"
-      },
-      "CntCode": {
-        "type": "string",
-        "minLength": 2,
-        "maxLength": 2,
-        "description": "Country Code. Refer the master"
-      },
-      "ExpDuty": {
-        "type": "number",
-        "minimum": 0,
-        "maximum": 999999999999.99,
-        "description": "Export Duty"
-      }
-    }
-  },
-  "EwbDtls": {
-    "type": "object",
-    "properties": {
-      "TransId": {
-        "type": "string",
-        "minLength": 15,
-        "maxLength": 15,
-        "description": "Transporter GSTIN"
-      },
-      "TransName": {
-        "type": "string",
-        "minLength": 3,
-        "maxLength": 100,
-        "description": "Transporter Name"
-      },
-      "TransMode": {
-        "type": "string",
-        "maxLength": 1,
-        "minLength": 1,
-        "enum": ["1", "2", "3", "4"],
-        "description": "Mode of Transport"
-      },
-      "Distance": {
-        "type": "number",
-        "minimum": 1,
-        "maximum": 9999,
-        "description": "Distance"
-      },
-      "TransDocNo": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 15,
-        "pattern": "^([0-9A-Z/-]){1,15}$",
-        "description": "Tranport Document Number",
-        "validationMsg": "Transport Receipt No is invalid"
-      },
-      "TransDocDt": {
-        "type": "string",
-        "minLength": 10,
-        "maxLength": 10,
-        "pattern": "[0-3][0-9]/[0-1][0-9]/[2][0][1-2][0-9]",
-        "description": "Transport Document Date"
-      },
-      "VehNo": {
-        "type": "string",
-        "minLength": 4,
-        "maxLength": 20,
-        "description": "Vehicle Number"
-      },
-      "VehType": {
-        "type": "string",
-        "minLength": 1,
-        "maxLength": 1,
-        "enum": ["O", "R"],
-        "description": "Vehicle Type"
-      }
-    },
-    "required": ["Distance"]
-  },
-  "required": [
-    "Version",
-    "TranDtls",
-    "DocDtls",
-    "SellerDtls",
-    "BuyerDtls",
-    "ItemList",
-    "ValDtls"
-  ]
-}
diff --git a/erpnext/regional/india/e_invoice/einvoice.js b/erpnext/regional/india/e_invoice/einvoice.js
deleted file mode 100644
index 8ad30fa..0000000
--- a/erpnext/regional/india/e_invoice/einvoice.js
+++ /dev/null
@@ -1,292 +0,0 @@
-erpnext.setup_einvoice_actions = (doctype) => {
-	frappe.ui.form.on(doctype, {
-		async refresh(frm) {
-			if (frm.doc.docstatus == 2) return;
-
-			const res = await frappe.call({
-				method: 'erpnext.regional.india.e_invoice.utils.validate_eligibility',
-				args: { doc: frm.doc }
-			});
-			const invoice_eligible = res.message;
-
-			if (!invoice_eligible) return;
-
-			const { doctype, irn, irn_cancelled, ewaybill, eway_bill_cancelled, name, __unsaved } = frm.doc;
-
-			const add_custom_button = (label, action) => {
-				if (!frm.custom_buttons[label]) {
-					frm.add_custom_button(label, action, __('E Invoicing'));
-				}
-			};
-
-			if (!irn && !__unsaved) {
-				const action = () => {
-					if (frm.doc.__unsaved) {
-						frappe.throw(__('Please save the document to generate IRN.'));
-					}
-					frappe.call({
-						method: 'erpnext.regional.india.e_invoice.utils.get_einvoice',
-						args: { doctype, docname: name },
-						freeze: true,
-						callback: (res) => {
-							const einvoice = res.message;
-							show_einvoice_preview(frm, einvoice);
-						}
-					});
-				};
-
-				add_custom_button(__("Generate IRN"), action);
-			}
-
-			if (irn && !irn_cancelled && !ewaybill) {
-				const fields = [
-					{
-						"label": "Reason",
-						"fieldname": "reason",
-						"fieldtype": "Select",
-						"reqd": 1,
-						"default": "1-Duplicate",
-						"options": ["1-Duplicate", "2-Data Entry Error", "3-Order Cancelled", "4-Other"]
-					},
-					{
-						"label": "Remark",
-						"fieldname": "remark",
-						"fieldtype": "Data",
-						"reqd": 1
-					}
-				];
-				const action = () => {
-					const d = new frappe.ui.Dialog({
-						title: __("Cancel IRN"),
-						fields: fields,
-						primary_action: function() {
-							const data = d.get_values();
-							frappe.call({
-								method: 'erpnext.regional.india.e_invoice.utils.cancel_irn',
-								args: {
-									doctype,
-									docname: name,
-									irn: irn,
-									reason: data.reason.split('-')[0],
-									remark: data.remark
-								},
-								freeze: true,
-								callback: () => frm.reload_doc() || d.hide(),
-								error: () => d.hide()
-							});
-						},
-						primary_action_label: __('Submit')
-					});
-					d.show();
-				};
-				add_custom_button(__("Cancel IRN"), action);
-			}
-
-			if (irn && !irn_cancelled && !ewaybill) {
-				const action = () => {
-					const d = new frappe.ui.Dialog({
-						title: __('Generate E-Way Bill'),
-						size: "large",
-						fields: get_ewaybill_fields(frm),
-						primary_action: function() {
-							const data = d.get_values();
-							frappe.call({
-								method: 'erpnext.regional.india.e_invoice.utils.generate_eway_bill',
-								args: {
-									doctype,
-									docname: name,
-									irn,
-									...data
-								},
-								freeze: true,
-								callback: () => frm.reload_doc() || d.hide(),
-								error: () => d.hide()
-							});
-						},
-						primary_action_label: __('Submit')
-					});
-					d.show();
-				};
-
-				add_custom_button(__("Generate E-Way Bill"), action);
-			}
-
-			if (irn && ewaybill && !irn_cancelled && !eway_bill_cancelled) {
-				const action = () => {
-					let message = __('Cancellation of e-way bill is currently not supported.') + ' ';
-					message += '<br><br>';
-					message += __('You must first use the portal to cancel the e-way bill and then update the cancelled status in the ERPNext system.');
-
-					const dialog = frappe.msgprint({
-						title: __('Update E-Way Bill Cancelled Status?'),
-						message: message,
-						indicator: 'orange',
-						primary_action: {
-							action: function() {
-								frappe.call({
-									method: 'erpnext.regional.india.e_invoice.utils.cancel_eway_bill',
-									args: { doctype, docname: name },
-									freeze: true,
-									callback: () => frm.reload_doc() || dialog.hide()
-								});
-							}
-						},
-						primary_action_label: __('Yes')
-					});
-				};
-				add_custom_button(__("Cancel E-Way Bill"), action);
-			}
-		}
-	});
-};
-
-const get_ewaybill_fields = (frm) => {
-	return [
-		{
-			'fieldname': 'transporter',
-			'label': 'Transporter',
-			'fieldtype': 'Link',
-			'options': 'Supplier',
-			'default': frm.doc.transporter
-		},
-		{
-			'fieldname': 'gst_transporter_id',
-			'label': 'GST Transporter ID',
-			'fieldtype': 'Data',
-			'fetch_from': 'transporter.gst_transporter_id',
-			'default': frm.doc.gst_transporter_id
-		},
-		{
-			'fieldname': 'driver',
-			'label': 'Driver',
-			'fieldtype': 'Link',
-			'options': 'Driver',
-			'default': frm.doc.driver
-		},
-		{
-			'fieldname': 'lr_no',
-			'label': 'Transport Receipt No',
-			'fieldtype': 'Data',
-			'default': frm.doc.lr_no
-		},
-		{
-			'fieldname': 'vehicle_no',
-			'label': 'Vehicle No',
-			'fieldtype': 'Data',
-			'default': frm.doc.vehicle_no
-		},
-		{
-			'fieldname': 'distance',
-			'label': 'Distance (in km)',
-			'fieldtype': 'Float',
-			'default': frm.doc.distance
-		},
-		{
-			'fieldname': 'transporter_col_break',
-			'fieldtype': 'Column Break',
-		},
-		{
-			'fieldname': 'transporter_name',
-			'label': 'Transporter Name',
-			'fieldtype': 'Data',
-			'fetch_from': 'transporter.name',
-			'read_only': 1,
-			'default': frm.doc.transporter_name
-		},
-		{
-			'fieldname': 'mode_of_transport',
-			'label': 'Mode of Transport',
-			'fieldtype': 'Select',
-			'options': `\nRoad\nAir\nRail\nShip`,
-			'default': frm.doc.mode_of_transport
-		},
-		{
-			'fieldname': 'driver_name',
-			'label': 'Driver Name',
-			'fieldtype': 'Data',
-			'fetch_from': 'driver.full_name',
-			'read_only': 1,
-			'default': frm.doc.driver_name
-		},
-		{
-			'fieldname': 'lr_date',
-			'label': 'Transport Receipt Date',
-			'fieldtype': 'Date',
-			'default': frm.doc.lr_date
-		},
-		{
-			'fieldname': 'gst_vehicle_type',
-			'label': 'GST Vehicle Type',
-			'fieldtype': 'Select',
-			'options': `Regular\nOver Dimensional Cargo (ODC)`,
-			'depends_on': 'eval:(doc.mode_of_transport === "Road")',
-			'default': frm.doc.gst_vehicle_type
-		}
-	];
-};
-
-const request_irn_generation = (frm) => {
-	frappe.call({
-		method: 'erpnext.regional.india.e_invoice.utils.generate_irn',
-		args: { doctype: frm.doc.doctype, docname: frm.doc.name },
-		freeze: true,
-		callback: () => frm.reload_doc()
-	});
-};
-
-const get_preview_dialog = (frm, action) => {
-	const dialog = new frappe.ui.Dialog({
-		title: __("Preview"),
-		size: "large",
-		fields: [
-			{
-				"label": "Preview",
-				"fieldname": "preview_html",
-				"fieldtype": "HTML"
-			}
-		],
-		primary_action: () => action(frm) || dialog.hide(),
-		primary_action_label: __('Generate IRN')
-	});
-	return dialog;
-};
-
-const show_einvoice_preview = (frm, einvoice) => {
-	const preview_dialog = get_preview_dialog(frm, request_irn_generation);
-
-	// initialize e-invoice fields
-	einvoice["Irn"] = einvoice["AckNo"] = ''; einvoice["AckDt"] = frappe.datetime.nowdate();
-	frm.doc.signed_einvoice = JSON.stringify(einvoice);
-
-	// initialize preview wrapper
-	const $preview_wrapper = preview_dialog.get_field("preview_html").$wrapper;
-	$preview_wrapper.html(
-		`<div>
-			<div class="print-preview">
-				<div class="print-format"></div>
-			</div>
-			<div class="page-break-message text-muted text-center text-medium margin-top"></div>
-		</div>`
-	);
-
-	frappe.call({
-		method: "frappe.www.printview.get_html_and_style",
-		args: {
-			doc: frm.doc,
-			print_format: "GST E-Invoice",
-			no_letterhead: 1
-		},
-		callback: function (r) {
-			if (!r.exc) {
-				$preview_wrapper.find(".print-format").html(r.message.html);
-				const style = `
-					.print-format { box-shadow: 0px 0px 5px rgba(0,0,0,0.2); padding: 0.30in; min-height: 80vh; }
-					.print-preview { min-height: 0px; }
-					.modal-dialog { width: 720px; }`;
-
-				frappe.dom.set_style(style, "custom-print-style");
-				preview_dialog.show();
-			}
-		}
-	});
-};
\ No newline at end of file
diff --git a/erpnext/regional/india/e_invoice/utils.py b/erpnext/regional/india/e_invoice/utils.py
index fa7e88d..765b51f 100644
--- a/erpnext/regional/india/e_invoice/utils.py
+++ b/erpnext/regional/india/e_invoice/utils.py
@@ -388,7 +388,7 @@
 		frappe.throw(_('Total Taxable Value of the items is not equal to the Invoice Net Total. Please check item taxes / discounts for any correction.'))
 
 	if abs(
-		flt(value_details['TotInvVal']) + flt(value_details['Discount']) - 
+		flt(value_details['TotInvVal']) + flt(value_details['Discount']) -
 		flt(value_details['OthChrg']) - flt(value_details['RndOffAmt']) -
 		total_item_value) > 1:
 		frappe.throw(_('Total Value of the items is not equal to the Invoice Grand Total. Please check item taxes / discounts for any correction.'))
diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py
index 2d6b913..4db5551 100644
--- a/erpnext/regional/india/setup.py
+++ b/erpnext/regional/india/setup.py
@@ -61,7 +61,7 @@
 
 def add_custom_roles_for_reports():
 	for report_name in ('GST Sales Register', 'GST Purchase Register',
-		'GST Itemised Sales Register', 'GST Itemised Purchase Register', 'Eway Bill', 'E-Invoice Summary'):
+		'GST Itemised Sales Register', 'GST Itemised Purchase Register', 'Eway Bill'):
 
 		if not frappe.db.get_value('Custom Role', dict(report=report_name)):
 			frappe.get_doc(dict(
@@ -100,7 +100,7 @@
 			)).insert()
 
 def add_permissions():
-	for doctype in ('GST HSN Code', 'GST Settings', 'GSTR 3B Report', 'Lower Deduction Certificate', 'E Invoice Settings'):
+	for doctype in ('GST HSN Code', 'GST Settings', 'GSTR 3B Report', 'Lower Deduction Certificate'):
 		add_permission(doctype, 'All', 0)
 		for role in ('Accounts Manager', 'Accounts User', 'System Manager'):
 			add_permission(doctype, role, 0)
@@ -116,11 +116,9 @@
 def add_print_formats():
 	frappe.reload_doc("regional", "print_format", "gst_tax_invoice")
 	frappe.reload_doc("accounts", "print_format", "gst_pos_invoice")
-	frappe.reload_doc("accounts", "print_format", "GST E-Invoice")
 
 	frappe.db.set_value("Print Format", "GST POS Invoice", "disabled", 0)
 	frappe.db.set_value("Print Format", "GST Tax Invoice", "disabled", 0)
-	frappe.db.set_value("Print Format", "GST E-Invoice", "disabled", 0)
 
 def make_property_setters(patch=False):
 	# GST rules do not allow for an invoice no. bigger than 16 characters
@@ -445,53 +443,13 @@
 			'fieldname': 'ewaybill',
 			'label': 'E-Way Bill No.',
 			'fieldtype': 'Data',
-			'depends_on': 'eval:((doc.docstatus === 1 || doc.ewaybill) && doc.eway_bill_cancelled === 0)',
+			'depends_on': 'eval:(doc.docstatus === 1)',
 			'allow_on_submit': 1,
 			'insert_after': 'tax_id',
 			'translatable': 0
 		}
 	]
 
-	si_einvoice_fields = [
-		dict(fieldname='irn', label='IRN', fieldtype='Data', read_only=1, insert_after='customer', no_copy=1, print_hide=1,
-			depends_on='eval:in_list(["Registered Regular", "SEZ", "Overseas", "Deemed Export"], doc.gst_category) && doc.irn_cancelled === 0'),
-
-		dict(fieldname='irn_cancelled', label='IRN Cancelled', fieldtype='Check', no_copy=1, print_hide=1,
-			depends_on='eval: doc.irn', allow_on_submit=1, insert_after='customer'),
-
-		dict(fieldname='eway_bill_validity', label='E-Way Bill Validity', fieldtype='Data', no_copy=1, print_hide=1,
-			depends_on='ewaybill', read_only=1, allow_on_submit=1, insert_after='ewaybill'),
-
-		dict(fieldname='eway_bill_cancelled', label='E-Way Bill Cancelled', fieldtype='Check', no_copy=1, print_hide=1,
-			depends_on='eval:(doc.eway_bill_cancelled === 1)', read_only=1, allow_on_submit=1, insert_after='customer'),
-
-		dict(fieldname='einvoice_section', label='E-Invoice Fields', fieldtype='Section Break', insert_after='gst_vehicle_type',
-			print_hide=1, hidden=1),
-
-		dict(fieldname='ack_no', label='Ack. No.', fieldtype='Data', read_only=1, hidden=1, insert_after='einvoice_section',
-			no_copy=1, print_hide=1),
-
-		dict(fieldname='ack_date', label='Ack. Date', fieldtype='Data', read_only=1, hidden=1, insert_after='ack_no', no_copy=1, print_hide=1),
-
-		dict(fieldname='irn_cancel_date', label='Cancel Date', fieldtype='Data', read_only=1, hidden=1, insert_after='ack_date',
-			no_copy=1, print_hide=1),
-
-		dict(fieldname='signed_einvoice', label='Signed E-Invoice', fieldtype='Code', options='JSON', hidden=1, insert_after='irn_cancel_date',
-			no_copy=1, print_hide=1, read_only=1),
-
-		dict(fieldname='signed_qr_code', label='Signed QRCode', fieldtype='Code', options='JSON', hidden=1, insert_after='signed_einvoice',
-			no_copy=1, print_hide=1, read_only=1),
-
-		dict(fieldname='qrcode_image', label='QRCode', fieldtype='Attach Image', hidden=1, insert_after='signed_qr_code',
-			no_copy=1, print_hide=1, read_only=1),
-
-		dict(fieldname='einvoice_status', label='E-Invoice Status', fieldtype='Select', insert_after='qrcode_image',
-			options='\nPending\nGenerated\nCancelled\nFailed', default=None, hidden=1, no_copy=1, print_hide=1, read_only=1),
-
-		dict(fieldname='failure_description', label='E-Invoice Failure Description', fieldtype='Code', options='JSON',
-			hidden=1, insert_after='einvoice_status', no_copy=1, print_hide=1, read_only=1)
-	]
-
 	custom_fields = {
 		'Address': [
 			dict(fieldname='gstin', label='Party GSTIN', fieldtype='Data',
@@ -504,7 +462,7 @@
 		'Purchase Invoice': purchase_invoice_gst_category + invoice_gst_fields + purchase_invoice_itc_fields + purchase_invoice_gst_fields,
 		'Purchase Order': purchase_invoice_gst_fields,
 		'Purchase Receipt': purchase_invoice_gst_fields,
-		'Sales Invoice': sales_invoice_gst_category + invoice_gst_fields + sales_invoice_shipping_fields + sales_invoice_gst_fields + si_ewaybill_fields + si_einvoice_fields,
+		'Sales Invoice': sales_invoice_gst_category + invoice_gst_fields + sales_invoice_shipping_fields + sales_invoice_gst_fields + si_ewaybill_fields,
 		'Delivery Note': sales_invoice_gst_fields + ewaybill_fields + sales_invoice_shipping_fields + delivery_note_gst_category,
 		'Journal Entry': journal_entry_fields,
 		'Sales Order': sales_invoice_gst_fields,
@@ -573,6 +531,7 @@
 				fieldtype='Link', options='Salary Component', insert_after='hra_section'),
 			dict(fieldname='hra_component', label='HRA Component',
 				fieldtype='Link', options='Salary Component', insert_after='basic_component'),
+			dict(fieldname='hra_column_break', fieldtype='Column Break', insert_after='hra_component'),
 			dict(fieldname='arrear_component', label='Arrear Component',
 				fieldtype='Link', options='Salary Component', insert_after='hra_component'),
 			dict(fieldname='non_profit_section', label='Non Profit Settings',
@@ -581,6 +540,7 @@
 				fieldtype='Data', insert_after='non_profit_section'),
 			dict(fieldname='with_effect_from', label='80G With Effect From',
 				fieldtype='Date', insert_after='company_80g_number'),
+			dict(fieldname='non_profit_column_break', fieldtype='Column Break', insert_after='with_effect_from'),
 			dict(fieldname='pan_details', label='PAN Number',
 				fieldtype='Data', insert_after='with_effect_from')
 		],
diff --git a/erpnext/regional/india/taxes.js b/erpnext/regional/india/taxes.js
index d3b7ea3..5f6dcde 100644
--- a/erpnext/regional/india/taxes.js
+++ b/erpnext/regional/india/taxes.js
@@ -49,4 +49,3 @@
 		}
 	});
 }
-
diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py
index a152797..ce5aa10 100644
--- a/erpnext/regional/india/utils.py
+++ b/erpnext/regional/india/utils.py
@@ -475,7 +475,7 @@
 		ewaybills.append(data)
 
 	data = {
-		'version': '1.0.1118',
+		'version': '1.0.0421',
 		'billLists': ewaybills
 	}
 
@@ -845,7 +845,7 @@
 		else:
 			depreciation_amount = (flt(row.value_after_depreciation) -
 				flt(row.expected_value_after_useful_life)) / (date_diff(asset.to_date, asset.available_for_use_date) / 365)
-		
+
 	else:
 		rate_of_depreciation = row.rate_of_depreciation
 		# if its the first depreciation
@@ -862,7 +862,7 @@
 	return depreciation_amount
 
 def set_item_tax_from_hsn_code(item):
-	if not item.taxes and item.gst_hsn_code: 
+	if not item.taxes and item.gst_hsn_code:
 		hsn_doc = frappe.get_doc("GST HSN Code", item.gst_hsn_code)
 
 		for tax in hsn_doc.taxes:
@@ -870,4 +870,21 @@
 				'item_tax_template': tax.item_tax_template,
 				'tax_category': tax.tax_category,
 				'valid_from': tax.valid_from
-			})
\ No newline at end of file
+			})
+
+def delete_gst_settings_for_company(doc, method):
+	if doc.country != 'India':
+		return
+
+	gst_settings = frappe.get_doc("GST Settings")
+	records_to_delete = []
+
+	for d in reversed(gst_settings.get('gst_accounts')):
+		if d.company == doc.name:
+			records_to_delete.append(d)
+
+	for d in records_to_delete:
+		gst_settings.remove(d)
+
+	gst_settings.save()
+
diff --git a/erpnext/regional/italy/__init__.py b/erpnext/regional/italy/__init__.py
index ef1d582..4932f66 100644
--- a/erpnext/regional/italy/__init__.py
+++ b/erpnext/regional/italy/__init__.py
@@ -76,4 +76,4 @@
  'Cagliari': 'CA', 'Siena': 'SI', 'Vibo Valentia': 'VV', 'Reggio Calabria': 'RC', 'Ascoli Piceno': 'AP', 'Carbonia-Iglesias': 'CI', 'Oristano': 'OR',
  'Asti': 'AT', 'Ravenna': 'RA', 'Vicenza': 'VI', 'Savona': 'SV', 'Biella': 'BI', 'Rimini': 'RN', 'Agrigento': 'AG', 'Prato': 'PO', 'Cuneo': 'CN',
  'Cosenza': 'CS', 'Livorno or Leghorn': 'LI', 'Sondrio': 'SO', 'Cremona': 'CR', 'Isernia': 'IS', 'Trento': 'TN', 'Terni': 'TR', 'Bolzano/Bozen': 'BZ',
- 'Parma': 'PR', 'Varese': 'VA', 'Venezia': 'VE', 'Sassari': 'SS', 'Arezzo': 'AR'}
\ No newline at end of file
+ 'Parma': 'PR', 'Varese': 'VA', 'Venezia': 'VE', 'Sassari': 'SS', 'Arezzo': 'AR'}
diff --git a/erpnext/regional/italy/utils.py b/erpnext/regional/italy/utils.py
index ba1aeaf..56f609e 100644
--- a/erpnext/regional/italy/utils.py
+++ b/erpnext/regional/italy/utils.py
@@ -6,9 +6,8 @@
 from frappe.utils import flt, cstr
 from erpnext.controllers.taxes_and_totals import get_itemised_tax
 from frappe import _
-from frappe.core.doctype.file.file import remove_file
+from frappe.utils.file_manager import remove_file
 from six import string_types
-from frappe.desk.form.load import get_attachments
 from erpnext.regional.italy import state_codes
 
 
diff --git a/erpnext/regional/print_format/detailed_tax_invoice/detailed_tax_invoice.json b/erpnext/regional/print_format/detailed_tax_invoice/detailed_tax_invoice.json
index ab56c6b..f67e245 100644
--- a/erpnext/regional/print_format/detailed_tax_invoice/detailed_tax_invoice.json
+++ b/erpnext/regional/print_format/detailed_tax_invoice/detailed_tax_invoice.json
@@ -16,7 +16,7 @@
  "name": "Detailed Tax Invoice", 
  "owner": "Administrator", 
  "print_format_builder": 1, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/regional/print_format/gst_tax_invoice/gst_tax_invoice.json b/erpnext/regional/print_format/gst_tax_invoice/gst_tax_invoice.json
index 7d8e675..b23206b 100644
--- a/erpnext/regional/print_format/gst_tax_invoice/gst_tax_invoice.json
+++ b/erpnext/regional/print_format/gst_tax_invoice/gst_tax_invoice.json
@@ -16,7 +16,7 @@
  "name": "GST Tax Invoice", 
  "owner": "Administrator", 
  "print_format_builder": 1, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/regional/print_format/simplified_tax_invoice/simplified_tax_invoice.json b/erpnext/regional/print_format/simplified_tax_invoice/simplified_tax_invoice.json
index b324f6e..aed2e89 100644
--- a/erpnext/regional/print_format/simplified_tax_invoice/simplified_tax_invoice.json
+++ b/erpnext/regional/print_format/simplified_tax_invoice/simplified_tax_invoice.json
@@ -16,7 +16,7 @@
  "name": "Simplified Tax Invoice", 
  "owner": "Administrator", 
  "print_format_builder": 1, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/regional/print_format/tax_invoice/tax_invoice.json b/erpnext/regional/print_format/tax_invoice/tax_invoice.json
index 74db067..7479891 100644
--- a/erpnext/regional/print_format/tax_invoice/tax_invoice.json
+++ b/erpnext/regional/print_format/tax_invoice/tax_invoice.json
@@ -16,7 +16,7 @@
  "name": "Tax Invoice", 
  "owner": "Administrator", 
  "print_format_builder": 1, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/regional/report/datev/datev.py b/erpnext/regional/report/datev/datev.py
index a5ca7ee..86aed2e 100644
--- a/erpnext/regional/report/datev/datev.py
+++ b/erpnext/regional/report/datev/datev.py
@@ -202,7 +202,7 @@
 		FROM `tabGL Entry` gl
 
 			/* Kontonummer */
-			left join `tabAccount` acc 
+			left join `tabAccount` acc
 			on gl.account = acc.name
 
 			left join `tabCustomer` cus
@@ -218,7 +218,7 @@
 			and par.parenttype = gl.party_type
 			and par.company = %(company)s
 
-		WHERE gl.company = %(company)s 
+		WHERE gl.company = %(company)s
 		AND DATE(gl.posting_date) >= %(from_date)s
 		AND DATE(gl.posting_date) <= %(to_date)s
 		{}
diff --git a/erpnext/regional/report/e_invoice_summary/__init__.py b/erpnext/regional/report/e_invoice_summary/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/regional/report/e_invoice_summary/__init__.py
+++ /dev/null
diff --git a/erpnext/regional/report/e_invoice_summary/e_invoice_summary.js b/erpnext/regional/report/e_invoice_summary/e_invoice_summary.js
deleted file mode 100644
index 4713217..0000000
--- a/erpnext/regional/report/e_invoice_summary/e_invoice_summary.js
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-/* eslint-disable */
-
-frappe.query_reports["E-Invoice Summary"] = {
-	"filters": [
-		{
-			"fieldtype": "Link",
-			"options": "Company",
-			"reqd": 1,
-			"fieldname": "company",
-			"label": __("Company"),
-			"default": frappe.defaults.get_user_default("Company"),
-		},
-		{
-			"fieldtype": "Link",
-			"options": "Customer",
-			"fieldname": "customer",
-			"label": __("Customer")
-		},
-		{
-			"fieldtype": "Date",
-			"reqd": 1,
-			"fieldname": "from_date",
-			"label": __("From Date"),
-			"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
-		},
-		{
-			"fieldtype": "Date",
-			"reqd": 1,
-			"fieldname": "to_date",
-			"label": __("To Date"),
-			"default": frappe.datetime.get_today(),
-		},
-		{
-			"fieldtype": "Select",
-			"fieldname": "status",
-			"label": __("Status"),
-			"options": "\nPending\nGenerated\nCancelled\nFailed"
-		}
-	],
-
-	"formatter": function (value, row, column, data, default_formatter) {
-		value = default_formatter(value, row, column, data);
-
-		if (column.fieldname == "einvoice_status" && value) {
-			if (value == 'Pending') value = `<span class="bold" style="color: var(--text-on-orange)">${value}</span>`;
-			else if (value == 'Generated') value = `<span class="bold" style="color: var(--text-on-green)">${value}</span>`;
-			else if (value == 'Cancelled') value = `<span class="bold" style="color: var(--text-on-red)">${value}</span>`;
-			else if (value == 'Failed') value = `<span class="bold"  style="color: var(--text-on-red)">${value}</span>`;
-		}
-
-		return value;
-	}
-};
diff --git a/erpnext/regional/report/e_invoice_summary/e_invoice_summary.json b/erpnext/regional/report/e_invoice_summary/e_invoice_summary.json
deleted file mode 100644
index d0000ad..0000000
--- a/erpnext/regional/report/e_invoice_summary/e_invoice_summary.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "add_total_row": 0,
- "columns": [],
- "creation": "2021-03-12 11:23:37.312294",
- "disable_prepared_report": 0,
- "disabled": 0,
- "docstatus": 0,
- "doctype": "Report",
- "filters": [],
- "idx": 0,
- "is_standard": "Yes",
- "json": "{}",
- "letter_head": "Logo",
- "modified": "2021-03-13 12:36:48.689413",
- "modified_by": "Administrator",
- "module": "Regional",
- "name": "E-Invoice Summary",
- "owner": "Administrator",
- "prepared_report": 0,
- "ref_doctype": "Sales Invoice",
- "report_name": "E-Invoice Summary",
- "report_type": "Script Report",
- "roles": [
-  {
-   "role": "Administrator"
-  }
- ]
-}
\ No newline at end of file
diff --git a/erpnext/regional/report/e_invoice_summary/e_invoice_summary.py b/erpnext/regional/report/e_invoice_summary/e_invoice_summary.py
deleted file mode 100644
index 47acf29..0000000
--- a/erpnext/regional/report/e_invoice_summary/e_invoice_summary.py
+++ /dev/null
@@ -1,106 +0,0 @@
-# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
-# For license information, please see license.txt
-
-from __future__ import unicode_literals
-import frappe
-from frappe import _
-
-def execute(filters=None):
-	validate_filters(filters)
-
-	columns = get_columns()
-	data = get_data(filters)
-
-	return columns, data
-
-def validate_filters(filters={}):
-	filters = frappe._dict(filters)
-
-	if not filters.company:
-		frappe.throw(_('{} is mandatory for generating E-Invoice Summary Report').format(_('Company')), title=_('Invalid Filter'))
-	if filters.company:
-		# validate if company has e-invoicing enabled
-		pass
-	if not filters.from_date or not filters.to_date:
-		frappe.throw(_('From Date & To Date is mandatory for generating E-Invoice Summary Report'), title=_('Invalid Filter'))
-	if filters.from_date > filters.to_date:
-		frappe.throw(_('From Date must be before To Date'), title=_('Invalid Filter'))
-
-def get_data(filters={}):
-	query_filters = {
-		'posting_date': ['between', [filters.from_date, filters.to_date]],
-		'einvoice_status': ['is', 'set'],
-		'company': filters.company
-	}
-	if filters.customer:
-		query_filters['customer'] = filters.customer
-	if filters.status:
-		query_filters['einvoice_status'] = filters.status
-
-	data = frappe.get_all(
-		'Sales Invoice',
-		filters=query_filters,
-		fields=[d.get('fieldname') for d in get_columns()]
-	)
-
-	return data
-
-def get_columns():
-	return [
-		{
-			"fieldtype": "Date",
-			"fieldname": "posting_date",
-			"label": _("Posting Date"),
-			"width": 0
-		},
-		{
-			"fieldtype": "Link", 
-			"fieldname": "name", 
-			"label": _("Sales Invoice"),
-			"options": "Sales Invoice",
-			"width": 140
-		},
-		{ 
-			"fieldtype": "Data", 
-			"fieldname": "einvoice_status", 
-			"label": _("Status"), 
-			"width": 100
-		},
-		{ 
-			"fieldtype": "Link",
-			"fieldname": "customer",
-			"options": "Customer",
-			"label": _("Customer")
-		},
-		{ 
-			"fieldtype": "Check",
-			"fieldname": "is_return",
-			"label": _("Is Return"),
-			"width": 85
-		},
-		{
-			"fieldtype": "Data", 
-			"fieldname": "ack_no", 
-			"label": "Ack. No.", 
-			"width": 145
-		},
-		{ 
-			"fieldtype": "Data", 
-			"fieldname": "ack_date", 
-			"label": "Ack. Date", 
-			"width": 165
-		},
-		{
-			"fieldtype": "Data", 
-			"fieldname": "irn", 
-			"label": _("IRN No."),
-			"width": 250
-		},
-		{
-			"fieldtype": "Currency",
-			"options": "Company:company:default_currency", 
-			"fieldname": "base_grand_total", 
-			"label": _("Grand Total"),
-			"width": 120
-		}
-	]
\ No newline at end of file
diff --git a/erpnext/regional/report/electronic_invoice_register/electronic_invoice_register.js b/erpnext/regional/report/electronic_invoice_register/electronic_invoice_register.js
index 67297f7..d7e3ac9 100644
--- a/erpnext/regional/report/electronic_invoice_register/electronic_invoice_register.js
+++ b/erpnext/regional/report/electronic_invoice_register/electronic_invoice_register.js
@@ -41,7 +41,7 @@
 
 			var w = window.open(
 				frappe.urllib.get_full_url(
-					"/api/method/erpnext.regional.italy.utils.export_invoices?" 
+					"/api/method/erpnext.regional.italy.utils.export_invoices?"
 					+ "filters=" + JSON.stringify(reportview.get_filter_values())
 				)
 			);
diff --git a/erpnext/regional/report/eway_bill/eway_bill.py b/erpnext/regional/report/eway_bill/eway_bill.py
index 5b9896b..4f777fc 100644
--- a/erpnext/regional/report/eway_bill/eway_bill.py
+++ b/erpnext/regional/report/eway_bill/eway_bill.py
@@ -388,4 +388,4 @@
 		},
 	]
 
-	return columns
\ No newline at end of file
+	return columns
diff --git a/erpnext/regional/report/gst_purchase_register/gst_purchase_register.js b/erpnext/regional/report/gst_purchase_register/gst_purchase_register.js
index 2b4359a..bbcd355 100644
--- a/erpnext/regional/report/gst_purchase_register/gst_purchase_register.js
+++ b/erpnext/regional/report/gst_purchase_register/gst_purchase_register.js
@@ -4,4 +4,4 @@
 
 {% include "erpnext/accounts/report/purchase_register/purchase_register.js" %}
 
-frappe.query_reports["GST Purchase Register"] = frappe.query_reports["Purchase Register"]
\ No newline at end of file
+frappe.query_reports["GST Purchase Register"] = frappe.query_reports["Purchase Register"]
diff --git a/erpnext/regional/report/gst_purchase_register/gst_purchase_register.py b/erpnext/regional/report/gst_purchase_register/gst_purchase_register.py
index 7274e0a..12e9676 100644
--- a/erpnext/regional/report/gst_purchase_register/gst_purchase_register.py
+++ b/erpnext/regional/report/gst_purchase_register/gst_purchase_register.py
@@ -21,4 +21,3 @@
 		'export_type',
 		'ecommerce_gstin'
 	])
-
diff --git a/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py
index 59389ce..1adddbd 100644
--- a/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py
+++ b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py
@@ -285,5 +285,3 @@
 		count +=1
 
 	return data
-
-
diff --git a/erpnext/regional/report/india_gst_common/india_gst_common.js b/erpnext/regional/report/india_gst_common/india_gst_common.js
index 4960601..bddc320 100644
--- a/erpnext/regional/report/india_gst_common/india_gst_common.js
+++ b/erpnext/regional/report/india_gst_common/india_gst_common.js
@@ -18,4 +18,4 @@
 		company_gstins.df.options = [""];
 		company_gstins.refresh();
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/regional/report/irs_1099/irs_1099.py b/erpnext/regional/report/irs_1099/irs_1099.py
index 4e57ff7..f67d622 100644
--- a/erpnext/regional/report/irs_1099/irs_1099.py
+++ b/erpnext/regional/report/irs_1099/irs_1099.py
@@ -52,7 +52,7 @@
 				AND gl.party_type = "Supplier"
 				AND gl.company = %(company)s
 				{conditions}
-			
+
 		GROUP BY
 			gl.party
 
diff --git a/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.js b/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.js
index 29c7dbf..bb75238 100644
--- a/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.js
+++ b/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.js
@@ -4,4 +4,4 @@
 
 frappe.require("assets/erpnext/js/salary_slip_deductions_report_filters.js", function() {
 	frappe.query_reports["Professional Tax Deductions"] = erpnext.salary_slip_deductions_report_filters;
-});
\ No newline at end of file
+});
diff --git a/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.py b/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.py
index acde68a..54808e5 100644
--- a/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.py
+++ b/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.py
@@ -69,4 +69,4 @@
 
 		data.append(employee)
 
-	return data
\ No newline at end of file
+	return data
diff --git a/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.js b/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.js
index b4dc28d..a91a307 100644
--- a/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.js
+++ b/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.js
@@ -4,4 +4,4 @@
 
 frappe.require("assets/erpnext/js/salary_slip_deductions_report_filters.js", function() {
 	frappe.query_reports["Provident Fund Deductions"] = erpnext.salary_slip_deductions_report_filters;
-});
\ No newline at end of file
+});
diff --git a/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.py b/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.py
index 597072c..82423f0 100644
--- a/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.py
+++ b/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.py
@@ -165,4 +165,4 @@
 	if not year_list:
 		year_list = [getdate().year]
 
-	return "\n".join(str(year) for year in year_list)
\ No newline at end of file
+	return "\n".join(str(year) for year in year_list)
diff --git a/erpnext/regional/report/uae_vat_201/uae_vat_201.html b/erpnext/regional/report/uae_vat_201/uae_vat_201.html
index d9b9968..7328f3f 100644
--- a/erpnext/regional/report/uae_vat_201/uae_vat_201.html
+++ b/erpnext/regional/report/uae_vat_201/uae_vat_201.html
@@ -74,4 +74,4 @@
         {% } %}
     </tbody>
 
-</table>
\ No newline at end of file
+</table>
diff --git a/erpnext/regional/report/vat_audit_report/vat_audit_report.py b/erpnext/regional/report/vat_audit_report/vat_audit_report.py
index 292605e..17aca17 100644
--- a/erpnext/regional/report/vat_audit_report/vat_audit_report.py
+++ b/erpnext/regional/report/vat_audit_report/vat_audit_report.py
@@ -189,7 +189,7 @@
 						row["posting_date"] = formatdate(inv_data.get("posting_date"), "dd-mm-yyyy")
 						row["voucher_type"] = doctype
 						row["voucher_no"] = inv
-						row["party_type"] = "Customer" if doctype == "Sales Invoice" else "Supplier" 
+						row["party_type"] = "Customer" if doctype == "Sales Invoice" else "Supplier"
 						row["party"] = inv_data.get("party")
 						row["remarks"] = inv_data.get("remarks")
 						row["gross_amount"]= item_details[0].get("gross_amount")
diff --git a/erpnext/regional/south_africa/setup.py b/erpnext/regional/south_africa/setup.py
index 4657ff8..8a75987 100644
--- a/erpnext/regional/south_africa/setup.py
+++ b/erpnext/regional/south_africa/setup.py
@@ -24,7 +24,7 @@
 		'Sales Invoice Item': is_zero_rated,
 		'Purchase Invoice Item': is_zero_rated
 	}
-	
+
 	create_custom_fields(custom_fields, update=update)
 
 def add_permissions():
@@ -36,7 +36,7 @@
 			add_permission(doctype, role, 0)
 			update_permission_property(doctype, role, 0, 'write', 1)
 			update_permission_property(doctype, role, 0, 'create', 1)
-	
+
 
 	if not frappe.db.get_value('Custom Role', dict(report="VAT Audit Report")):
 		frappe.get_doc(dict(
@@ -47,4 +47,4 @@
 				dict(role='Accounts Manager'),
 				dict(role='Auditor')
 			]
-		)).insert()
\ No newline at end of file
+		)).insert()
diff --git a/erpnext/regional/turkey/setup.py b/erpnext/regional/turkey/setup.py
index ebf3b2b..2396aab 100644
--- a/erpnext/regional/turkey/setup.py
+++ b/erpnext/regional/turkey/setup.py
@@ -1,4 +1,4 @@
 from __future__ import unicode_literals
 
 def setup(company=None, patch=True):
-    pass
\ No newline at end of file
+    pass
diff --git a/erpnext/restaurant/doctype/restaurant/restaurant_dashboard.py b/erpnext/restaurant/doctype/restaurant/restaurant_dashboard.py
index ec62ba2..adce5c7 100644
--- a/erpnext/restaurant/doctype/restaurant/restaurant_dashboard.py
+++ b/erpnext/restaurant/doctype/restaurant/restaurant_dashboard.py
@@ -14,4 +14,4 @@
 				'items': ['Restaurant Reservation', 'Sales Invoice']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/restaurant/doctype/restaurant/test_restaurant.js b/erpnext/restaurant/doctype/restaurant/test_restaurant.js
index 26de5d0..8fe4e7b 100644
--- a/erpnext/restaurant/doctype/restaurant/test_restaurant.js
+++ b/erpnext/restaurant/doctype/restaurant/test_restaurant.js
@@ -18,7 +18,7 @@
 
 	frappe.run_serially([
 		// insert a new Restaurant
-		() => frappe.tests.setup_doctype('Customer', customer),				
+		() => frappe.tests.setup_doctype('Customer', customer),
 		() => {
 			return frappe.tests.make('Restaurant', [
 				// values to be set
diff --git a/erpnext/restaurant/doctype/restaurant_menu/restaurant_menu.py b/erpnext/restaurant/doctype/restaurant_menu/restaurant_menu.py
index 83020b6..952c467 100644
--- a/erpnext/restaurant/doctype/restaurant_menu/restaurant_menu.py
+++ b/erpnext/restaurant/doctype/restaurant_menu/restaurant_menu.py
@@ -57,5 +57,3 @@
 		price_list.save()
 
 		return price_list
-
-
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index 2849466..2f06e98 100644
--- a/erpnext/selling/doctype/customer/customer.js
+++ b/erpnext/selling/doctype/customer/customer.js
@@ -160,4 +160,3 @@
 
 	}
 });
-
diff --git a/erpnext/selling/doctype/customer/regional/india.js b/erpnext/selling/doctype/customer/regional/india.js
index edb8383..cad9a27 100644
--- a/erpnext/selling/doctype/customer/regional/india.js
+++ b/erpnext/selling/doctype/customer/regional/india.js
@@ -1,3 +1,3 @@
 {% include "erpnext/regional/india/party.js" %}
 
-erpnext.setup_gst_reminder_button('Customer')
\ No newline at end of file
+erpnext.setup_gst_reminder_button('Customer')
diff --git a/erpnext/selling/doctype/industry_type/industry_type.js b/erpnext/selling/doctype/industry_type/industry_type.js
index 3878a79..3680906 100644
--- a/erpnext/selling/doctype/industry_type/industry_type.js
+++ b/erpnext/selling/doctype/industry_type/industry_type.js
@@ -1,13 +1,13 @@
 // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
- 
+
 
 //--------- ONLOAD -------------
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
-   
+
 }
 
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-   
-}
\ No newline at end of file
+
+}
diff --git a/erpnext/selling/doctype/industry_type/industry_type.py b/erpnext/selling/doctype/industry_type/industry_type.py
index 65b17e9..7a30d65 100644
--- a/erpnext/selling/doctype/industry_type/industry_type.py
+++ b/erpnext/selling/doctype/industry_type/industry_type.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class IndustryType(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/selling/doctype/industry_type/test_industry_type.py b/erpnext/selling/doctype/industry_type/test_industry_type.py
index 1246a24..ebc6366 100644
--- a/erpnext/selling/doctype/industry_type/test_industry_type.py
+++ b/erpnext/selling/doctype/industry_type/test_industry_type.py
@@ -4,4 +4,4 @@
 
 
 import frappe
-test_records = frappe.get_test_records('Industry Type')
\ No newline at end of file
+test_records = frappe.get_test_records('Industry Type')
diff --git a/erpnext/selling/doctype/installation_note_item/installation_note_item.py b/erpnext/selling/doctype/installation_note_item/installation_note_item.py
index 681b817..7e12052 100644
--- a/erpnext/selling/doctype/installation_note_item/installation_note_item.py
+++ b/erpnext/selling/doctype/installation_note_item/installation_note_item.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class InstallationNoteItem(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/selling/doctype/product_bundle/test_product_bundle.js b/erpnext/selling/doctype/product_bundle/test_product_bundle.js
index ba5ba0d..0dc90ec 100644
--- a/erpnext/selling/doctype/product_bundle/test_product_bundle.js
+++ b/erpnext/selling/doctype/product_bundle/test_product_bundle.js
@@ -33,4 +33,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/selling/doctype/quotation/quotation_dashboard.py b/erpnext/selling/doctype/quotation/quotation_dashboard.py
index f1ac951..d1bb788 100644
--- a/erpnext/selling/doctype/quotation/quotation_dashboard.py
+++ b/erpnext/selling/doctype/quotation/quotation_dashboard.py
@@ -17,4 +17,4 @@
 				'items': ['Auto Repeat']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/selling/doctype/quotation/tests/test_quotation_with_discount_on_grand_total.js b/erpnext/selling/doctype/quotation/tests/test_quotation_with_discount_on_grand_total.js
index aeb5d1b..b59bb05 100644
--- a/erpnext/selling/doctype/quotation/tests/test_quotation_with_discount_on_grand_total.js
+++ b/erpnext/selling/doctype/quotation/tests/test_quotation_with_discount_on_grand_total.js
@@ -41,4 +41,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/selling/doctype/quotation/tests/test_quotation_with_item_wise_discount.js b/erpnext/selling/doctype/quotation/tests/test_quotation_with_item_wise_discount.js
index e7349e3..f5172fb 100644
--- a/erpnext/selling/doctype/quotation/tests/test_quotation_with_item_wise_discount.js
+++ b/erpnext/selling/doctype/quotation/tests/test_quotation_with_item_wise_discount.js
@@ -35,4 +35,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js b/erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js
index 5b4224d..0d34099 100644
--- a/erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js
+++ b/erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js
@@ -33,4 +33,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/selling/doctype/quotation/tests/test_quotation_with_multi_uom.js b/erpnext/selling/doctype/quotation/tests/test_quotation_with_multi_uom.js
index 50b8a83..84be56f 100644
--- a/erpnext/selling/doctype/quotation/tests/test_quotation_with_multi_uom.js
+++ b/erpnext/selling/doctype/quotation/tests/test_quotation_with_multi_uom.js
@@ -36,4 +36,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/selling/doctype/quotation/tests/test_quotation_with_taxes_and_charges.js b/erpnext/selling/doctype/quotation/tests/test_quotation_with_taxes_and_charges.js
index ac7ed65..5e21f81 100644
--- a/erpnext/selling/doctype/quotation/tests/test_quotation_with_taxes_and_charges.js
+++ b/erpnext/selling/doctype/quotation/tests/test_quotation_with_taxes_and_charges.js
@@ -38,4 +38,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index d31db82..38ea5c8 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -571,7 +571,8 @@
    "fieldtype": "Data",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Scan Barcode"
+   "label": "Scan Barcode",
+   "options": "Barcode"
   },
   {
    "allow_bulk_edit": 1,
@@ -1510,7 +1511,7 @@
  "idx": 105,
  "is_submittable": 1,
  "links": [],
- "modified": "2021-07-08 21:37:44.177493",
+ "modified": "2021-08-17 20:15:26.531553",
  "modified_by": "Administrator",
  "module": "Selling",
  "name": "Sales Order",
diff --git a/erpnext/selling/doctype/sales_order/sales_order_dashboard.py b/erpnext/selling/doctype/sales_order/sales_order_dashboard.py
index 05a760d..2a71c27 100644
--- a/erpnext/selling/doctype/sales_order/sales_order_dashboard.py
+++ b/erpnext/selling/doctype/sales_order/sales_order_dashboard.py
@@ -41,4 +41,4 @@
 				'items': ['Payment Entry', 'Payment Request', 'Journal Entry']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index a0a21ee..d685fbf 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -1222,7 +1222,7 @@
 	def test_so_cancellation_when_si_drafted(self):
 		"""
 			Test to check if Sales Order gets cancelled if Sales Invoice is in Draft state
-			Expected result: sales order should not get cancelled 
+			Expected result: sales order should not get cancelled
 		"""
 		so = make_sales_order()
 		so.submit()
@@ -1250,7 +1250,7 @@
 		self.assertEqual(so.payment_terms_template, si.payment_terms_template)
 		compare_payment_schedules(self, so, si)
 
-		automatically_fetch_payment_terms(enable=0)		
+		automatically_fetch_payment_terms(enable=0)
 
 def automatically_fetch_payment_terms(enable=1):
 	accounts_settings = frappe.get_doc("Accounts Settings")
diff --git a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js
index 7426868..9eebfda 100644
--- a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js
+++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js
@@ -35,4 +35,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_multiple_delivery_date.js b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_multiple_delivery_date.js
index 8e05385..be76c49 100644
--- a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_multiple_delivery_date.js
+++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_multiple_delivery_date.js
@@ -56,4 +56,4 @@
 		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.py b/erpnext/selling/doctype/sales_order_item/sales_order_item.py
index 27f303d..62afef3 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.py
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.py
@@ -10,4 +10,4 @@
 	pass
 
 def on_doctype_update():
-	frappe.db.add_index("Sales Order Item", ["item_code", "warehouse"])
\ No newline at end of file
+	frappe.db.add_index("Sales Order Item", ["item_code", "warehouse"])
diff --git a/erpnext/selling/doctype/sales_team/sales_team.py b/erpnext/selling/doctype/sales_team/sales_team.py
index 1832108..28bea25 100644
--- a/erpnext/selling/doctype/sales_team/sales_team.py
+++ b/erpnext/selling/doctype/sales_team/sales_team.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class SalesTeam(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.js b/erpnext/selling/doctype/selling_settings/selling_settings.js
index 95a4243..d8d3051 100644
--- a/erpnext/selling/doctype/selling_settings/selling_settings.js
+++ b/erpnext/selling/doctype/selling_settings/selling_settings.js
@@ -28,4 +28,4 @@
 		title: "Delivery Note Required for Sales Invoice Creation",
 		description: __("If this option is configured 'Yes', ERPNext will prevent you from creating a Sales Invoice without creating a Delivery Note first. This configuration can be overridden for a particular Customer by enabling the 'Allow Sales Invoice Creation Without Delivery Note' checkbox in the Customer master.")
 	}
-];
\ No newline at end of file
+];
diff --git a/erpnext/selling/doctype/sms_center/sms_center.py b/erpnext/selling/doctype/sms_center/sms_center.py
index d142d16..87846a8 100644
--- a/erpnext/selling/doctype/sms_center/sms_center.py
+++ b/erpnext/selling/doctype/sms_center/sms_center.py
@@ -83,4 +83,3 @@
 			receiver_list = self.get_receiver_nos()
 		if receiver_list:
 			send_sms(receiver_list, cstr(self.message))
-
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.py b/erpnext/selling/page/point_of_sale/point_of_sale.py
index 8d1f112..03c46bb 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.py
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.py
@@ -146,7 +146,7 @@
 		if not item['is_stock_item']:
 			if not frappe.db.exists('Product Bundle', item['item_code']):
 				items.remove(item)
-	
+
 	return items
 
 def get_conditions(search_term):
diff --git a/erpnext/selling/page/point_of_sale/pos_controller.js b/erpnext/selling/page/point_of_sale/pos_controller.js
index c827368..e61a634 100644
--- a/erpnext/selling/page/point_of_sale/pos_controller.js
+++ b/erpnext/selling/page/point_of_sale/pos_controller.js
@@ -525,7 +525,7 @@
 				}
 
 			} else {
-				if (!this.frm.doc.customer) 
+				if (!this.frm.doc.customer)
 					return this.raise_customer_selection_alert();
 
 				const { item_code, batch_no, serial_no, rate } = item;
@@ -549,7 +549,7 @@
 					await this.check_stock_availability(item_row, value, this.frm.doc.set_warehouse);
 
 				await this.trigger_new_item_events(item_row);
-				
+
 				this.update_cart_html(item_row);
 
 				if (this.item_details.$component.is(':visible'))
@@ -708,4 +708,3 @@
 			.catch(e => console.log(e));
 	}
 };
-
diff --git a/erpnext/selling/page/point_of_sale/pos_item_cart.js b/erpnext/selling/page/point_of_sale/pos_item_cart.js
index a4a4b0e..9d8338e 100644
--- a/erpnext/selling/page/point_of_sale/pos_item_cart.js
+++ b/erpnext/selling/page/point_of_sale/pos_item_cart.js
@@ -973,7 +973,7 @@
 
 	load_invoice() {
 		const frm = this.events.get_frm();
-		
+
 		this.attach_refresh_field_event(frm);
 
 		this.fetch_customer_details(frm.doc.customer).then(() => {
diff --git a/erpnext/selling/page/point_of_sale/pos_item_details.js b/erpnext/selling/page/point_of_sale/pos_item_details.js
index 6a4d3d5..d899c5c 100644
--- a/erpnext/selling/page/point_of_sale/pos_item_details.js
+++ b/erpnext/selling/page/point_of_sale/pos_item_details.js
@@ -65,7 +65,7 @@
 
 		// if item is null or highlighted cart item is clicked twice
 		const hide_item_details = !Boolean(item) || !current_item_changed;
-		
+
 		this.events.toggle_item_selector(!hide_item_details);
 		this.toggle_component(!hide_item_details);
 
@@ -127,7 +127,7 @@
 		this.$item_price.html(format_currency(price_list_rate, this.currency));
 		if (!this.hide_images && image) {
 			this.$item_image.html(
-				`<img 
+				`<img
 					onerror="cur_pos.item_details.handle_broken_image(this)"
 					class="h-full" src="${image}"
 					alt="${frappe.get_abbr(item_name)}"
@@ -416,4 +416,4 @@
 	toggle_component(show) {
 		show ? this.$component.css('display', 'flex') : this.$component.css('display', 'none');
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/selling/page/point_of_sale/pos_item_selector.js b/erpnext/selling/page/point_of_sale/pos_item_selector.js
index dd7f143..8352b14 100644
--- a/erpnext/selling/page/point_of_sale/pos_item_selector.js
+++ b/erpnext/selling/page/point_of_sale/pos_item_selector.js
@@ -95,7 +95,7 @@
 							<span class="indicator-pill whitespace-nowrap ${indicator_color}">${qty_to_display}</span>
 						</div>
 						<div class="flex items-center justify-center h-32 border-b-grey text-6xl text-grey-100">
-							<img 
+							<img
 								onerror="cur_pos.item_selector.handle_broken_image(this)"
 								class="h-full" src="${item_image}"
 								alt="${frappe.get_abbr(item.item_name)}"
diff --git a/erpnext/selling/page/point_of_sale/pos_number_pad.js b/erpnext/selling/page/point_of_sale/pos_number_pad.js
index 962bcaf..95293d1 100644
--- a/erpnext/selling/page/point_of_sale/pos_number_pad.js
+++ b/erpnext/selling/page/point_of_sale/pos_number_pad.js
@@ -44,4 +44,4 @@
 			me.events.numpad_event($btn);
 		});
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/selling/page/point_of_sale/pos_past_order_list.js b/erpnext/selling/page/point_of_sale/pos_past_order_list.js
index 70c7dc2..e0993e2 100644
--- a/erpnext/selling/page/point_of_sale/pos_past_order_list.js
+++ b/erpnext/selling/page/point_of_sale/pos_past_order_list.js
@@ -120,4 +120,4 @@
 	toggle_component(show) {
 		show ? this.$component.css('display', 'flex') && this.refresh_list() : this.$component.css('display', 'none');
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/selling/page/point_of_sale/pos_past_order_summary.js b/erpnext/selling/page/point_of_sale/pos_past_order_summary.js
index cec831d..dd9e05a 100644
--- a/erpnext/selling/page/point_of_sale/pos_past_order_summary.js
+++ b/erpnext/selling/page/point_of_sale/pos_past_order_summary.js
@@ -402,4 +402,4 @@
 	toggle_component(show) {
 		show ? this.$component.css('display', 'flex') : this.$component.css('display', 'none');
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/selling/page/sales_funnel/sales_funnel.css b/erpnext/selling/page/sales_funnel/sales_funnel.css
index 455d37c..60b2392 100644
--- a/erpnext/selling/page/sales_funnel/sales_funnel.css
+++ b/erpnext/selling/page/sales_funnel/sales_funnel.css
@@ -1,4 +1,4 @@
 .funnel-wrapper {
 	margin: 15px;
 	width: 100%;
-}
\ No newline at end of file
+}
diff --git a/erpnext/selling/page/sales_funnel/sales_funnel.py b/erpnext/selling/page/sales_funnel/sales_funnel.py
index b613718..78aaa49 100644
--- a/erpnext/selling/page/sales_funnel/sales_funnel.py
+++ b/erpnext/selling/page/sales_funnel/sales_funnel.py
@@ -32,7 +32,7 @@
 		and (opportunity!="" or quotation_to="Lead") and company=%s""", (from_date, to_date, company))[0][0]
 
 	converted = frappe.db.sql("""select count(*) from `tabCustomer`
-		JOIN `tabLead` ON `tabLead`.name = `tabCustomer`.lead_name 
+		JOIN `tabLead` ON `tabLead`.name = `tabCustomer`.lead_name
 		WHERE (date(`tabCustomer`.creation) between %s and %s)
 		and `tabLead`.company=%s""", (from_date, to_date, company))[0][0]
 
@@ -97,4 +97,4 @@
 		return result
 
 	else:
-		return 'empty'
\ No newline at end of file
+		return 'empty'
diff --git a/erpnext/selling/report/address_and_contacts/address_and_contacts.py b/erpnext/selling/report/address_and_contacts/address_and_contacts.py
index a9e4303..f295333 100644
--- a/erpnext/selling/report/address_and_contacts/address_and_contacts.py
+++ b/erpnext/selling/report/address_and_contacts/address_and_contacts.py
@@ -117,4 +117,4 @@
 		"Sales Partner": "partner_type"
 	}
 
-	return group[party_type]
\ No newline at end of file
+	return group[party_type]
diff --git a/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py b/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py
index 056492a..5523bad 100644
--- a/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py
+++ b/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py
@@ -76,4 +76,4 @@
 			last_sbom = line.get("parent")
 			actual_dict = sbom_map.setdefault(last_sbom, {})
 		actual_dict.setdefault(line.get("warehouse"), line.get("qty"))
-	return sbom_map
\ No newline at end of file
+	return sbom_map
diff --git a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js
index d93ffb7..1b931e1 100644
--- a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js
+++ b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js
@@ -41,4 +41,4 @@
 		}
 		return value;
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.js b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.js
index f47d67f..073be78 100644
--- a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.js
+++ b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.js
@@ -60,4 +60,4 @@
 		}
 		return value;
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py
index 8473276..1700fc7 100644
--- a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py
+++ b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py
@@ -266,4 +266,4 @@
 			]
 		},
 		"type" : "bar"
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/selling/report/quotation_trends/quotation_trends.js b/erpnext/selling/report/quotation_trends/quotation_trends.js
index f00ca27..97a1931 100644
--- a/erpnext/selling/report/quotation_trends/quotation_trends.js
+++ b/erpnext/selling/report/quotation_trends/quotation_trends.js
@@ -6,4 +6,3 @@
 		filters: erpnext.get_sales_trends_filters()
 	}
 });
-
diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.js b/erpnext/selling/report/sales_analytics/sales_analytics.js
index 9089b53..6b03c7d 100644
--- a/erpnext/selling/report/sales_analytics/sales_analytics.js
+++ b/erpnext/selling/report/sales_analytics/sales_analytics.js
@@ -141,5 +141,3 @@
 		});
 	},
 }
-
-
diff --git a/erpnext/selling/report/sales_order_analysis/sales_order_analysis.py b/erpnext/selling/report/sales_order_analysis/sales_order_analysis.py
index 8cb2446..00dcd69 100644
--- a/erpnext/selling/report/sales_order_analysis/sales_order_analysis.py
+++ b/erpnext/selling/report/sales_order_analysis/sales_order_analysis.py
@@ -276,4 +276,4 @@
 		})
 
 
-	return columns
\ No newline at end of file
+	return columns
diff --git a/erpnext/selling/report/sales_order_trends/sales_order_trends.js b/erpnext/selling/report/sales_order_trends/sales_order_trends.js
index ea320d6..b22ea8f 100644
--- a/erpnext/selling/report/sales_order_trends/sales_order_trends.js
+++ b/erpnext/selling/report/sales_order_trends/sales_order_trends.js
@@ -5,4 +5,4 @@
 	frappe.query_reports["Sales Order Trends"] = {
 		filters: erpnext.get_sales_trends_filters()
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/selling/report/sales_partner_commission_summary/sales_partner_commission_summary.py b/erpnext/selling/report/sales_partner_commission_summary/sales_partner_commission_summary.py
index 66f9aae..2c49d51 100644
--- a/erpnext/selling/report/sales_partner_commission_summary/sales_partner_commission_summary.py
+++ b/erpnext/selling/report/sales_partner_commission_summary/sales_partner_commission_summary.py
@@ -110,4 +110,4 @@
 	if filters.get("to_date"):
 		conditions += " and {0} <= %(to_date)s".format(date_field)
 
-	return conditions
\ No newline at end of file
+	return conditions
diff --git a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/item_group_wise_sales_target_variance.py b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/item_group_wise_sales_target_variance.py
index ae216ca..24ca666 100644
--- a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/item_group_wise_sales_target_variance.py
+++ b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/item_group_wise_sales_target_variance.py
@@ -44,6 +44,18 @@
 		if d.item_group not in item_groups:
 			item_groups.append(d.item_group)
 
+	if item_groups:
+		child_items = []
+		for item_group in item_groups:
+			if frappe.db.get_value("Item Group", {"name":item_group}, "is_group"):
+				for child_item_group in frappe.get_all("Item Group", {"parent_item_group":item_group}):
+					if child_item_group['name'] not in child_items:
+						child_items.append(child_item_group['name'])
+
+		for item in child_items:
+			if item not in item_groups:
+				item_groups.append(item)
+
 	date_field = ("transaction_date"
 		if filters.get('doctype') == "Sales Order" else "posting_date")
 
@@ -208,4 +220,4 @@
 
 	return frappe.get_all('Target Detail',
 		filters = filters_dict,
-		fields = ["parent", "item_group", target_qty_amt_field, "fiscal_year", "distribution_id"])
\ No newline at end of file
+		fields = ["parent", "item_group", target_qty_amt_field, "fiscal_year", "distribution_id"])
diff --git a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/sales_partner_target_variance_based_on_item_group.js b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/sales_partner_target_variance_based_on_item_group.js
index 38bb127..adae47b 100644
--- a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/sales_partner_target_variance_based_on_item_group.js
+++ b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/sales_partner_target_variance_based_on_item_group.js
@@ -47,9 +47,9 @@
 	],
 	"formatter": function (value, row, column, data, default_formatter) {
 		value = default_formatter(value, row, column, data);
-		
+
 		if (column.fieldname.includes('variance')) {
-			
+
 			if (data[column.fieldname] < 0) {
 				value = "<span style='color:red'>" + value + "</span>";
 			}
diff --git a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/sales_partner_target_variance_based_on_item_group.py b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/sales_partner_target_variance_based_on_item_group.py
index e41011f..87ed5a8 100644
--- a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/sales_partner_target_variance_based_on_item_group.py
+++ b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/sales_partner_target_variance_based_on_item_group.py
@@ -9,4 +9,3 @@
 	data = []
 
 	return get_data_column(filters, "Sales Partner")
-
diff --git a/erpnext/selling/report/sales_partner_transaction_summary/sales_partner_transaction_summary.py b/erpnext/selling/report/sales_partner_transaction_summary/sales_partner_transaction_summary.py
index 5356028..f07293d 100644
--- a/erpnext/selling/report/sales_partner_transaction_summary/sales_partner_transaction_summary.py
+++ b/erpnext/selling/report/sales_partner_transaction_summary/sales_partner_transaction_summary.py
@@ -165,4 +165,4 @@
 			`tabItem Group` where lft >= %s and rgt <= %s)""" % (lft, rgt)
 
 
-	return conditions
\ No newline at end of file
+	return conditions
diff --git a/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.py b/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.py
index 0c84909..9917d72 100644
--- a/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.py
+++ b/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.py
@@ -101,7 +101,7 @@
 
 def get_entries(filters):
 	date_field = filters["doc_type"] == "Sales Order" and "transaction_date" or "posting_date"
-	
+
 	conditions, values = get_conditions(filters, date_field)
 	entries = frappe.db.sql("""
 		select
@@ -111,7 +111,7 @@
 			`tab%s` dt, `tabSales Team` st
 		where
 			st.parent = dt.name and st.parenttype = %s
-			and dt.docstatus = 1 %s order by dt.name desc,st.sales_person 
+			and dt.docstatus = 1 %s order by dt.name desc,st.sales_person
 		""" %(date_field, filters["doc_type"], '%s', conditions),
 			tuple([filters["doc_type"]] + values), as_dict=1)
 
@@ -138,5 +138,3 @@
 		values.append(filters["to_date"])
 
 	return " and ".join(conditions), values
-
-
diff --git a/erpnext/selling/report/sales_person_target_variance_based_on_item_group/sales_person_target_variance_based_on_item_group.js b/erpnext/selling/report/sales_person_target_variance_based_on_item_group/sales_person_target_variance_based_on_item_group.js
index a8e2fad..2b84436 100644
--- a/erpnext/selling/report/sales_person_target_variance_based_on_item_group/sales_person_target_variance_based_on_item_group.js
+++ b/erpnext/selling/report/sales_person_target_variance_based_on_item_group/sales_person_target_variance_based_on_item_group.js
@@ -47,9 +47,9 @@
 	],
 	"formatter": function (value, row, column, data, default_formatter) {
 		value = default_formatter(value, row, column, data);
-		
+
 		if (column.fieldname.includes('variance')) {
-			
+
 			if (data[column.fieldname] < 0) {
 				value = "<span style='color:red'>" + value + "</span>";
 			}
diff --git a/erpnext/selling/report/sales_person_target_variance_based_on_item_group/sales_person_target_variance_based_on_item_group.py b/erpnext/selling/report/sales_person_target_variance_based_on_item_group/sales_person_target_variance_based_on_item_group.py
index 5166cc8..ea9bbab 100644
--- a/erpnext/selling/report/sales_person_target_variance_based_on_item_group/sales_person_target_variance_based_on_item_group.py
+++ b/erpnext/selling/report/sales_person_target_variance_based_on_item_group/sales_person_target_variance_based_on_item_group.py
@@ -8,4 +8,4 @@
 def execute(filters=None):
 	data = []
 
-	return get_data_column(filters, "Sales Person")
\ No newline at end of file
+	return get_data_column(filters, "Sales Person")
diff --git a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js
index b236151..e269f02 100644
--- a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js
+++ b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js
@@ -67,4 +67,4 @@
 			default: 0,
 		},
 	]
-}
\ No newline at end of file
+}
diff --git a/erpnext/selling/report/territory_target_variance_based_on_item_group/territory_target_variance_based_on_item_group.js b/erpnext/selling/report/territory_target_variance_based_on_item_group/territory_target_variance_based_on_item_group.js
index 263391a..9f3d255 100644
--- a/erpnext/selling/report/territory_target_variance_based_on_item_group/territory_target_variance_based_on_item_group.js
+++ b/erpnext/selling/report/territory_target_variance_based_on_item_group/territory_target_variance_based_on_item_group.js
@@ -47,9 +47,9 @@
 	],
 	"formatter": function (value, row, column, data, default_formatter) {
 		value = default_formatter(value, row, column, data);
-		
+
 		if (column.fieldname.includes('variance')) {
-			
+
 			if (data[column.fieldname] < 0) {
 				value = "<span style='color:red'>" + value + "</span>";
 			}
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index f515baf..2de57c8 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -26,7 +26,7 @@
 				}
 			};
 		});
-	}	
+	}
 
 	setup_queries() {
 		var me = this;
@@ -85,7 +85,7 @@
 
 	refresh() {
 		super.refresh();
-		
+
 		frappe.dynamic_link = {doc: this.frm.doc, fieldname: 'customer', doctype: 'Customer'}
 
 		this.frm.toggle_display("customer_name",
@@ -394,6 +394,10 @@
 	}
 
 	_set_batch_number(doc) {
+		if (doc.batch_no) {
+			return
+		}
+
 		let args = {'item_code': doc.item_code, 'warehouse': doc.warehouse, 'qty': flt(doc.qty) * flt(doc.conversion_factor)};
 		if (doc.has_serial_no && doc.serial_no) {
 			args['serial_no'] = doc.serial_no
diff --git a/erpnext/setup/default_energy_point_rules.py b/erpnext/setup/default_energy_point_rules.py
index 94f5aa4..8dbccc4 100644
--- a/erpnext/setup/default_energy_point_rules.py
+++ b/erpnext/setup/default_energy_point_rules.py
@@ -55,4 +55,3 @@
 		'points': rule.get('points'),
 		'user_field': rule.get('user_field') or 'owner'
 	} for doctype, rule in doctype_rule_map.items()]
-
diff --git a/erpnext/setup/default_success_action.py b/erpnext/setup/default_success_action.py
index b8b09cb..827839f 100644
--- a/erpnext/setup/default_success_action.py
+++ b/erpnext/setup/default_success_action.py
@@ -24,4 +24,3 @@
 		'first_success_message': get_first_success_message(doctype),
 		'next_actions': 'new\nprint\nemail'
 	} for doctype in doctype_list]
-
diff --git a/erpnext/setup/doctype/brand/brand.js b/erpnext/setup/doctype/brand/brand.js
index 3878a79..3680906 100644
--- a/erpnext/setup/doctype/brand/brand.js
+++ b/erpnext/setup/doctype/brand/brand.js
@@ -1,13 +1,13 @@
 // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
- 
+
 
 //--------- ONLOAD -------------
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
-   
+
 }
 
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-   
-}
\ No newline at end of file
+
+}
diff --git a/erpnext/setup/doctype/brand/brand.py b/erpnext/setup/doctype/brand/brand.py
index 12839d1..a8d1cf8 100644
--- a/erpnext/setup/doctype/brand/brand.py
+++ b/erpnext/setup/doctype/brand/brand.py
@@ -21,4 +21,4 @@
 				row.pop("name")
 				return row
 
-	return frappe._dict()
\ No newline at end of file
+	return frappe._dict()
diff --git a/erpnext/setup/doctype/brand/test_brand.py b/erpnext/setup/doctype/brand/test_brand.py
index 265d2fe..25ed86e 100644
--- a/erpnext/setup/doctype/brand/test_brand.py
+++ b/erpnext/setup/doctype/brand/test_brand.py
@@ -4,4 +4,4 @@
 
 
 import frappe
-test_records = frappe.get_test_records('Brand')
\ No newline at end of file
+test_records = frappe.get_test_records('Brand')
diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js
index d05541b..56700af 100644
--- a/erpnext/setup/doctype/company/company.js
+++ b/erpnext/setup/doctype/company/company.js
@@ -46,6 +46,43 @@
 		});
 	},
 
+	change_abbreviation(frm) {
+		var dialog = new frappe.ui.Dialog({
+			title: "Replace Abbr",
+			fields: [
+				{"fieldtype": "Data", "label": "New Abbreviation", "fieldname": "new_abbr",
+					"reqd": 1 },
+				{"fieldtype": "Button", "label": "Update", "fieldname": "update"},
+			]
+		});
+	
+		dialog.fields_dict.update.$input.click(function() {
+			var args = dialog.get_values();
+			if (!args) return; 
+			frappe.show_alert(__("Update in progress. It might take a while."));
+			return frappe.call({
+				method: "erpnext.setup.doctype.company.company.enqueue_replace_abbr",
+				args: {
+					"company": frm.doc.name,
+					"old": frm.doc.abbr,
+					"new": args.new_abbr
+				},
+				callback: function(r) {
+					if (r.exc) {
+						frappe.msgprint(__("There were errors."));
+						return;
+					} else {
+						frm.set_value("abbr", args.new_abbr);
+					}
+					dialog.hide();
+					frm.refresh();
+				},
+				btn: this
+			});
+		});
+		dialog.show();
+	},
+
 	company_name: function(frm) {
 		if(frm.doc.__islocal) {
 			// add missing " " arg in split method
@@ -127,6 +164,10 @@
 					}, __('Manage'));
 				}
 			}
+
+			frm.add_custom_button(__('Change Abbreviation'), () => {
+				frm.trigger('change_abbreviation');
+			}, __('Manage'));
 		}
 
 		erpnext.company.set_chart_of_accounts_options(frm.doc);
@@ -204,43 +245,6 @@
 	}
 }
 
-cur_frm.cscript.change_abbr = function() {
-	var dialog = new frappe.ui.Dialog({
-		title: "Replace Abbr",
-		fields: [
-			{"fieldtype": "Data", "label": "New Abbreviation", "fieldname": "new_abbr",
-				"reqd": 1 },
-			{"fieldtype": "Button", "label": "Update", "fieldname": "update"},
-		]
-	});
-
-	dialog.fields_dict.update.$input.click(function() {
-		var args = dialog.get_values();
-		if(!args) return;
-		frappe.show_alert(__("Update in progress. It might take a while."));
-		return frappe.call({
-			method: "erpnext.setup.doctype.company.company.enqueue_replace_abbr",
-			args: {
-				"company": cur_frm.doc.name,
-				"old": cur_frm.doc.abbr,
-				"new": args.new_abbr
-			},
-			callback: function(r) {
-				if(r.exc) {
-					frappe.msgprint(__("There were errors."));
-					return;
-				} else {
-					cur_frm.set_value("abbr", args.new_abbr);
-				}
-				dialog.hide();
-				cur_frm.refresh();
-			},
-			btn: this
-		})
-	});
-	dialog.show();
-}
-
 erpnext.company.setup_queries = function(frm) {
 	$.each([
 		["default_bank_account", {"account_type": "Bank"}],
@@ -313,4 +317,3 @@
 	frm.set_df_property("chart_of_accounts", "read_only", bool);
 	frm.set_df_property("existing_company", "read_only", bool);
 }
-
diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json
index e6ec496..e4ee3ec 100644
--- a/erpnext/setup/doctype/company/company.json
+++ b/erpnext/setup/doctype/company/company.json
@@ -12,33 +12,48 @@
   "details",
   "company_name",
   "abbr",
-  "change_abbr",
+  "default_currency",
+  "country",
   "is_group",
   "cb0",
-  "domain",
-  "parent_company",
-  "charts_section",
-  "default_currency",
   "default_letter_head",
-  "default_holiday_list",
-  "default_finance_book",
-  "default_selling_terms",
-  "default_buying_terms",
-  "default_warehouse_for_sales_return",
-  "default_in_transit_warehouse",
-  "column_break_10",
-  "country",
-  "create_chart_of_accounts_based_on",
-  "chart_of_accounts",
-  "existing_company",
   "tax_id",
+  "domain",
   "date_of_establishment",
+  "parent_company",
+  "company_info",
+  "company_logo",
+  "date_of_incorporation",
+  "phone_no",
+  "email",
+  "company_description",
+  "column_break1",
+  "date_of_commencement",
+  "fax",
+  "website",
+  "address_html",
+  "section_break_28",
+  "create_chart_of_accounts_based_on",
+  "existing_company",
+  "column_break_26",
+  "chart_of_accounts",
+  "charts_section",
   "sales_settings",
-  "monthly_sales_target",
+  "default_buying_terms",
   "sales_monthly_history",
-  "column_break_goals",
-  "transactions_annual_history",
+  "monthly_sales_target",
   "total_monthly_sales",
+  "column_break_goals",
+  "default_selling_terms",
+  "default_warehouse_for_sales_return",
+  "credit_limit",
+  "transactions_annual_history",
+  "hr_settings_section",
+  "default_holiday_list",
+  "default_expense_claim_payable_account",
+  "column_break_10",
+  "default_employee_advance_account",
+  "default_payroll_payable_account",
   "default_settings",
   "default_bank_account",
   "default_cash_account",
@@ -52,24 +67,20 @@
   "column_break0",
   "allow_account_creation_against_child_company",
   "default_payable_account",
-  "default_employee_advance_account",
   "default_expense_account",
   "default_income_account",
   "default_deferred_revenue_account",
   "default_deferred_expense_account",
-  "default_payroll_payable_account",
-  "default_expense_claim_payable_account",
   "default_discount_account",
-  "section_break_22",
-  "cost_center",
-  "column_break_26",
-  "credit_limit",
   "payment_terms",
+  "cost_center",
+  "default_finance_book",
   "auto_accounting_for_stock_settings",
   "enable_perpetual_inventory",
   "enable_perpetual_inventory_for_non_stock_items",
   "default_inventory_account",
   "stock_adjustment_account",
+  "default_in_transit_warehouse",
   "column_break_32",
   "stock_received_but_not_billed",
   "service_received_but_not_billed",
@@ -79,25 +90,14 @@
   "depreciation_expense_account",
   "series_for_depreciation_entry",
   "expenses_included_in_asset_valuation",
+  "repair_and_maintenance_account",
   "column_break_40",
   "disposal_account",
   "depreciation_cost_center",
   "capital_work_in_progress_account",
-  "repair_and_maintenance_account",
   "asset_received_but_not_billed",
   "budget_detail",
   "exception_budget_approver_role",
-  "company_info",
-  "company_logo",
-  "date_of_incorporation",
-  "address_html",
-  "date_of_commencement",
-  "phone_no",
-  "fax",
-  "email",
-  "website",
-  "column_break1",
-  "company_description",
   "registration_info",
   "registration_details",
   "lft",
@@ -128,12 +128,6 @@
    "reqd": 1
   },
   {
-   "depends_on": "eval:!doc.__islocal && in_list(frappe.user_roles, \"System Manager\")",
-   "fieldname": "change_abbr",
-   "fieldtype": "Button",
-   "label": "Change Abbreviation"
-  },
-  {
    "bold": 1,
    "default": "0",
    "fieldname": "is_group",
@@ -176,10 +170,9 @@
    "label": "Company Description"
   },
   {
-   "collapsible": 1,
    "fieldname": "sales_settings",
    "fieldtype": "Section Break",
-   "label": "Sales Settings"
+   "label": "Buying & Selling Settings"
   },
   {
    "fieldname": "sales_monthly_history",
@@ -443,10 +436,6 @@
    "options": "Account"
   },
   {
-   "fieldname": "section_break_22",
-   "fieldtype": "Section Break"
-  },
-  {
    "depends_on": "eval:!doc.__islocal",
    "fieldname": "cost_center",
    "fieldtype": "Link",
@@ -456,10 +445,6 @@
    "options": "Cost Center"
   },
   {
-   "fieldname": "column_break_26",
-   "fieldtype": "Column Break"
-  },
-  {
    "depends_on": "eval:!doc.__islocal",
    "fieldname": "credit_limit",
    "fieldtype": "Currency",
@@ -589,10 +574,10 @@
   },
   {
    "collapsible": 1,
-   "description": "For reference only.",
+   "depends_on": "eval: doc.docstatus == 0 && doc.__islocal != 1",
    "fieldname": "company_info",
    "fieldtype": "Section Break",
-   "label": "Company Info"
+   "label": "Address & Contact"
   },
   {
    "fieldname": "date_of_incorporation",
@@ -741,6 +726,20 @@
    "fieldtype": "Link",
    "label": "Repair and Maintenance Account",
    "options": "Account"
+  },
+  {
+   "fieldname": "section_break_28",
+   "fieldtype": "Section Break",
+   "label": "Chart of Accounts"
+  },
+  {
+   "fieldname": "hr_settings_section",
+   "fieldtype": "Section Break",
+   "label": "HR & Payroll Settings"
+  },
+  {
+   "fieldname": "column_break_26",
+   "fieldtype": "Column Break"
   }
  ],
  "icon": "fa fa-building",
@@ -748,7 +747,7 @@
  "image_field": "company_logo",
  "is_tree": 1,
  "links": [],
- "modified": "2021-05-12 16:51:08.187233",
+ "modified": "2021-07-12 11:27:06.353860",
  "modified_by": "Administrator",
  "module": "Setup",
  "name": "Company",
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 95cbf51..45d5ce0 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -108,7 +108,7 @@
 				frappe.flags.country_change = True
 				self.create_default_accounts()
 				self.create_default_warehouses()
-		
+
 		if not frappe.db.get_value("Cost Center", {"is_group": 0, "company": self.name}):
 			self.create_default_cost_center()
 
@@ -393,6 +393,10 @@
 		frappe.db.sql("delete from `tabPurchase Taxes and Charges Template` where company=%s", self.name)
 		frappe.db.sql("delete from `tabItem Tax Template` where company=%s", self.name)
 
+		# delete Process Deferred Accounts if no GL Entry found
+		if not frappe.db.get_value('GL Entry', {'company': self.name}):
+			frappe.db.sql("delete from `tabProcess Deferred Accounting` where company=%s", self.name)
+
 @frappe.whitelist()
 def enqueue_replace_abbr(company, old, new):
 	kwargs = dict(queue="long", company=company, old=old, new=new)
diff --git a/erpnext/setup/doctype/company/company_dashboard.py b/erpnext/setup/doctype/company/company_dashboard.py
index 9b483dd..2d76028 100644
--- a/erpnext/setup/doctype/company/company_dashboard.py
+++ b/erpnext/setup/doctype/company/company_dashboard.py
@@ -37,4 +37,4 @@
 				'items': ['Project']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/setup/doctype/company/company_tree.js b/erpnext/setup/doctype/company/company_tree.js
index 19b276c..160481c 100644
--- a/erpnext/setup/doctype/company/company_tree.js
+++ b/erpnext/setup/doctype/company/company_tree.js
@@ -30,4 +30,4 @@
 	onload: function(treeview) {
 		treeview.make_tree();
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py
index e1c803a..1b7fd4f 100644
--- a/erpnext/setup/doctype/company/test_company.py
+++ b/erpnext/setup/doctype/company/test_company.py
@@ -130,4 +130,3 @@
 		lead.company = company
 		lead.save()
 	return lead.name
-
diff --git a/erpnext/setup/doctype/company/tests/test_company.js b/erpnext/setup/doctype/company/tests/test_company.js
index 8c0b609..b568494 100644
--- a/erpnext/setup/doctype/company/tests/test_company.js
+++ b/erpnext/setup/doctype/company/tests/test_company.js
@@ -22,4 +22,4 @@
 			'chart of cost centers created'),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/setup/doctype/company/tests/test_company_production.js b/erpnext/setup/doctype/company/tests/test_company_production.js
index bf6e540..a4c1e2e 100644
--- a/erpnext/setup/doctype/company/tests/test_company_production.js
+++ b/erpnext/setup/doctype/company/tests/test_company_production.js
@@ -16,4 +16,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/setup/doctype/customer_group/customer_group.py b/erpnext/setup/doctype/customer_group/customer_group.py
index 68e1ccb..c06669b 100644
--- a/erpnext/setup/doctype/customer_group/customer_group.py
+++ b/erpnext/setup/doctype/customer_group/customer_group.py
@@ -30,4 +30,4 @@
 		order by lft asc""", (lft, rgt), as_dict=True)
 
 def on_doctype_update():
-	frappe.db.add_index("Customer Group", ["lft", "rgt"])
\ No newline at end of file
+	frappe.db.add_index("Customer Group", ["lft", "rgt"])
diff --git a/erpnext/setup/doctype/customer_group/customer_group_tree.js b/erpnext/setup/doctype/customer_group/customer_group_tree.js
index b52c79c..d50e9c8 100644
--- a/erpnext/setup/doctype/customer_group/customer_group_tree.js
+++ b/erpnext/setup/doctype/customer_group/customer_group_tree.js
@@ -1,3 +1,3 @@
 frappe.treeview_settings["Customer Group"] = {
 	ignore_fields:["parent_customer_group"]
-}
\ No newline at end of file
+}
diff --git a/erpnext/setup/doctype/customer_group/test_customer_group.py b/erpnext/setup/doctype/customer_group/test_customer_group.py
index ec1af7a..ec90b37 100644
--- a/erpnext/setup/doctype/customer_group/test_customer_group.py
+++ b/erpnext/setup/doctype/customer_group/test_customer_group.py
@@ -7,4 +7,4 @@
 
 
 import frappe
-test_records = frappe.get_test_records('Customer Group')
\ No newline at end of file
+test_records = frappe.get_test_records('Customer Group')
diff --git a/erpnext/setup/doctype/email_digest/email_digest.js b/erpnext/setup/doctype/email_digest/email_digest.js
index 2e415af..c2c2710 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.js
+++ b/erpnext/setup/doctype/email_digest/email_digest.js
@@ -28,4 +28,4 @@
 			});
 		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/setup/doctype/email_digest/quotes.py b/erpnext/setup/doctype/email_digest/quotes.py
index 95afe97..5451ee1 100644
--- a/erpnext/setup/doctype/email_digest/quotes.py
+++ b/erpnext/setup/doctype/email_digest/quotes.py
@@ -32,4 +32,3 @@
 	]
 
 	return random.choice(quotes)
-
diff --git a/erpnext/setup/doctype/email_digest/templates/default.html b/erpnext/setup/doctype/email_digest/templates/default.html
index 4ee4b0f..666301a 100644
--- a/erpnext/setup/doctype/email_digest/templates/default.html
+++ b/erpnext/setup/doctype/email_digest/templates/default.html
@@ -180,8 +180,8 @@
     <br>
 </div>
 {% endif %}
-    
-<!-- Purchase Order Items Overdue -->    
+
+<!-- Purchase Order Items Overdue -->
 {% if purchase_orders_items_overdue_list %}
 <h4 style="{{ section_head }}" class="text-center">{{ _("Purchase Order Items not received on time") }}</h4>
 <div>
@@ -254,6 +254,6 @@
 <div class="text-center">
     <br><br><span class="text-danger">Please take necessary action</span>
 </div>
-{% endif %}    
-    
+{% endif %}
+
 </div>
diff --git a/erpnext/setup/doctype/item_group/item_group_tree.js b/erpnext/setup/doctype/item_group/item_group_tree.js
index 57afe02..b2628f4 100644
--- a/erpnext/setup/doctype/item_group/item_group_tree.js
+++ b/erpnext/setup/doctype/item_group/item_group_tree.js
@@ -1,3 +1,3 @@
 frappe.treeview_settings["Item Group"] = {
 	ignore_fields:["parent_item_group"]
-}
\ No newline at end of file
+}
diff --git a/erpnext/setup/doctype/print_heading/print_heading.js b/erpnext/setup/doctype/print_heading/print_heading.js
index 3878a79..3680906 100644
--- a/erpnext/setup/doctype/print_heading/print_heading.js
+++ b/erpnext/setup/doctype/print_heading/print_heading.js
@@ -1,13 +1,13 @@
 // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
- 
+
 
 //--------- ONLOAD -------------
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
-   
+
 }
 
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-   
-}
\ No newline at end of file
+
+}
diff --git a/erpnext/setup/doctype/print_heading/print_heading.py b/erpnext/setup/doctype/print_heading/print_heading.py
index 00dc0f3..3d5cd2d 100644
--- a/erpnext/setup/doctype/print_heading/print_heading.py
+++ b/erpnext/setup/doctype/print_heading/print_heading.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class PrintHeading(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/setup/doctype/print_heading/test_print_heading.py b/erpnext/setup/doctype/print_heading/test_print_heading.py
index 59455d2..b2be2e3 100644
--- a/erpnext/setup/doctype/print_heading/test_print_heading.py
+++ b/erpnext/setup/doctype/print_heading/test_print_heading.py
@@ -4,4 +4,4 @@
 
 
 import frappe
-test_records = frappe.get_test_records('Print Heading')
\ No newline at end of file
+test_records = frappe.get_test_records('Print Heading')
diff --git a/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.js b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.js
index 3878a79..3680906 100644
--- a/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.js
+++ b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.js
@@ -1,13 +1,13 @@
 // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
- 
+
 
 //--------- ONLOAD -------------
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
-   
+
 }
 
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-   
-}
\ No newline at end of file
+
+}
diff --git a/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.py b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.py
index 2cc6235..42c5a5a 100644
--- a/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.py
+++ b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class QuotationLostReason(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/setup/doctype/quotation_lost_reason/test_quotation_lost_reason.py b/erpnext/setup/doctype/quotation_lost_reason/test_quotation_lost_reason.py
index ff4c788..f6b30b6 100644
--- a/erpnext/setup/doctype/quotation_lost_reason/test_quotation_lost_reason.py
+++ b/erpnext/setup/doctype/quotation_lost_reason/test_quotation_lost_reason.py
@@ -4,4 +4,4 @@
 
 
 import frappe
-test_records = frappe.get_test_records('Quotation Lost Reason')
\ No newline at end of file
+test_records = frappe.get_test_records('Quotation Lost Reason')
diff --git a/erpnext/setup/doctype/sales_person/sales_person_dashboard.py b/erpnext/setup/doctype/sales_person/sales_person_dashboard.py
index 3d0b2ff..662008e 100644
--- a/erpnext/setup/doctype/sales_person/sales_person_dashboard.py
+++ b/erpnext/setup/doctype/sales_person/sales_person_dashboard.py
@@ -12,4 +12,4 @@
 				'items': ['Sales Order', 'Delivery Note', 'Sales Invoice']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/setup/doctype/sales_person/sales_person_tree.js b/erpnext/setup/doctype/sales_person/sales_person_tree.js
index bcdfac9..00056fd 100644
--- a/erpnext/setup/doctype/sales_person/sales_person_tree.js
+++ b/erpnext/setup/doctype/sales_person/sales_person_tree.js
@@ -9,4 +9,4 @@
 		{fieldtype:'Check', fieldname:'is_group', label:__('Group Node'),
 			description: __("Further nodes can be only created under 'Group' type nodes")}
 	],
-}
\ No newline at end of file
+}
diff --git a/erpnext/setup/doctype/supplier_group/supplier_group_tree.js b/erpnext/setup/doctype/supplier_group/supplier_group_tree.js
index 0788e2e..728793e 100644
--- a/erpnext/setup/doctype/supplier_group/supplier_group_tree.js
+++ b/erpnext/setup/doctype/supplier_group/supplier_group_tree.js
@@ -1,4 +1,4 @@
 frappe.treeview_settings["Supplier Group"] = {
 	breadcrumbs: "Buying",
 	ignore_fields:["parent_supplier_group"]
-};
\ No newline at end of file
+};
diff --git a/erpnext/setup/doctype/target_detail/target_detail.py b/erpnext/setup/doctype/target_detail/target_detail.py
index d2e2597..633be45 100644
--- a/erpnext/setup/doctype/target_detail/target_detail.py
+++ b/erpnext/setup/doctype/target_detail/target_detail.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class TargetDetail(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.js b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.js
index 3878a79..3680906 100644
--- a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.js
+++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.js
@@ -1,13 +1,13 @@
 // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
- 
+
 
 //--------- ONLOAD -------------
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
-   
+
 }
 
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-   
-}
\ No newline at end of file
+
+}
diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
index 372cc6d..5b00ccb 100644
--- a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
+++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
@@ -24,6 +24,6 @@
 		doc = json.loads(doc)
 
 	terms_and_conditions = frappe.get_doc("Terms and Conditions", template_name)
-	
+
 	if terms_and_conditions.terms:
-		return frappe.render_template(terms_and_conditions.terms, doc)
\ No newline at end of file
+		return frappe.render_template(terms_and_conditions.terms, doc)
diff --git a/erpnext/setup/doctype/territory/territory.js b/erpnext/setup/doctype/territory/territory.js
index ceec47ae..3caf814 100644
--- a/erpnext/setup/doctype/territory/territory.js
+++ b/erpnext/setup/doctype/territory/territory.js
@@ -36,4 +36,4 @@
 			['Territory', 'name', '!=', doc.territory_name]
 		]
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/setup/doctype/territory/territory.py b/erpnext/setup/doctype/territory/territory.py
index 05e8f66..7eefe77 100644
--- a/erpnext/setup/doctype/territory/territory.py
+++ b/erpnext/setup/doctype/territory/territory.py
@@ -24,4 +24,4 @@
 		self.validate_one_root()
 
 def on_doctype_update():
-	frappe.db.add_index("Territory", ["lft", "rgt"])
\ No newline at end of file
+	frappe.db.add_index("Territory", ["lft", "rgt"])
diff --git a/erpnext/setup/doctype/territory/territory_tree.js b/erpnext/setup/doctype/territory/territory_tree.js
index edd11df..dadeeef 100644
--- a/erpnext/setup/doctype/territory/territory_tree.js
+++ b/erpnext/setup/doctype/territory/territory_tree.js
@@ -1,3 +1,3 @@
 frappe.treeview_settings["Territory"] = {
 	ignore_fields:["parent_territory"]
-}
\ No newline at end of file
+}
diff --git a/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py b/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py
index bbe6836..933a8c3 100644
--- a/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py
+++ b/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py
@@ -23,7 +23,7 @@
 					contains_company = True
 					break
 			self.assertTrue(contains_company)
-	
+
 	def test_no_of_docs_is_correct(self):
 		for i in range(5):
 			create_task('Dunder Mifflin Paper Co')
@@ -40,13 +40,13 @@
 			'company' : 'Dunder Mifflin Paper Co'
 		})
 		self.assertEqual(tasks_containing_company, [])
-		
+
 def create_company(company_name):
 	company = frappe.get_doc({
 		'doctype': 'Company',
 		'company_name': company_name,
 		'default_currency': 'INR'
-	})		
+	})
 	company.insert(ignore_if_duplicate = True)
 
 def create_transaction_deletion_request(company):
diff --git a/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.js b/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.js
index 20caa15..6a50ef8 100644
--- a/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.js
+++ b/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.js
@@ -4,7 +4,7 @@
 frappe.ui.form.on('Transaction Deletion Record', {
 	onload: function(frm) {
 		if (frm.doc.docstatus == 0) {
-			let doctypes_to_be_ignored_array;	
+			let doctypes_to_be_ignored_array;
 			frappe.call({
 				method: 'erpnext.setup.doctype.transaction_deletion_record.transaction_deletion_record.get_doctypes_to_be_ignored',
 				callback: function(r) {
@@ -25,15 +25,15 @@
 		frm.fields_dict['doctypes_to_be_ignored'].grid.set_column_disp('no_of_docs', false);
 		frm.refresh_field('doctypes_to_be_ignored');
 	}
-	
+
 });
 
 function populate_doctypes_to_be_ignored(doctypes_to_be_ignored_array, frm) {
 	if (!(frm.doc.doctypes_to_be_ignored)) {
 		var i;
-		for (i = 0; i < doctypes_to_be_ignored_array.length; i++) {     
+		for (i = 0; i < doctypes_to_be_ignored_array.length; i++) {
 			frm.add_child('doctypes_to_be_ignored', {
-				doctype_name: doctypes_to_be_ignored_array[i]					
+				doctype_name: doctypes_to_be_ignored_array[i]
 			});
 		}
 	}
diff --git a/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record_list.js b/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record_list.js
index d7175dd..c238f18 100644
--- a/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record_list.js
+++ b/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record_list.js
@@ -9,4 +9,4 @@
 			return [__("Completed"), "green"];
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/setup/doctype/uom/uom.js b/erpnext/setup/doctype/uom/uom.js
index 3878a79..3680906 100644
--- a/erpnext/setup/doctype/uom/uom.js
+++ b/erpnext/setup/doctype/uom/uom.js
@@ -1,13 +1,13 @@
 // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
- 
+
 
 //--------- ONLOAD -------------
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
-   
+
 }
 
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-   
-}
\ No newline at end of file
+
+}
diff --git a/erpnext/setup/doctype/uom/uom.py b/erpnext/setup/doctype/uom/uom.py
index f7f86d6..404b84b 100644
--- a/erpnext/setup/doctype/uom/uom.py
+++ b/erpnext/setup/doctype/uom/uom.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class UOM(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/setup/doctype/website_item_group/website_item_group.py b/erpnext/setup/doctype/website_item_group/website_item_group.py
index 9ac7df2..e416b50 100644
--- a/erpnext/setup/doctype/website_item_group/website_item_group.py
+++ b/erpnext/setup/doctype/website_item_group/website_item_group.py
@@ -9,4 +9,4 @@
 from frappe.model.document import Document
 
 class WebsiteItemGroup(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/setup/setup_wizard/operations/sample_data.py b/erpnext/setup/setup_wizard/operations/sample_data.py
index c11a388..c6d9f08 100644
--- a/erpnext/setup/setup_wizard/operations/sample_data.py
+++ b/erpnext/setup/setup_wizard/operations/sample_data.py
@@ -173,4 +173,4 @@
 	frappe.db.sql('delete from tabProject')
 	frappe.db.sql('delete from tabTask')
 	make_projects('Education')
-	import_notification()
\ No newline at end of file
+	import_notification()
diff --git a/erpnext/setup/setup_wizard/operations/taxes_setup.py b/erpnext/setup/setup_wizard/operations/taxes_setup.py
index bacada9..faa25df 100644
--- a/erpnext/setup/setup_wizard/operations/taxes_setup.py
+++ b/erpnext/setup/setup_wizard/operations/taxes_setup.py
@@ -145,7 +145,7 @@
 
 	doc = frappe.get_doc(template)
 
-	# Data in country wise json is already pre validated, hence validations can be ignored 
+	# Data in country wise json is already pre validated, hence validations can be ignored
 	# Ingone validations to make doctypes faster
 	doc.flags.ignore_links = True
 	doc.flags.ignore_validate = True
@@ -177,7 +177,7 @@
 
 	doc = frappe.get_doc(template)
 
-	# Data in country wise json is already pre validated, hence validations can be ignored 
+	# Data in country wise json is already pre validated, hence validations can be ignored
 	# Ingone validations to make doctypes faster
 	doc.flags.ignore_links = True
 	doc.flags.ignore_validate = True
diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py
index 56afe95..e9f4bd5 100644
--- a/erpnext/shopping_cart/cart.py
+++ b/erpnext/shopping_cart/cart.py
@@ -308,7 +308,7 @@
 	party = get_party()
 
 	party.customer_name = company_name or fullname
-	party.customer_type == "Company" if company_name else "Individual"
+	party.customer_type = "Company" if company_name else "Individual"
 
 	contact_name = frappe.db.get_value("Contact", {"email_id": frappe.session.user})
 	contact = frappe.get_doc("Contact", contact_name)
diff --git a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
index c069b90..efed196 100644
--- a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
+++ b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
@@ -6,7 +6,7 @@
 from __future__ import unicode_literals
 import frappe
 from frappe import _, msgprint
-from frappe.utils import comma_and
+from frappe.utils import flt
 from frappe.model.document import Document
 from frappe.utils import get_datetime, get_datetime_str, now_datetime
 
@@ -18,46 +18,35 @@
 
 	def validate(self):
 		if self.enabled:
-			self.validate_exchange_rates_exist()
+			self.validate_price_list_exchange_rate()
 
-	def validate_exchange_rates_exist(self):
-		"""check if exchange rates exist for all Price List currencies (to company's currency)"""
-		company_currency = frappe.get_cached_value('Company',  self.company,  "default_currency")
+	def validate_price_list_exchange_rate(self):
+		"Check if exchange rate exists for Price List currency (to Company's currency)."
+		from erpnext.setup.utils import get_exchange_rate
+
+		if not self.enabled or not self.company or not self.price_list:
+			return # this function is also called from hooks, check values again
+
+		company_currency = frappe.get_cached_value("Company", self.company, "default_currency")
+		price_list_currency = frappe.db.get_value("Price List", self.price_list, "currency")
+
 		if not company_currency:
-			msgprint(_("Please specify currency in Company") + ": " + self.company,
-				raise_exception=ShoppingCartSetupError)
+			msg = f"Please specify currency in Company {self.company}"
+			frappe.throw(_(msg), title=_("Missing Currency"), exc=ShoppingCartSetupError)
 
-		price_list_currency_map = frappe.db.get_values("Price List",
-			[self.price_list], "currency")
+		if not price_list_currency:
+			msg = f"Please specify currency in Price List {frappe.bold(self.price_list)}"
+			frappe.throw(_(msg), title=_("Missing Currency"), exc=ShoppingCartSetupError)
 
-		price_list_currency_map = dict(price_list_currency_map)
-		
-		# check if all price lists have a currency
-		for price_list, currency in price_list_currency_map.items():
-			if not currency:
-				frappe.throw(_("Currency is required for Price List {0}").format(price_list))
+		if price_list_currency != company_currency:
+			from_currency, to_currency = price_list_currency, company_currency
 
-		expected_to_exist = [currency + "-" + company_currency
-			for currency in price_list_currency_map.values()
-			if currency != company_currency]
+			# Get exchange rate checks Currency Exchange Records too
+			exchange_rate = get_exchange_rate(from_currency, to_currency, args="for_selling")
 
-		# manqala 20/09/2016: set up selection parameters for query from tabCurrency Exchange
-		from_currency = [currency for currency in price_list_currency_map.values() if currency != company_currency]
-		to_currency = company_currency
-		# manqala end
-
-		if expected_to_exist:
-			# manqala 20/09/2016: modify query so that it uses date in the selection from Currency Exchange.
-			# exchange rates defined with date less than the date on which this document is being saved will be selected
-			exists = frappe.db.sql_list("""select CONCAT(from_currency,'-',to_currency) from `tabCurrency Exchange`
-				where from_currency in (%s) and to_currency = "%s" and date <= curdate()""" % (", ".join(["%s"]*len(from_currency)), to_currency), tuple(from_currency))
-			# manqala end
-
-			missing = list(set(expected_to_exist).difference(exists))
-
-			if missing:
-				msgprint(_("Missing Currency Exchange Rates for {0}").format(comma_and(missing)),
-					raise_exception=ShoppingCartSetupError)
+			if not flt(exchange_rate):
+				msg = f"Missing Currency Exchange Rates for {from_currency}-{to_currency}"
+				frappe.throw(_(msg), title=_("Missing"), exc=ShoppingCartSetupError)
 
 	def validate_tax_rule(self):
 		if not frappe.db.get_value("Tax Rule", {"use_for_shopping_cart" : 1}, "name"):
@@ -71,7 +60,7 @@
 	def get_shipping_rules(self, shipping_territory):
 		return self.get_name_from_territory(shipping_territory, "shipping_rules", "shipping_rule")
 
-def validate_cart_settings(doc, method):
+def validate_cart_settings(doc=None, method=None):
 	frappe.get_doc("Shopping Cart Settings", "Shopping Cart Settings").run_method("validate")
 
 def get_shopping_cart_settings():
diff --git a/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py b/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py
index 75899e1..9965e1a 100644
--- a/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py
+++ b/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py
@@ -16,17 +16,25 @@
 		return frappe.get_doc({"doctype": "Shopping Cart Settings",
 			"company": "_Test Company"})
 
-	def test_exchange_rate_exists(self):
-		frappe.db.sql("""delete from `tabCurrency Exchange`""")
+	# NOTE: Exchangrate API has all enabled currencies that ERPNext supports.
+	# We aren't checking just currency exchange record anymore
+	# while validating price list currency exchange rate to that of company.
+	# The API is being used to fetch the rate which again almost always
+	# gives back a valid value (for valid currencies).
+	# This makes the test obsolete.
+	# Commenting because im not sure if there's a better test we can write
 
-		cart_settings = self.get_cart_settings()
-		cart_settings.price_list = "_Test Price List Rest of the World"
-		self.assertRaises(ShoppingCartSetupError, cart_settings.validate_exchange_rates_exist)
+	# def test_exchange_rate_exists(self):
+	# 	frappe.db.sql("""delete from `tabCurrency Exchange`""")
 
-		from erpnext.setup.doctype.currency_exchange.test_currency_exchange import test_records as \
-			currency_exchange_records
-		frappe.get_doc(currency_exchange_records[0]).insert()
-		cart_settings.validate_exchange_rates_exist()
+	# 	cart_settings = self.get_cart_settings()
+	# 	cart_settings.price_list = "_Test Price List Rest of the World"
+	# 	self.assertRaises(ShoppingCartSetupError, cart_settings.validate_price_list_exchange_rate)
+
+	# 	from erpnext.setup.doctype.currency_exchange.test_currency_exchange import test_records as \
+	# 		currency_exchange_records
+	# 	frappe.get_doc(currency_exchange_records[0]).insert()
+	# 	cart_settings.validate_price_list_exchange_rate()
 
 	def test_tax_rule_validation(self):
 		frappe.db.sql("update `tabTax Rule` set use_for_shopping_cart = 0")
@@ -36,7 +44,7 @@
 		cart_settings.enabled = 1
 		if not frappe.db.get_value("Tax Rule", {"use_for_shopping_cart": 1}, "name"):
 			self.assertRaises(ShoppingCartSetupError, cart_settings.validate_tax_rule)
-			
+
 		frappe.db.sql("update `tabTax Rule` set use_for_shopping_cart = 1")
 
-test_dependencies = ["Tax Rule"]
\ No newline at end of file
+test_dependencies = ["Tax Rule"]
diff --git a/erpnext/shopping_cart/product_info.py b/erpnext/shopping_cart/product_info.py
index 29617a8..6c9e531 100644
--- a/erpnext/shopping_cart/product_info.py
+++ b/erpnext/shopping_cart/product_info.py
@@ -66,4 +66,4 @@
 			item["price_sales_uom"] = product_info.get("price").get("formatted_price_sales_uom")
 		else:
 			item["price_stock_uom"] = ""
-			item["price_sales_uom"] = ""
\ No newline at end of file
+			item["price_sales_uom"] = ""
diff --git a/erpnext/shopping_cart/search.py b/erpnext/shopping_cart/search.py
index 63e9fe1..9f674dc 100644
--- a/erpnext/shopping_cart/search.py
+++ b/erpnext/shopping_cart/search.py
@@ -123,4 +123,4 @@
 
 def build_index_for_all_routes():
 	search = ProductSearch(INDEX_NAME)
-	return search.build()
\ No newline at end of file
+	return search.build()
diff --git a/erpnext/shopping_cart/utils.py b/erpnext/shopping_cart/utils.py
index 3241234..0e1466f 100644
--- a/erpnext/shopping_cart/utils.py
+++ b/erpnext/shopping_cart/utils.py
@@ -38,4 +38,4 @@
 				if link.link_doctype in ('Customer', 'Supplier'):
 					return link.link_doctype, link.link_name
 
-		return 'Customer', None
\ No newline at end of file
+		return 'Customer', None
diff --git a/erpnext/shopping_cart/web_template/hero_slider/hero_slider.html b/erpnext/shopping_cart/web_template/hero_slider/hero_slider.html
index 1b39534..1e3d0d0 100644
--- a/erpnext/shopping_cart/web_template/hero_slider/hero_slider.html
+++ b/erpnext/shopping_cart/web_template/hero_slider/hero_slider.html
@@ -82,4 +82,4 @@
 </script>
 
 <style>
-</style>
\ No newline at end of file
+</style>
diff --git a/erpnext/shopping_cart/web_template/item_card_group/item_card_group.html b/erpnext/shopping_cart/web_template/item_card_group/item_card_group.html
index 890ae50..fe061d5 100644
--- a/erpnext/shopping_cart/web_template/item_card_group/item_card_group.html
+++ b/erpnext/shopping_cart/web_template/item_card_group/item_card_group.html
@@ -35,4 +35,4 @@
 </div>
 
 <style>
-</style>
\ No newline at end of file
+</style>
diff --git a/erpnext/startup/filters.py b/erpnext/startup/filters.py
index ec07329..9821016 100644
--- a/erpnext/startup/filters.py
+++ b/erpnext/startup/filters.py
@@ -11,4 +11,4 @@
 		}
 	}
 
-	return filters_config
\ No newline at end of file
+	return filters_config
diff --git a/erpnext/startup/leaderboard.py b/erpnext/startup/leaderboard.py
index 8819a55..a89435d 100644
--- a/erpnext/startup/leaderboard.py
+++ b/erpnext/startup/leaderboard.py
@@ -202,4 +202,4 @@
 		date_condition = "and {0} between {1} and {2}".format(
 			field, frappe.db.escape(from_date), frappe.db.escape(to_date)
 		)
-	return date_condition
\ No newline at end of file
+	return date_condition
diff --git a/erpnext/stock/dashboard/item_dashboard.html b/erpnext/stock/dashboard/item_dashboard.html
index 1e18969..99698ba 100644
--- a/erpnext/stock/dashboard/item_dashboard.html
+++ b/erpnext/stock/dashboard/item_dashboard.html
@@ -4,4 +4,4 @@
 	<div class="more hidden" style="padding: 15px;">
 		<a class="btn btn-default btn-xs btn-more">More</a>
 	</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/stock/dashboard/warehouse_capacity_dashboard.py b/erpnext/stock/dashboard/warehouse_capacity_dashboard.py
index ab573e5..70b030e 100644
--- a/erpnext/stock/dashboard/warehouse_capacity_dashboard.py
+++ b/erpnext/stock/dashboard/warehouse_capacity_dashboard.py
@@ -66,4 +66,4 @@
 			'percent_occupied': flt((flt(balance_qty) / flt(entry.stock_capacity)) * 100, 0)
 		})
 
-	return capacity_data
\ No newline at end of file
+	return capacity_data
diff --git a/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.js b/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.js
index a413754..2b9d46e 100644
--- a/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.js
+++ b/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.js
@@ -11,4 +11,4 @@
 			default: frappe.defaults.get_user_default("Company")
 		}
 	]
-};
\ No newline at end of file
+};
diff --git a/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.py b/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.py
index 374a34e..2258532 100644
--- a/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.py
+++ b/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.py
@@ -45,4 +45,4 @@
 			"values": datapoints
 		}],
 		"type": "bar"
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/stock/doctype/batch/test_batch.js b/erpnext/stock/doctype/batch/test_batch.js
index af7f50f..2d2150b 100644
--- a/erpnext/stock/doctype/batch/test_batch.js
+++ b/erpnext/stock/doctype/batch/test_batch.js
@@ -20,4 +20,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index dbfeb4a..9581896 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -515,7 +515,8 @@
   {
    "fieldname": "scan_barcode",
    "fieldtype": "Data",
-   "label": "Scan Barcode"
+   "label": "Scan Barcode",
+   "options": "Barcode"
   },
   {
    "allow_bulk_edit": 1,
@@ -1305,7 +1306,7 @@
  "idx": 146,
  "is_submittable": 1,
  "links": [],
- "modified": "2021-07-08 21:37:20.802652",
+ "modified": "2021-08-17 20:15:50.574966",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Delivery Note",
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
index 47684d5..9db5db8 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
@@ -30,4 +30,4 @@
 				'items': ['Auto Repeat']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/stock/doctype/delivery_note/regional/india.js b/erpnext/stock/doctype/delivery_note/regional/india.js
index 5e1ff98..e853858 100644
--- a/erpnext/stock/doctype/delivery_note/regional/india.js
+++ b/erpnext/stock/doctype/delivery_note/regional/india.js
@@ -27,4 +27,3 @@
 		}
 	}
 })
-
diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.js b/erpnext/stock/doctype/delivery_note/test_delivery_note.js
index 3f6e8d1..76f7989 100644
--- a/erpnext/stock/doctype/delivery_note/test_delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.js
@@ -33,4 +33,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
index 756825e..91e7c00 100644
--- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
@@ -772,7 +772,7 @@
 		so.submit()
 
 		dn = create_dn_against_so(so.name, delivered_qty=10)
-		
+
 		si = create_sales_invoice(qty=10, do_not_save=1)
 		si.items[0].delivery_note= dn.name
 		si.items[0].dn_detail = dn.items[0].name
diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js b/erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js
index 21eb35c..9f1375f 100644
--- a/erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js
+++ b/erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js
@@ -34,4 +34,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py
index 5030595..8bd381a 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class DeliveryNoteItem(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/delivery_trip/delivery_trip.py b/erpnext/stock/doctype/delivery_trip/delivery_trip.py
index 9ec28d8..f76bb87 100644
--- a/erpnext/stock/doctype/delivery_trip/delivery_trip.py
+++ b/erpnext/stock/doctype/delivery_trip/delivery_trip.py
@@ -406,4 +406,4 @@
 			}
 		}}, target_doc)
 
-	return doc
\ No newline at end of file
+	return doc
diff --git a/erpnext/stock/doctype/delivery_trip/dispatch_notification_template.html b/erpnext/stock/doctype/delivery_trip/dispatch_notification_template.html
index 9c062bc..d12334e 100644
--- a/erpnext/stock/doctype/delivery_trip/dispatch_notification_template.html
+++ b/erpnext/stock/doctype/delivery_trip/dispatch_notification_template.html
@@ -47,4 +47,4 @@
             <td>{{ vehicle }}</td>
         </tr>
     </tbody>
-</table>
\ No newline at end of file
+</table>
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 614c53a..422fe3e 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -1309,4 +1309,4 @@
 
 @erpnext.allow_regional
 def set_item_tax_from_hsn_code(item):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/item/regional/india.js b/erpnext/stock/doctype/item/regional/india.js
index 77ae51f..cceb1ec 100644
--- a/erpnext/stock/doctype/item/regional/india.js
+++ b/erpnext/stock/doctype/item/regional/india.js
@@ -12,4 +12,4 @@
 			});
 		}
 	},
-});
\ No newline at end of file
+});
diff --git a/erpnext/stock/doctype/item/templates/item.html b/erpnext/stock/doctype/item/templates/item.html
index db12309..5c42f3b 100644
--- a/erpnext/stock/doctype/item/templates/item.html
+++ b/erpnext/stock/doctype/item/templates/item.html
@@ -4,4 +4,4 @@
 <h1>{{ title }}</h1>
 {% endblock %}
 
-<!-- this is a sample default web page template -->
\ No newline at end of file
+<!-- this is a sample default web page template -->
diff --git a/erpnext/stock/doctype/item/templates/item_row.html b/erpnext/stock/doctype/item/templates/item_row.html
index 2b99981..f81fc1d 100644
--- a/erpnext/stock/doctype/item/templates/item_row.html
+++ b/erpnext/stock/doctype/item/templates/item_row.html
@@ -1,4 +1,4 @@
 <div>
 	<a href={{ route }}>{{ title }}</a>
 </div>
-<!-- this is a sample default list template -->
\ No newline at end of file
+<!-- this is a sample default list template -->
diff --git a/erpnext/stock/doctype/item/tests/test_item.js b/erpnext/stock/doctype/item/tests/test_item.js
index 5e3524e..7f7e72d 100644
--- a/erpnext/stock/doctype/item/tests/test_item.js
+++ b/erpnext/stock/doctype/item/tests/test_item.js
@@ -118,4 +118,4 @@
 		),
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/stock/doctype/item_attribute/test_item_attribute.py b/erpnext/stock/doctype/item_attribute/test_item_attribute.py
index 61e53d2..07af176 100644
--- a/erpnext/stock/doctype/item_attribute/test_item_attribute.py
+++ b/erpnext/stock/doctype/item_attribute/test_item_attribute.py
@@ -28,4 +28,3 @@
 
 		item_attribute.increment = 0.5
 		item_attribute.save()
-
diff --git a/erpnext/stock/doctype/item_customer_detail/item_customer_detail.py b/erpnext/stock/doctype/item_customer_detail/item_customer_detail.py
index a9183ce..3e4e850 100644
--- a/erpnext/stock/doctype/item_customer_detail/item_customer_detail.py
+++ b/erpnext/stock/doctype/item_customer_detail/item_customer_detail.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class ItemCustomerDetail(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/item_manufacturer/item_manufacturer.py b/erpnext/stock/doctype/item_manufacturer/item_manufacturer.py
index c27d1be..939abf8 100644
--- a/erpnext/stock/doctype/item_manufacturer/item_manufacturer.py
+++ b/erpnext/stock/doctype/item_manufacturer/item_manufacturer.py
@@ -65,4 +65,4 @@
 @frappe.whitelist()
 def get_item_manufacturer_part_no(item_code, manufacturer):
 	return frappe.db.get_value("Item Manufacturer",
-		{'item_code': item_code, 'manufacturer': manufacturer}, 'manufacturer_part_no')
\ No newline at end of file
+		{'item_code': item_code, 'manufacturer': manufacturer}, 'manufacturer_part_no')
diff --git a/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.py b/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.py
index 92aefc8..785737b 100644
--- a/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.py
+++ b/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class ItemQualityInspectionParameter(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/item_reorder/item_reorder.py b/erpnext/stock/doctype/item_reorder/item_reorder.py
index 0f9c593..5cdaa22 100644
--- a/erpnext/stock/doctype/item_reorder/item_reorder.py
+++ b/erpnext/stock/doctype/item_reorder/item_reorder.py
@@ -9,4 +9,4 @@
 from frappe.model.document import Document
 
 class ItemReorder(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/item_supplier/item_supplier.py b/erpnext/stock/doctype/item_supplier/item_supplier.py
index 1a07f03..5dda535 100644
--- a/erpnext/stock/doctype/item_supplier/item_supplier.py
+++ b/erpnext/stock/doctype/item_supplier/item_supplier.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class ItemSupplier(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/item_tax/item_tax.py b/erpnext/stock/doctype/item_tax/item_tax.py
index 1fe2f45..7c9e811 100644
--- a/erpnext/stock/doctype/item_tax/item_tax.py
+++ b/erpnext/stock/doctype/item_tax/item_tax.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class ItemTax(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/item_website_specification/item_website_specification.py b/erpnext/stock/doctype/item_website_specification/item_website_specification.py
index 6d0dbad..e3041cf 100644
--- a/erpnext/stock/doctype/item_website_specification/item_website_specification.py
+++ b/erpnext/stock/doctype/item_website_specification/item_website_specification.py
@@ -9,4 +9,4 @@
 from frappe.model.document import Document
 
 class ItemWebsiteSpecification(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/landed_cost_item/landed_cost_item.py b/erpnext/stock/doctype/landed_cost_item/landed_cost_item.py
index 0521a7a..493e8b2 100644
--- a/erpnext/stock/doctype/landed_cost_item/landed_cost_item.py
+++ b/erpnext/stock/doctype/landed_cost_item/landed_cost_item.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class LandedCostItem(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.py b/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.py
index f7ccb9b..38f4eaf 100644
--- a/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.py
+++ b/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class LandedCostPurchaseReceipt(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.py b/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.py
index e445820..0dc396a 100644
--- a/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.py
+++ b/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.py
@@ -6,4 +6,4 @@
 from frappe.model.document import Document
 
 class LandedCostTaxesandCharges(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json
index 4e2d9e6..cb46a6c 100644
--- a/erpnext/stock/doctype/material_request/material_request.json
+++ b/erpnext/stock/doctype/material_request/material_request.json
@@ -133,7 +133,8 @@
   {
    "fieldname": "scan_barcode",
    "fieldtype": "Data",
-   "label": "Scan Barcode"
+   "label": "Scan Barcode",
+   "options": "Barcode"
   },
   {
    "allow_bulk_edit": 1,
@@ -181,7 +182,7 @@
    "no_copy": 1,
    "oldfieldname": "status",
    "oldfieldtype": "Select",
-   "options": "\nDraft\nSubmitted\nStopped\nCancelled\nPending\nPartially Ordered\nPartially Received\nOrdered\nIssued\nTransferred\nReceived",
+   "options": "\nDraft\nSubmitted\nStopped\nCancelled\nPending\nPartially Ordered\nOrdered\nIssued\nTransferred\nReceived",
    "print_hide": 1,
    "print_width": "100px",
    "read_only": 1,
@@ -314,7 +315,7 @@
  "idx": 70,
  "is_submittable": 1,
  "links": [],
- "modified": "2021-03-31 23:52:55.392512",
+ "modified": "2021-08-17 20:16:12.737743",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Material Request",
diff --git a/erpnext/stock/doctype/material_request/material_request_dashboard.py b/erpnext/stock/doctype/material_request/material_request_dashboard.py
index f3e5e5d..e1e4faf 100644
--- a/erpnext/stock/doctype/material_request/material_request_dashboard.py
+++ b/erpnext/stock/doctype/material_request/material_request_dashboard.py
@@ -20,4 +20,4 @@
 				'items': ['Work Order']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/stock/doctype/material_request/tests/test_material_request.js b/erpnext/stock/doctype/material_request/tests/test_material_request.js
index bf26cd1..a2cd03b 100644
--- a/erpnext/stock/doctype/material_request/tests/test_material_request.js
+++ b/erpnext/stock/doctype/material_request/tests/test_material_request.js
@@ -37,4 +37,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/material_request/tests/test_material_request_from_bom.js b/erpnext/stock/doctype/material_request/tests/test_material_request_from_bom.js
index d8b39fe..6fb55ae 100644
--- a/erpnext/stock/doctype/material_request/tests/test_material_request_from_bom.js
+++ b/erpnext/stock/doctype/material_request/tests/test_material_request_from_bom.js
@@ -25,4 +25,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/material_request/tests/test_material_request_type_manufacture.js b/erpnext/stock/doctype/material_request/tests/test_material_request_type_manufacture.js
index 91b47ba..137079b 100644
--- a/erpnext/stock/doctype/material_request/tests/test_material_request_type_manufacture.js
+++ b/erpnext/stock/doctype/material_request/tests/test_material_request_type_manufacture.js
@@ -27,4 +27,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/material_request/tests/test_material_request_type_material_issue.js b/erpnext/stock/doctype/material_request/tests/test_material_request_type_material_issue.js
index 050e0f0..b03a854 100644
--- a/erpnext/stock/doctype/material_request/tests/test_material_request_type_material_issue.js
+++ b/erpnext/stock/doctype/material_request/tests/test_material_request_type_material_issue.js
@@ -27,4 +27,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/material_request/tests/test_material_request_type_material_transfer.js b/erpnext/stock/doctype/material_request/tests/test_material_request_type_material_transfer.js
index d6f9b66..7c62c2e 100644
--- a/erpnext/stock/doctype/material_request/tests/test_material_request_type_material_transfer.js
+++ b/erpnext/stock/doctype/material_request/tests/test_material_request_type_material_transfer.js
@@ -27,4 +27,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/material_request_item/material_request_item.py b/erpnext/stock/doctype/material_request_item/material_request_item.py
index 16f007f..e0066e6 100644
--- a/erpnext/stock/doctype/material_request_item/material_request_item.py
+++ b/erpnext/stock/doctype/material_request_item/material_request_item.py
@@ -12,4 +12,4 @@
 	pass
 
 def on_doctype_update():
-	frappe.db.add_index("Material Request Item", ["item_code", "warehouse"])
\ No newline at end of file
+	frappe.db.add_index("Material Request Item", ["item_code", "warehouse"])
diff --git a/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py
index 694ab38..b0a8559 100644
--- a/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py
+++ b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py
@@ -9,4 +9,4 @@
 from frappe.model.document import Document
 
 class PackingSlipItem(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/pick_list/pick_list.js b/erpnext/stock/doctype/pick_list/pick_list.js
index ee218f2..730fd7a 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.js
+++ b/erpnext/stock/doctype/pick_list/pick_list.js
@@ -201,4 +201,4 @@
 			uom
 		});
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/doctype/pick_list/pick_list_dashboard.py b/erpnext/stock/doctype/pick_list/pick_list_dashboard.py
index 6e007df..7c321c4 100644
--- a/erpnext/stock/doctype/pick_list/pick_list_dashboard.py
+++ b/erpnext/stock/doctype/pick_list/pick_list_dashboard.py
@@ -9,4 +9,4 @@
 				'items': ['Stock Entry', 'Delivery Note']
 			},
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/stock/doctype/price_list/price_list.css b/erpnext/stock/doctype/price_list/price_list.css
index 61b0694..6832954 100644
--- a/erpnext/stock/doctype/price_list/price_list.css
+++ b/erpnext/stock/doctype/price_list/price_list.css
@@ -4,4 +4,4 @@
 
 .table-grid thead tr {
 	height: 50px;
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/doctype/price_list/price_list.js b/erpnext/stock/doctype/price_list/price_list.js
index c362b5a..9291498 100644
--- a/erpnext/stock/doctype/price_list/price_list.js
+++ b/erpnext/stock/doctype/price_list/price_list.js
@@ -11,4 +11,4 @@
 			frappe.set_route("Report", "Item Price");
 		}, "fa fa-money");
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/stock/doctype/price_list/price_list.py b/erpnext/stock/doctype/price_list/price_list.py
index 33713fa..002d3d8 100644
--- a/erpnext/stock/doctype/price_list/price_list.py
+++ b/erpnext/stock/doctype/price_list/price_list.py
@@ -13,6 +13,9 @@
 		if not cint(self.buying) and not cint(self.selling):
 			throw(_("Price List must be applicable for Buying or Selling"))
 
+		if not self.is_new():
+			self.check_impact_on_shopping_cart()
+
 	def on_update(self):
 		self.set_default_if_missing()
 		self.update_item_price()
@@ -32,6 +35,17 @@
 			buying=%s, selling=%s, modified=NOW() where price_list=%s""",
 			(self.currency, cint(self.buying), cint(self.selling), self.name))
 
+	def check_impact_on_shopping_cart(self):
+		"Check if Price List currency change impacts Shopping Cart."
+		from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import validate_cart_settings
+
+		doc_before_save = self.get_doc_before_save()
+		currency_changed = self.currency != doc_before_save.currency
+		affects_cart = self.name == frappe.get_cached_value("Shopping Cart Settings", None, "price_list")
+
+		if currency_changed and affects_cart:
+			validate_cart_settings()
+
 	def on_trash(self):
 		self.delete_price_list_details_key()
 
@@ -62,4 +76,4 @@
 
 		frappe.cache().hset("price_list_details", price_list, price_list_details)
 
-	return price_list_details or {}
\ No newline at end of file
+	return price_list_details or {}
diff --git a/erpnext/stock/doctype/price_list/test_price_list.py b/erpnext/stock/doctype/price_list/test_price_list.py
index 5979c86..2c287c9 100644
--- a/erpnext/stock/doctype/price_list/test_price_list.py
+++ b/erpnext/stock/doctype/price_list/test_price_list.py
@@ -6,4 +6,4 @@
 
 # test_ignore = ["Item"]
 
-test_records = frappe.get_test_records('Price List')
\ No newline at end of file
+test_records = frappe.get_test_records('Price List')
diff --git a/erpnext/stock/doctype/price_list/test_price_list_uom.js b/erpnext/stock/doctype/price_list/test_price_list_uom.js
index 7fbce7d..3896c0e 100644
--- a/erpnext/stock/doctype/price_list/test_price_list_uom.js
+++ b/erpnext/stock/doctype/price_list/test_price_list_uom.js
@@ -55,4 +55,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
index 44fb736..1a59734 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
@@ -1098,7 +1098,8 @@
   {
    "fieldname": "scan_barcode",
    "fieldtype": "Data",
-   "label": "Scan Barcode"
+   "label": "Scan Barcode",
+   "options": "Barcode"
   },
   {
    "fieldname": "billing_address",
@@ -1148,7 +1149,7 @@
  "idx": 261,
  "is_submittable": 1,
  "links": [],
- "modified": "2021-05-25 00:15:12.239017",
+ "modified": "2021-08-17 20:16:40.849885",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Purchase Receipt",
diff --git a/erpnext/stock/doctype/purchase_receipt/regional/india.js b/erpnext/stock/doctype/purchase_receipt/regional/india.js
index b4f1201..2d982cc 100644
--- a/erpnext/stock/doctype/purchase_receipt/regional/india.js
+++ b/erpnext/stock/doctype/purchase_receipt/regional/india.js
@@ -1,3 +1,3 @@
 {% include "erpnext/regional/india/taxes.js" %}
 
-erpnext.setup_auto_gst_taxation('Purchase Receipt');
\ No newline at end of file
+erpnext.setup_auto_gst_taxation('Purchase Receipt');
diff --git a/erpnext/stock/doctype/putaway_rule/putaway_rule.py b/erpnext/stock/doctype/putaway_rule/putaway_rule.py
index 0f50bcd..315e723 100644
--- a/erpnext/stock/doctype/putaway_rule/putaway_rule.py
+++ b/erpnext/stock/doctype/putaway_rule/putaway_rule.py
@@ -232,4 +232,4 @@
 		allocated_serial_nos = serial_nos[0: cint(to_allocate)]
 		serial_nos[:] = serial_nos[cint(to_allocate):] # pop out allocated serial nos and modify list
 		return "\n".join(allocated_serial_nos) if allocated_serial_nos else ""
-	else: return ""
\ No newline at end of file
+	else: return ""
diff --git a/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py b/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py
index 86f7dc3..0590ae1 100644
--- a/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py
+++ b/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py
@@ -386,4 +386,4 @@
 	if not args.do_not_save:
 		putaway.save()
 
-	return putaway
\ No newline at end of file
+	return putaway
diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.js b/erpnext/stock/doctype/quality_inspection/quality_inspection.js
index f7565fd..d08dc3e 100644
--- a/erpnext/stock/doctype/quality_inspection/quality_inspection.js
+++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.js
@@ -81,4 +81,4 @@
 			});
 		}
 	},
-});
\ No newline at end of file
+});
diff --git a/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.py b/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.py
index 65188a2..b10fa31 100644
--- a/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.py
+++ b/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class QualityInspectionReading(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/quality_inspection_template/quality_inspection_template.py b/erpnext/stock/doctype/quality_inspection_template/quality_inspection_template.py
index 01d2031..971b3c2 100644
--- a/erpnext/stock/doctype/quality_inspection_template/quality_inspection_template.py
+++ b/erpnext/stock/doctype/quality_inspection_template/quality_inspection_template.py
@@ -16,4 +16,4 @@
 		fields=["specification", "value", "acceptance_formula",
 			"numeric", "formula_based_criteria", "min_value", "max_value"],
 		filters={'parenttype': 'Quality Inspection Template', 'parent': template},
-		order_by="idx")
\ No newline at end of file
+		order_by="idx")
diff --git a/erpnext/stock/doctype/serial_no/test_serial_no.py b/erpnext/stock/doctype/serial_no/test_serial_no.py
index b9a58cf..0eccce3 100644
--- a/erpnext/stock/doctype/serial_no/test_serial_no.py
+++ b/erpnext/stock/doctype/serial_no/test_serial_no.py
@@ -193,4 +193,4 @@
 		frappe.db.rollback()
 
 	def tearDown(self):
-		frappe.db.rollback()
\ No newline at end of file
+		frappe.db.rollback()
diff --git a/erpnext/stock/doctype/shipment/shipment.js b/erpnext/stock/doctype/shipment/shipment.js
index ce2906e..13a17a2 100644
--- a/erpnext/stock/doctype/shipment/shipment.js
+++ b/erpnext/stock/doctype/shipment/shipment.js
@@ -150,8 +150,8 @@
 							frm.set_value('pickup_contact_name', '');
 							frm.set_value('pickup_contact', '');
 						}
-						frappe.throw(__("Email or Phone/Mobile of the Contact are mandatory to continue.") 
-							+ "</br>" + __("Please set Email/Phone for the contact") 
+						frappe.throw(__("Email or Phone/Mobile of the Contact are mandatory to continue.")
+							+ "</br>" + __("Please set Email/Phone for the contact")
 							+ ` <a href='/app/contact/${contact_name}'>${contact_name}</a>`);
 					}
 					let contact_display = r.message.contact_display;
@@ -244,8 +244,8 @@
 					frm.set_value('pickup_company', '');
 					frm.set_value('pickup_contact', '');
 				}
-				frappe.throw(__("Last Name, Email or Phone/Mobile of the user are mandatory to continue.") + "</br>" 
-					+ __("Please first set Last Name, Email and Phone for the user") 
+				frappe.throw(__("Last Name, Email or Phone/Mobile of the user are mandatory to continue.") + "</br>"
+					+ __("Please first set Last Name, Email and Phone for the user")
 					+ ` <a href="/app/user/${frappe.session.user}">${frappe.session.user}</a>`);
 			}
 			let contact_display = r.full_name;
diff --git a/erpnext/stock/doctype/shipment/shipment_list.js b/erpnext/stock/doctype/shipment/shipment_list.js
index 52b052c..ae6a3c1 100644
--- a/erpnext/stock/doctype/shipment/shipment_list.js
+++ b/erpnext/stock/doctype/shipment/shipment_list.js
@@ -5,4 +5,4 @@
 			return [__("Booked"), "green"];
 		}
 	}
-};
\ No newline at end of file
+};
diff --git a/erpnext/stock/doctype/shipment/test_shipment.py b/erpnext/stock/doctype/shipment/test_shipment.py
index 9c3e22f..db2f116 100644
--- a/erpnext/stock/doctype/shipment/test_shipment.py
+++ b/erpnext/stock/doctype/shipment/test_shipment.py
@@ -24,7 +24,7 @@
 	customer = get_shipment_customer()
 	item = get_shipment_item(company.name)
 	posting_date = date.today() + timedelta(days=1)
-	
+
 	create_material_receipt(item, company.name)
 	delivery_note = frappe.new_doc("Delivery Note")
 	delivery_note.company = company.name
@@ -73,7 +73,7 @@
 	shipment.pickup_to = '17:00'
 	shipment.description_of_content = 'unit test entry'
 	for delivery_note in delivery_notes:
-		shipment.append('shipment_delivery_note', 
+		shipment.append('shipment_delivery_note',
 			{
 				"delivery_note": delivery_note.name
 			}
@@ -222,7 +222,7 @@
 	)
 	stock.insert()
 	stock.submit()
-	
+
 
 def create_shipment_item(item_name, company_name):
 	item = frappe.new_doc("Item")
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json
index 523d332..2f37778 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.json
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.json
@@ -84,8 +84,6 @@
    "oldfieldtype": "Section Break"
   },
   {
-   "allow_on_submit": 1,
-   "default": "{purpose}",
    "fieldname": "title",
    "fieldtype": "Data",
    "hidden": 1,
@@ -355,6 +353,7 @@
   },
   {
    "fieldname": "scan_barcode",
+   "options": "Barcode",
    "fieldtype": "Data",
    "label": "Scan Barcode"
   },
@@ -629,7 +628,7 @@
  "index_web_pages_for_search": 1,
  "is_submittable": 1,
  "links": [],
- "modified": "2021-05-26 17:07:58.015737",
+ "modified": "2021-08-20 19:19:31.514846",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Stock Entry",
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 8ea1275..760cb7d 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -58,6 +58,7 @@
 
 		self.validate_posting_time()
 		self.validate_purpose()
+		self.set_title()
 		self.validate_item()
 		self.validate_customer_provided_item()
 		self.validate_qty()
@@ -317,9 +318,6 @@
 				d.s_warehouse = self.from_warehouse
 				d.t_warehouse = self.to_warehouse
 
-			if not (d.s_warehouse or d.t_warehouse):
-				frappe.throw(_("Atleast one warehouse is mandatory"))
-
 			if self.purpose in source_mandatory and not d.s_warehouse:
 				if self.from_warehouse:
 					d.s_warehouse = self.from_warehouse
@@ -332,6 +330,7 @@
 				else:
 					frappe.throw(_("Target warehouse is mandatory for row {0}").format(d.idx))
 
+
 			if self.purpose == "Manufacture":
 				if validate_for_manufacture:
 					if d.is_finished_item or d.is_scrap_item or d.is_process_loss:
@@ -346,6 +345,9 @@
 			if cstr(d.s_warehouse) == cstr(d.t_warehouse) and not self.purpose == "Material Transfer for Manufacture":
 				frappe.throw(_("Source and target warehouse cannot be same for row {0}").format(d.idx))
 
+			if not (d.s_warehouse or d.t_warehouse):
+				frappe.throw(_("Atleast one warehouse is mandatory"))
+
 	def validate_work_order(self):
 		if self.purpose in ("Manufacture", "Material Transfer for Manufacture", "Material Consumption for Manufacture"):
 			# check if work order is entered
@@ -1634,6 +1636,14 @@
 
 		return sorted(list(set(get_serial_nos(self.pro_doc.serial_no)) - set(used_serial_nos)))
 
+	def set_title(self):
+		if frappe.flags.in_import and self.title:
+			# Allow updating title during data import/update
+			return
+
+		self.title = self.purpose
+
+
 @frappe.whitelist()
 def move_sample_to_retention_warehouse(company, items):
 	if isinstance(items, string_types):
diff --git a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_issue.js b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_issue.js
index 3cf4861..a87a7fb 100644
--- a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_issue.js
+++ b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_issue.js
@@ -28,4 +28,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_issue_with_serialize_item.js b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_issue_with_serialize_item.js
index aac09c3..cae318d 100644
--- a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_issue_with_serialize_item.js
+++ b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_issue_with_serialize_item.js
@@ -32,4 +32,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_receipt.js b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_receipt.js
index 828738e..ef0286f 100644
--- a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_receipt.js
+++ b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_receipt.js
@@ -29,4 +29,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_receipt_for_serialize_item.js b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_receipt_for_serialize_item.js
index ffd0664..54e1ac8 100644
--- a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_receipt_for_serialize_item.js
+++ b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_receipt_for_serialize_item.js
@@ -32,4 +32,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_transfer.js b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_transfer.js
index cdeb4ab..fac0b4b 100644
--- a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_transfer.js
+++ b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_transfer.js
@@ -31,4 +31,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_transfer_for_manufacture.js b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_transfer_for_manufacture.js
index e8b2973..9f85307 100644
--- a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_transfer_for_manufacture.js
+++ b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_transfer_for_manufacture.js
@@ -31,4 +31,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_repack.js b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_repack.js
index 699634d..20f119a 100644
--- a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_repack.js
+++ b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_repack.js
@@ -39,4 +39,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_subcontract.js b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_subcontract.js
index 770f886..8243426 100644
--- a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_subcontract.js
+++ b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_subcontract.js
@@ -31,4 +31,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py
index f9e062f..a5623fd 100644
--- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py
+++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class StockEntryDetail(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.js
index 80001d6..666d2c7 100644
--- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.js
+++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.js
@@ -29,4 +29,3 @@
 		() => done()
 	]);
 });
-
diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
index c192582..94b006c 100644
--- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
@@ -458,4 +458,3 @@
 			}, allow_negative_stock=1)
 
 test_dependencies = ["Item", "Warehouse"]
-
diff --git a/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.py b/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.py
index 67fe20b..fdead20 100644
--- a/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.py
+++ b/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class UOMConversionDetail(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/stock/doctype/warehouse/test_warehouse.js b/erpnext/stock/doctype/warehouse/test_warehouse.js
index 8ea280c..850da1e 100644
--- a/erpnext/stock/doctype/warehouse/test_warehouse.js
+++ b/erpnext/stock/doctype/warehouse/test_warehouse.js
@@ -16,4 +16,4 @@
 
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/stock/doctype/warehouse/test_warehouse.py b/erpnext/stock/doctype/warehouse/test_warehouse.py
index e3981c9..6e429a2 100644
--- a/erpnext/stock/doctype/warehouse/test_warehouse.py
+++ b/erpnext/stock/doctype/warehouse/test_warehouse.py
@@ -180,4 +180,4 @@
 		if not company_abbr:
 			company_abbr = frappe.get_cached_value("Company", company, 'abbr')
 		group_stock_account = "Current Assets - " + company_abbr
-	return group_stock_account
\ No newline at end of file
+	return group_stock_account
diff --git a/erpnext/stock/doctype/warehouse/warehouse.js b/erpnext/stock/doctype/warehouse/warehouse.js
index 1f17250..9243e1e 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.js
+++ b/erpnext/stock/doctype/warehouse/warehouse.js
@@ -48,11 +48,11 @@
 			frm.add_custom_button(__('Non-Group to Group'),
 				function() { convert_to_group_or_ledger(frm); }, 'fa fa-retweet', 'btn-default')
 		}
-		
+
 		frm.toggle_enable(['is_group', 'company'], false);
 
 		frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Warehouse'};
-		
+
 		frm.fields_dict['parent_warehouse'].get_query = function(doc) {
 			return {
 				filters: {
@@ -83,6 +83,6 @@
 		callback: function(){
 			frm.refresh();
 		}
-		
+
 	})
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/doctype/warehouse/warehouse_tree.js b/erpnext/stock/doctype/warehouse/warehouse_tree.js
index 407d7d1..e9e14c7 100644
--- a/erpnext/stock/doctype/warehouse/warehouse_tree.js
+++ b/erpnext/stock/doctype/warehouse/warehouse_tree.js
@@ -24,4 +24,4 @@
 			+ '</span>').insertBefore(node.$ul);
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index a0fbcec..c72073c 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -278,6 +278,10 @@
 		else:
 			args.uom = item.stock_uom
 
+	if (args.get("batch_no") and
+		item.name != frappe.get_cached_value('Batch', args.get("batch_no"), 'item')):
+		args['batch_no'] = ''
+
 	out = frappe._dict({
 		"item_code": item.name,
 		"item_name": item.item_name,
diff --git a/erpnext/stock/landed_taxes_and_charges_common.js b/erpnext/stock/landed_taxes_and_charges_common.js
index f3f6196..ff8a69f 100644
--- a/erpnext/stock/landed_taxes_and_charges_common.js
+++ b/erpnext/stock/landed_taxes_and_charges_common.js
@@ -59,4 +59,3 @@
 		}
 	});
 });
-
diff --git a/erpnext/stock/page/warehouse_capacity_summary/warehouse_capacity_summary.html b/erpnext/stock/page/warehouse_capacity_summary/warehouse_capacity_summary.html
index 90112c7..de7e38e 100644
--- a/erpnext/stock/page/warehouse_capacity_summary/warehouse_capacity_summary.html
+++ b/erpnext/stock/page/warehouse_capacity_summary/warehouse_capacity_summary.html
@@ -37,4 +37,4 @@
 			{% endif %}
 		</div>
 	</div>
-{% endfor %}
\ No newline at end of file
+{% endfor %}
diff --git a/erpnext/stock/page/warehouse_capacity_summary/warehouse_capacity_summary_header.html b/erpnext/stock/page/warehouse_capacity_summary/warehouse_capacity_summary_header.html
index acaf180..7ac5e64 100644
--- a/erpnext/stock/page/warehouse_capacity_summary/warehouse_capacity_summary_header.html
+++ b/erpnext/stock/page/warehouse_capacity_summary/warehouse_capacity_summary_header.html
@@ -16,4 +16,4 @@
 			% Occupied
 		</div>
 	</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/stock/report/batch_item_expiry_status/batch_item_expiry_status.py b/erpnext/stock/report/batch_item_expiry_status/batch_item_expiry_status.py
index 7354eee..29689b1 100644
--- a/erpnext/stock/report/batch_item_expiry_status/batch_item_expiry_status.py
+++ b/erpnext/stock/report/batch_item_expiry_status/batch_item_expiry_status.py
@@ -24,7 +24,7 @@
 				data.append([item, item_map[item]["item_name"], item_map[item]["description"], wh, batch,
 					frappe.db.get_value('Batch', batch, 'expiry_date'), qty_dict.expiry_status
 				])
-			
+
 
 	return columns, data
 
@@ -70,7 +70,7 @@
 				"expires_on": None, "expiry_status": None}))
 
 		qty_dict = iwb_map[d.item_code][d.warehouse][d.batch_no]
-		
+
 		expiry_date_unicode = frappe.db.get_value('Batch', d.batch_no, 'expiry_date')
 		qty_dict.expires_on = expiry_date_unicode
 
diff --git a/erpnext/stock/report/cogs_by_item_group/cogs_by_item_group.py b/erpnext/stock/report/cogs_by_item_group/cogs_by_item_group.py
index 9e5e63e..da593a4 100644
--- a/erpnext/stock/report/cogs_by_item_group/cogs_by_item_group.py
+++ b/erpnext/stock/report/cogs_by_item_group/cogs_by_item_group.py
@@ -64,7 +64,7 @@
 
 	assign_self_values(leveled_dict, svd_list)
 	assign_agg_values(leveled_dict)
-	
+
 	data = []
 	for item in leveled_dict.items():
 		i = item[1]
@@ -160,7 +160,7 @@
 	if is_bold:
 		item_group = frappe.bold(item_group)
 	return frappe._dict(item_group=item_group, cogs_debit=value, indent=indent)
-			
+
 
 def assign_item_groups_to_svd_list(svd_list: SVDList) -> None:
 	ig_map = get_item_groups_map(svd_list)
diff --git a/erpnext/stock/report/delayed_item_report/delayed_item_report.py b/erpnext/stock/report/delayed_item_report/delayed_item_report.py
index 4fc4027..6130666 100644
--- a/erpnext/stock/report/delayed_item_report/delayed_item_report.py
+++ b/erpnext/stock/report/delayed_item_report/delayed_item_report.py
@@ -174,4 +174,4 @@
 			"fieldname": "po_no",
 			"fieldtype": "Data",
 			"width": 100
-		}]
\ No newline at end of file
+		}]
diff --git a/erpnext/stock/report/delayed_order_report/delayed_order_report.py b/erpnext/stock/report/delayed_order_report/delayed_order_report.py
index 79dc5d8..d915160 100644
--- a/erpnext/stock/report/delayed_order_report/delayed_order_report.py
+++ b/erpnext/stock/report/delayed_order_report/delayed_order_report.py
@@ -87,4 +87,4 @@
 			"fieldname": "po_no",
 			"fieldtype": "Data",
 			"width": 110
-		}]
\ No newline at end of file
+		}]
diff --git a/erpnext/stock/report/delivery_note_trends/delivery_note_trends.js b/erpnext/stock/report/delivery_note_trends/delivery_note_trends.js
index ade004c..8a04565 100644
--- a/erpnext/stock/report/delivery_note_trends/delivery_note_trends.js
+++ b/erpnext/stock/report/delivery_note_trends/delivery_note_trends.js
@@ -6,4 +6,3 @@
 		filters: erpnext.get_sales_trends_filters()
 	}
 });
-
diff --git a/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py b/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py
index 446d304..77fd2ff 100644
--- a/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py
+++ b/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py
@@ -47,4 +47,4 @@
 			]
 		},
 		"type" : "bar"
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/stock/report/incorrect_balance_qty_after_transaction/incorrect_balance_qty_after_transaction.py b/erpnext/stock/report/incorrect_balance_qty_after_transaction/incorrect_balance_qty_after_transaction.py
index cf174c9..00125e7 100644
--- a/erpnext/stock/report/incorrect_balance_qty_after_transaction/incorrect_balance_qty_after_transaction.py
+++ b/erpnext/stock/report/incorrect_balance_qty_after_transaction/incorrect_balance_qty_after_transaction.py
@@ -108,4 +108,4 @@
 		'fieldtype': 'Float',
 		'fieldname': 'differnce',
 		'width': 110
-	}]
\ No newline at end of file
+	}]
diff --git a/erpnext/stock/report/incorrect_serial_no_valuation/incorrect_serial_no_valuation.py b/erpnext/stock/report/incorrect_serial_no_valuation/incorrect_serial_no_valuation.py
index e54cf4c..b3b7594 100644
--- a/erpnext/stock/report/incorrect_serial_no_valuation/incorrect_serial_no_valuation.py
+++ b/erpnext/stock/report/incorrect_serial_no_valuation/incorrect_serial_no_valuation.py
@@ -145,4 +145,4 @@
 		'fieldtype': 'Currency',
 		'fieldname': 'valuation_rate',
 		'width': 110
-	}]
\ No newline at end of file
+	}]
diff --git a/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py b/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py
index a724387..c8f60a1 100644
--- a/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py
+++ b/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py
@@ -138,4 +138,4 @@
 			"fieldtype": "Currency",
 			"width": "150"
 		}
-	]
\ No newline at end of file
+	]
diff --git a/erpnext/stock/report/item_price_stock/item_price_stock.js b/erpnext/stock/report/item_price_stock/item_price_stock.js
index 0bbc61b..7af1dab 100644
--- a/erpnext/stock/report/item_price_stock/item_price_stock.js
+++ b/erpnext/stock/report/item_price_stock/item_price_stock.js
@@ -11,4 +11,4 @@
 			"options": "Item"
 		}
 	]
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/report/item_shortage_report/item_shortage_report.py b/erpnext/stock/report/item_shortage_report/item_shortage_report.py
index 086d833..c67eed7 100644
--- a/erpnext/stock/report/item_shortage_report/item_shortage_report.py
+++ b/erpnext/stock/report/item_shortage_report/item_shortage_report.py
@@ -158,5 +158,3 @@
 	]
 
 	return columns
-
-
diff --git a/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js b/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js
index c0535bf..173aad6 100644
--- a/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js
+++ b/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js
@@ -29,4 +29,4 @@
 			"options": "Brand"
 		}
 	]
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.js b/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.js
index d16485e..695efac 100644
--- a/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.js
+++ b/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.js
@@ -6,4 +6,3 @@
 		filters: erpnext.get_purchase_trends_filters()
 	}
 });
-
diff --git a/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py b/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py
index 8227f15..0d96ea6 100644
--- a/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py
+++ b/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py
@@ -48,4 +48,4 @@
 		},
 		"type" : "bar",
 		"colors":["#5e64ff"]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/stock/report/serial_no_ledger/serial_no_ledger.py b/erpnext/stock/report/serial_no_ledger/serial_no_ledger.py
index c3339fd..cc3aa35 100644
--- a/erpnext/stock/report/serial_no_ledger/serial_no_ledger.py
+++ b/erpnext/stock/report/serial_no_ledger/serial_no_ledger.py
@@ -50,4 +50,3 @@
 
 def get_data(filters):
 	return get_stock_ledger_entries(filters, '<=', order="asc") or []
-
diff --git a/erpnext/stock/report/stock_ageing/stock_ageing.js b/erpnext/stock/report/stock_ageing/stock_ageing.js
index 8495142..b22788f 100644
--- a/erpnext/stock/report/stock_ageing/stock_ageing.js
+++ b/erpnext/stock/report/stock_ageing/stock_ageing.js
@@ -64,4 +64,4 @@
 			"default": 0
 		}
 	]
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/report/stock_analytics/stock_analytics.js b/erpnext/stock/report/stock_analytics/stock_analytics.js
index 6b384e2..78afe6d 100644
--- a/erpnext/stock/report/stock_analytics/stock_analytics.js
+++ b/erpnext/stock/report/stock_analytics/stock_analytics.js
@@ -37,11 +37,25 @@
 			default: "",
 		},
 		{
+			fieldname: "company",
+			label: __("Company"),
+			fieldtype: "Link",
+			options: "Company",
+			default: frappe.defaults.get_user_default("Company"),
+			reqd: 1,
+		},
+		{
 			fieldname: "warehouse",
 			label: __("Warehouse"),
 			fieldtype: "Link",
-			options:"Warehouse",
+			options: "Warehouse",
 			default: "",
+			get_query: function() {
+				const company = frappe.query_report.get_filter_value('company');
+				return {
+					filters: { 'company': company }
+				}
+			}
 		},
 		{
 			fieldname: "from_date",
diff --git a/erpnext/stock/report/stock_analytics/stock_analytics.py b/erpnext/stock/report/stock_analytics/stock_analytics.py
index fde934b..a1e1e7f 100644
--- a/erpnext/stock/report/stock_analytics/stock_analytics.py
+++ b/erpnext/stock/report/stock_analytics/stock_analytics.py
@@ -1,14 +1,15 @@
 # Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
 # For license information, please see license.txt
+import datetime
 
-from __future__ import unicode_literals
 import frappe
 from frappe import _, scrub
-from frappe.utils import getdate, flt
+from frappe.utils import getdate, get_quarter_start, get_first_day_of_week
+from frappe.utils import get_first_day as get_first_day_of_month
+
 from erpnext.stock.report.stock_balance.stock_balance import (get_items, get_stock_ledger_entries, get_item_details)
 from erpnext.accounts.utils import get_fiscal_year
 from erpnext.stock.utils import is_reposting_item_valuation_in_progress
-from six import iteritems
 
 def execute(filters=None):
 	is_reposting_item_valuation_in_progress()
@@ -71,7 +72,8 @@
 
 def get_period_date_ranges(filters):
 		from dateutil.relativedelta import relativedelta
-		from_date, to_date = getdate(filters.from_date), getdate(filters.to_date)
+		from_date = round_down_to_nearest_frequency(filters.from_date, filters.range)
+		to_date = getdate(filters.to_date)
 
 		increment = {
 			"Monthly": 1,
@@ -97,6 +99,31 @@
 
 		return periodic_daterange
 
+
+def round_down_to_nearest_frequency(date: str, frequency: str) -> datetime.datetime:
+	"""Rounds down the date to nearest frequency unit.
+	example:
+
+	>>> round_down_to_nearest_frequency("2021-02-21", "Monthly")
+	datetime.datetime(2021, 2, 1)
+
+	>>> round_down_to_nearest_frequency("2021-08-21", "Yearly")
+	datetime.datetime(2021, 1, 1)
+	"""
+
+	def _get_first_day_of_fiscal_year(date):
+		fiscal_year = get_fiscal_year(date)
+		return fiscal_year and fiscal_year[1] or date
+
+	round_down_function = {
+		"Monthly": get_first_day_of_month,
+		"Quarterly": get_quarter_start,
+		"Weekly": get_first_day_of_week,
+		"Yearly": _get_first_day_of_fiscal_year,
+	}.get(frequency, getdate)
+	return round_down_function(date)
+
+
 def get_period(posting_date, filters):
 	months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
 
@@ -177,7 +204,7 @@
 	periodic_data = get_periodic_data(sle, filters)
 	ranges = get_period_date_ranges(filters)
 
-	for dummy, item_data in iteritems(item_details):
+	for dummy, item_data in item_details.items():
 		row = {
 			"name": item_data.name,
 			"item_name": item_data.item_name,
@@ -208,7 +235,3 @@
 	chart["type"] = "line"
 
 	return chart
-
-
-
-
diff --git a/erpnext/stock/report/stock_analytics/test_stock_analytics.py b/erpnext/stock/report/stock_analytics/test_stock_analytics.py
new file mode 100644
index 0000000..00e268b
--- /dev/null
+++ b/erpnext/stock/report/stock_analytics/test_stock_analytics.py
@@ -0,0 +1,35 @@
+import datetime
+import unittest
+
+from frappe import _dict
+from erpnext.accounts.utils import get_fiscal_year
+
+from erpnext.stock.report.stock_analytics.stock_analytics import get_period_date_ranges
+
+
+class TestStockAnalyticsReport(unittest.TestCase):
+	def test_get_period_date_ranges(self):
+
+		filters = _dict(range="Monthly", from_date="2020-12-28", to_date="2021-02-06")
+
+		ranges = get_period_date_ranges(filters)
+
+		expected_ranges = [
+			[datetime.date(2020, 12, 1), datetime.date(2020, 12, 31)],
+			[datetime.date(2021, 1, 1), datetime.date(2021, 1, 31)],
+			[datetime.date(2021, 2, 1), datetime.date(2021, 2, 6)],
+		]
+
+		self.assertEqual(ranges, expected_ranges)
+
+	def test_get_period_date_ranges_yearly(self):
+
+		filters = _dict(range="Yearly", from_date="2021-01-28", to_date="2021-02-06")
+
+		ranges = get_period_date_ranges(filters)
+		first_date = get_fiscal_year("2021-01-28")[1]
+		expected_ranges = [
+			[first_date, datetime.date(2021, 2, 6)],
+		]
+
+		self.assertEqual(ranges, expected_ranges)
diff --git a/erpnext/stock/report/stock_and_account_value_comparison/stock_and_account_value_comparison.py b/erpnext/stock/report/stock_and_account_value_comparison/stock_and_account_value_comparison.py
index bfc4471..7e0c0e8 100644
--- a/erpnext/stock/report/stock_and_account_value_comparison/stock_and_account_value_comparison.py
+++ b/erpnext/stock/report/stock_and_account_value_comparison/stock_and_account_value_comparison.py
@@ -128,4 +128,4 @@
 			"fieldtype": "Currency",
 			"width": "120"
 		}
-	]
\ No newline at end of file
+	]
diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py
index 8909f21..b6923e9 100644
--- a/erpnext/stock/report/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/report/stock_ledger/stock_ledger.py
@@ -23,6 +23,7 @@
 	conversion_factors = []
 	if opening_row:
 		data.append(opening_row)
+		conversion_factors.append(0)
 
 	actual_qty = stock_value = 0
 
diff --git a/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py b/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py
index 808d279..7956f2e 100644
--- a/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py
+++ b/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py
@@ -32,7 +32,7 @@
 
 		if filters.brand and filters.brand != item.brand:
 			continue
-			
+
 		elif filters.item_group and filters.item_group != item.item_group:
 			continue
 
diff --git a/erpnext/stock/report/stock_qty_vs_serial_no_count/stock_qty_vs_serial_no_count.py b/erpnext/stock/report/stock_qty_vs_serial_no_count/stock_qty_vs_serial_no_count.py
index 78e95df..fa19eeb 100644
--- a/erpnext/stock/report/stock_qty_vs_serial_no_count/stock_qty_vs_serial_no_count.py
+++ b/erpnext/stock/report/stock_qty_vs_serial_no_count/stock_qty_vs_serial_no_count.py
@@ -58,14 +58,14 @@
 	serial_item_list = frappe.get_all("Item", filters={
 		'has_serial_no': True,
 	}, fields=['item_code', 'item_name'])
-	
+
 	status_list = ['Active', 'Expired']
 	data = []
 	for item in serial_item_list:
-		total_serial_no = frappe.db.count("Serial No", 
+		total_serial_no = frappe.db.count("Serial No",
 			filters={"item_code": item.item_code, "status": ("in", status_list), "warehouse": warehouse})
 
-		actual_qty = frappe.db.get_value('Bin', fieldname=['actual_qty'], 
+		actual_qty = frappe.db.get_value('Bin', fieldname=['actual_qty'],
 			filters={"warehouse": warehouse, "item_code": item.item_code})
 
 		# frappe.db.get_value returns null if no record exist.
@@ -84,4 +84,4 @@
 
 		data.append(row)
 
-	return data
\ No newline at end of file
+	return data
diff --git a/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.js b/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.js
index cdc9895..5b00647 100644
--- a/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.js
+++ b/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.js
@@ -25,4 +25,4 @@
 			"default": frappe.datetime.month_end()
 		},
 	]
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/report/total_stock_summary/total_stock_summary.js b/erpnext/stock/report/total_stock_summary/total_stock_summary.js
index 2646428..90648f1 100644
--- a/erpnext/stock/report/total_stock_summary/total_stock_summary.js
+++ b/erpnext/stock/report/total_stock_summary/total_stock_summary.js
@@ -38,4 +38,4 @@
 			"reqd": 1
 		},
 	]
-}
\ No newline at end of file
+}
diff --git a/erpnext/support/doctype/issue/issue.js b/erpnext/support/doctype/issue/issue.js
index 9ac1efa..d4daacd 100644
--- a/erpnext/support/doctype/issue/issue.js
+++ b/erpnext/support/doctype/issue/issue.js
@@ -145,4 +145,4 @@
 		// 	frm.timeline.wrapper.data("help-article-event-attached", true);
 		// }
 	},
-});
\ No newline at end of file
+});
diff --git a/erpnext/support/doctype/issue/test_issue.py b/erpnext/support/doctype/issue/test_issue.py
index 84f8c39..4146e48 100644
--- a/erpnext/support/doctype/issue/test_issue.py
+++ b/erpnext/support/doctype/issue/test_issue.py
@@ -13,6 +13,10 @@
 class TestSetUp(unittest.TestCase):
 	def setUp(self):
 		frappe.db.sql("delete from `tabService Level Agreement`")
+		frappe.db.sql("delete from `tabService Level Priority`")
+		frappe.db.sql("delete from `tabSLA Fulfilled On Status`")
+		frappe.db.sql("delete from `tabPause SLA On Status`")
+		frappe.db.sql("delete from `tabService Day`")
 		frappe.db.set_value("Support Settings", None, "track_service_level_agreement", 1)
 		create_service_level_agreements_for_issues()
 
@@ -178,7 +182,7 @@
 	# issue creation and first response are on consecutive days
 	def test_first_response_time_case6(self):
 		"""
-			Test frt when the issue was created before working hours and the first response is also sent before working hours, but on the next day. 
+			Test frt when the issue was created before working hours and the first response is also sent before working hours, but on the next day.
 		"""
 		issue = create_issue_and_communication(get_datetime("06-28-2021 6:00"), get_datetime("06-29-2021 6:00"))
 		self.assertEqual(issue.first_response_time, 28800.0)
@@ -200,7 +204,7 @@
 	def test_first_response_time_case9(self):
 		"""
 			Test frt when the issue was created before working hours and the first response is sent on the next day, which is not a work day.
-		""" 
+		"""
 		issue = create_issue_and_communication(get_datetime("06-25-2021 6:00"), get_datetime("06-26-2021 11:00"))
 		self.assertEqual(issue.first_response_time, 28800.0)
 
@@ -228,7 +232,7 @@
 	def test_first_response_time_case13(self):
 		"""
 			Test frt when the issue was created during working hours and the first response is sent on the next day, which is not a work day.
-		""" 
+		"""
 		issue = create_issue_and_communication(get_datetime("06-25-2021 12:00"), get_datetime("06-26-2021 11:00"))
 		self.assertEqual(issue.first_response_time, 21600.0)
 
@@ -344,7 +348,7 @@
 		"""
 		issue = create_issue_and_communication(get_datetime("06-25-2021 20:00"), get_datetime("06-27-2021 11:00"))
 		self.assertEqual(issue.first_response_time, 1.0)
-	
+
 def create_issue_and_communication(issue_creation, first_responded_on):
 	issue = make_issue(issue_creation, index=1)
 	sender = create_user("test@admin.com")
@@ -418,4 +422,4 @@
 		"creation": creation,
 		"reference_name": reference_name
 	})
-	communication.save()
\ No newline at end of file
+	communication.save()
diff --git a/erpnext/support/doctype/issue_priority/issue_priority.py b/erpnext/support/doctype/issue_priority/issue_priority.py
index 7c8925e..514b6cc 100644
--- a/erpnext/support/doctype/issue_priority/issue_priority.py
+++ b/erpnext/support/doctype/issue_priority/issue_priority.py
@@ -8,4 +8,4 @@
 from frappe.model.document import Document
 
 class IssuePriority(Document):
-	pass
\ No newline at end of file
+	pass
diff --git a/erpnext/support/doctype/issue_priority/test_issue_priority.py b/erpnext/support/doctype/issue_priority/test_issue_priority.py
index a7b55f8..618c93e 100644
--- a/erpnext/support/doctype/issue_priority/test_issue_priority.py
+++ b/erpnext/support/doctype/issue_priority/test_issue_priority.py
@@ -25,4 +25,4 @@
 		frappe.get_doc({
 			"doctype": "Issue Priority",
 			"name": name
-		}).insert(ignore_permissions=True)
\ No newline at end of file
+		}).insert(ignore_permissions=True)
diff --git a/erpnext/support/doctype/service_level_agreement/service_level_agreement.json b/erpnext/support/doctype/service_level_agreement/service_level_agreement.json
index b67c7fc..b649b87 100644
--- a/erpnext/support/doctype/service_level_agreement/service_level_agreement.json
+++ b/erpnext/support/doctype/service_level_agreement/service_level_agreement.json
@@ -182,11 +182,6 @@
    "label": "Apply SLA for Resolution Time"
   },
   {
-   "label": "Pause SLA On",
-   "fieldname": "pause_sla_on",
-   "options": "Pause SLA On Status"
-  },
-  {
    "fieldname": "filters_section",
    "fieldtype": "Section Break",
    "label": "Assignment Condition"
@@ -208,7 +203,7 @@
   }
  ],
  "links": [],
- "modified": "2021-07-09 12:28:46.283334",
+ "modified": "2021-07-27 11:16:45.596579",
  "modified_by": "Administrator",
  "module": "Support",
  "name": "Service Level Agreement",
diff --git a/erpnext/support/doctype/service_level_agreement/service_level_agreement.py b/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
index 083bde9..8c1c1ef 100644
--- a/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
+++ b/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
@@ -11,6 +11,7 @@
 from frappe.utils import time_diff_in_seconds, getdate, get_weekdays, add_to_date, get_time, get_datetime, \
 	get_time_zone, to_timedelta, get_datetime_str, get_link_to_form, cint, nowdate
 from datetime import datetime
+from frappe.utils.safe_exec import get_safe_globals
 from erpnext.support.doctype.issue.issue import get_holidays
 from frappe.utils.safe_exec import get_safe_globals
 
@@ -100,7 +101,7 @@
 				frappe.bold(self.document_type)))
 
 	def validate_condition(self):
-		temp_doc = frappe.new_doc('Issue')
+		temp_doc = frappe.new_doc(self.document_type)
 		if self.condition:
 			try:
 				frappe.safe_eval(self.condition, None, get_context(temp_doc))
@@ -227,24 +228,24 @@
 	if doc.get('priority'):
 		filters.append(["Service Level Priority", "priority", "=", doc.get('priority')])
 
-	customer = doc.get('customer')
-	or_filters = [
-		["Service Level Agreement", "entity", "in", [customer, get_customer_group(customer), get_customer_territory(customer)]]
-	]
-
-	service_level_agreement = doc.get('service_level_agreement')
-	if service_level_agreement:
+	or_filters = []
+	if doc.get('service_level_agreement'):
 		or_filters = [
 			["Service Level Agreement", "name", "=", doc.get('service_level_agreement')],
 		]
 
+	customer = doc.get('customer')
+	or_filters.append(
+		["Service Level Agreement", "entity", "in", [customer, get_customer_group(customer), get_customer_territory(customer)]]
+	)
+
 	default_sla_filter = filters + [["Service Level Agreement", "default_service_level_agreement", "=", 1]]
 	default_sla = frappe.get_all("Service Level Agreement", filters=default_sla_filter,
-		fields=["name", "default_priority", "condition"])
+		fields=["name", "default_priority", "apply_sla_for_resolution", "condition"])
 
 	filters += [["Service Level Agreement", "default_service_level_agreement", "=", 0]]
 	agreements = frappe.get_all("Service Level Agreement", filters=filters, or_filters=or_filters,
-		fields=["name", "default_priority", "condition"])
+		fields=["name", "default_priority", "apply_sla_for_resolution", "condition"])
 
 	# check if the current document on which SLA is to be applied fulfills all the conditions
 	filtered_agreements = []
@@ -261,7 +262,6 @@
 def get_context(doc):
 	return {"doc": doc.as_dict(), "nowdate": nowdate, "frappe": frappe._dict(utils=get_safe_globals().get("frappe").get("utils"))}
 
-
 def get_customer_group(customer):
 	return frappe.db.get_value("Customer", customer, "customer_group") if customer else None
 
diff --git a/erpnext/support/doctype/service_level_agreement/service_level_agreement_dashboard.py b/erpnext/support/doctype/service_level_agreement/service_level_agreement_dashboard.py
index f2bd681..7e7a405 100644
--- a/erpnext/support/doctype/service_level_agreement/service_level_agreement_dashboard.py
+++ b/erpnext/support/doctype/service_level_agreement/service_level_agreement_dashboard.py
@@ -9,4 +9,4 @@
 				'items': ['Issue']
 			}
 		]
-	}
\ No newline at end of file
+	}
diff --git a/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py b/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py
index 7bc97d6..d9c671e 100644
--- a/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py
+++ b/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py
@@ -253,6 +253,30 @@
 		lead.reload()
 		self.assertEqual(lead.response_by_variance, 1800.0)
 
+	def test_service_level_agreement_filters(self):
+		doctype = "Lead"
+		lead_sla = create_service_level_agreement(
+			default_service_level_agreement=0,
+			doctype=doctype,
+			holiday_list="__Test Holiday List",
+			entity_type=None, entity=None,
+			condition='doc.source == "Test Source"',
+			response_time=14400,
+			sla_fulfilled_on=[{"status": "Replied"}],
+			apply_sla_for_resolution=0
+		)
+		creation = datetime.datetime(2019, 3, 4, 12, 0)
+		lead = make_lead(creation=creation, index=4)
+		applied_sla = frappe.db.get_value('Lead', lead.name, 'service_level_agreement')
+		self.assertFalse(applied_sla)
+
+		source = frappe.get_doc(doctype='Lead Source', source_name='Test Source')
+		source.insert(ignore_if_duplicate=True)
+		lead.source = "Test Source"
+		lead.save()
+		applied_sla = frappe.db.get_value('Lead', lead.name, 'service_level_agreement')
+		self.assertEqual(applied_sla, lead_sla.name)
+
 	def tearDown(self):
 		for d in frappe.get_all("Service Level Agreement"):
 			frappe.delete_doc("Service Level Agreement", d.name, force=1)
@@ -268,7 +292,7 @@
 	return service_level_agreement
 
 def create_service_level_agreement(default_service_level_agreement, holiday_list, response_time, entity_type,
-	entity, resolution_time=0, doctype="Issue", sla_fulfilled_on=[], pause_sla_on=[], apply_sla_for_resolution=1):
+	entity, resolution_time=0, doctype="Issue", condition="", sla_fulfilled_on=[], pause_sla_on=[], apply_sla_for_resolution=1):
 
 	make_holiday_list()
 	make_priorities()
@@ -287,6 +311,7 @@
 		"document_type": doctype,
 		"service_level": "__Test {} SLA".format(entity_type if entity_type else "Default"),
 		"default_service_level_agreement": default_service_level_agreement,
+		"condition": condition,
 		"default_priority": "Medium",
 		"holiday_list": holiday_list,
 		"entity_type": entity_type,
@@ -488,5 +513,6 @@
 		"lead_name": "_Test Lead {0}".format(index),
 		"status": "Open",
 		"creation": creation,
-		"service_level_agreement_creation": creation
-	}).insert(ignore_permissions=True)
\ No newline at end of file
+		"service_level_agreement_creation": creation,
+		"priority": "Medium"
+	}).insert(ignore_permissions=True)
diff --git a/erpnext/support/report/first_response_time_for_issues/first_response_time_for_issues.py b/erpnext/support/report/first_response_time_for_issues/first_response_time_for_issues.py
index 922da2b..69bf273 100644
--- a/erpnext/support/report/first_response_time_for_issues/first_response_time_for_issues.py
+++ b/erpnext/support/report/first_response_time_for_issues/first_response_time_for_issues.py
@@ -32,4 +32,4 @@
 		ORDER BY creation_date desc
 	''', (filters.from_date, filters.to_date))
 
-	return columns, data
\ No newline at end of file
+	return columns, data
diff --git a/erpnext/support/report/issue_analytics/issue_analytics.py b/erpnext/support/report/issue_analytics/issue_analytics.py
index 3fdb10d..54fce0b 100644
--- a/erpnext/support/report/issue_analytics/issue_analytics.py
+++ b/erpnext/support/report/issue_analytics/issue_analytics.py
@@ -218,4 +218,4 @@
 				'datasets': []
 			},
 			'type': 'line'
-		}
\ No newline at end of file
+		}
diff --git a/erpnext/support/report/issue_analytics/test_issue_analytics.py b/erpnext/support/report/issue_analytics/test_issue_analytics.py
index 7748319..a9d961a 100644
--- a/erpnext/support/report/issue_analytics/test_issue_analytics.py
+++ b/erpnext/support/report/issue_analytics/test_issue_analytics.py
@@ -22,7 +22,7 @@
 		if current_month_date.year != last_month_date.year:
 			self.current_month += '_' + str(current_month_date.year)
 			self.last_month += '_' + str(last_month_date.year)
-		
+
 	def test_issue_analytics(self):
 		create_service_level_agreements_for_issues()
 		create_issue_types()
@@ -211,4 +211,4 @@
 		"assign_to": ["test@example.com", "test1@example.com"],
 		"doctype": "Issue",
 		"name": issue.name
-	})
\ No newline at end of file
+	})
diff --git a/erpnext/support/report/issue_summary/issue_summary.py b/erpnext/support/report/issue_summary/issue_summary.py
index bba25b8..7c4af39 100644
--- a/erpnext/support/report/issue_summary/issue_summary.py
+++ b/erpnext/support/report/issue_summary/issue_summary.py
@@ -362,4 +362,3 @@
 				'datatype': 'Int',
 			}
 		]
-
diff --git a/erpnext/support/web_form/issues/issues.js b/erpnext/support/web_form/issues/issues.js
index 699703c..ffc5e98 100644
--- a/erpnext/support/web_form/issues/issues.js
+++ b/erpnext/support/web_form/issues/issues.js
@@ -1,3 +1,3 @@
 frappe.ready(function() {
 	// bind events here
-})
\ No newline at end of file
+})
diff --git a/erpnext/telephony/doctype/call_log/call_log.py b/erpnext/telephony/doctype/call_log/call_log.py
index c00dfa9..6f8e411 100644
--- a/erpnext/telephony/doctype/call_log/call_log.py
+++ b/erpnext/telephony/doctype/call_log/call_log.py
@@ -173,4 +173,3 @@
 		})
 
 	return timeline_contents
-
diff --git a/erpnext/telephony/doctype/incoming_call_settings/incoming_call_settings.js b/erpnext/telephony/doctype/incoming_call_settings/incoming_call_settings.js
index 1bcc846..b80acdb 100644
--- a/erpnext/telephony/doctype/incoming_call_settings/incoming_call_settings.js
+++ b/erpnext/telephony/doctype/incoming_call_settings/incoming_call_settings.js
@@ -99,4 +99,3 @@
 		validate_call_schedule(frm.doc.call_handling_schedule);
 	}
 });
-
diff --git a/erpnext/templates/emails/birthday_reminder.html b/erpnext/templates/emails/birthday_reminder.html
index 12cdf1e..1f57b49 100644
--- a/erpnext/templates/emails/birthday_reminder.html
+++ b/erpnext/templates/emails/birthday_reminder.html
@@ -22,4 +22,4 @@
 		<span>{{ reminder_text }}</span>
 		<p class="text-muted">{{ message }}</p>
 	</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/templates/emails/daily_project_summary.html b/erpnext/templates/emails/daily_project_summary.html
index 8b60830..5ccc610 100644
--- a/erpnext/templates/emails/daily_project_summary.html
+++ b/erpnext/templates/emails/daily_project_summary.html
@@ -43,4 +43,4 @@
 <table border="0" cellpadding="0" cellspacing="0" width="100%">
 	<tr height="20"></tr>
 </table>
-{% endfor %}
\ No newline at end of file
+{% endfor %}
diff --git a/erpnext/templates/emails/daily_work_summary.html b/erpnext/templates/emails/daily_work_summary.html
index a22e09c..1764e8f 100644
--- a/erpnext/templates/emails/daily_work_summary.html
+++ b/erpnext/templates/emails/daily_work_summary.html
@@ -52,4 +52,4 @@
 		</div>
 	</tr>
 </table>
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/erpnext/templates/emails/request_for_quotation.html b/erpnext/templates/emails/request_for_quotation.html
index 812939a..3283987 100644
--- a/erpnext/templates/emails/request_for_quotation.html
+++ b/erpnext/templates/emails/request_for_quotation.html
@@ -21,4 +21,4 @@
 	</button>
 </p>
 
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/erpnext/templates/emails/training_event.html b/erpnext/templates/emails/training_event.html
index 51c232d..8a2414a 100644
--- a/erpnext/templates/emails/training_event.html
+++ b/erpnext/templates/emails/training_event.html
@@ -11,7 +11,7 @@
 <h4>{{_("Update Response")}}</h4>
 {% if not self_study %}
 <p>{{_("Please update your status for this training event")}}:</p>
-<form action="{{ confirm_link }}"><input style="display:inline-block" type="submit" value="Confirm Attendance" /></form>   
+<form action="{{ confirm_link }}"><input style="display:inline-block" type="submit" value="Confirm Attendance" /></form>
 <form action="{{ reject_link }}"><input style="display:inline-block" type="submit" value="Reject Invitation" /></form>
 {% else %}
 <p>{{_("Please confirm once you have completed your training")}}:</p>
diff --git a/erpnext/templates/generators/item/item_inquiry.js b/erpnext/templates/generators/item/item_inquiry.js
index e7db3a3..4724b68 100644
--- a/erpnext/templates/generators/item/item_inquiry.js
+++ b/erpnext/templates/generators/item/item_inquiry.js
@@ -74,4 +74,4 @@
 
 		d.show();
 	});
-});
\ No newline at end of file
+});
diff --git a/erpnext/templates/generators/item/item_specifications.html b/erpnext/templates/generators/item/item_specifications.html
index 469a45f..d4dfa8e 100644
--- a/erpnext/templates/generators/item/item_specifications.html
+++ b/erpnext/templates/generators/item/item_specifications.html
@@ -11,4 +11,4 @@
 		</table>
 	</div>
 </div>
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/erpnext/templates/generators/item_group.html b/erpnext/templates/generators/item_group.html
index 9050cc3..b5f18ba 100644
--- a/erpnext/templates/generators/item_group.html
+++ b/erpnext/templates/generators/item_group.html
@@ -159,4 +159,4 @@
 		});
 	});
 </script>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/templates/generators/job_opening.html b/erpnext/templates/generators/job_opening.html
index c562db3..135fb36 100644
--- a/erpnext/templates/generators/job_opening.html
+++ b/erpnext/templates/generators/job_opening.html
@@ -14,17 +14,17 @@
 <div>{{ description }}</div>
 {% endif %}
 
-{%- if publish_salary_range -%} 
+{%- if publish_salary_range -%}
 <div><b>{{_("Salary range per month")}}: </b>{{ frappe.format_value(frappe.utils.flt(lower_range), currency=currency) }} - {{ frappe.format_value(frappe.utils.flt(upper_range), currency=currency) }}</div>
 {% endif %}
 
 <p style='margin-top: 30px'>
 	{%- if job_application_route -%}
-	<a class='btn btn-primary' 
+	<a class='btn btn-primary'
 	href='/{{job_application_route}}?new=1&job_title={{ doc.name }}'>
 	{{ _("Apply Now") }}</a>
 	{% else %}
-	<a class='btn btn-primary' 
+	<a class='btn btn-primary'
 	href='/job_application?new=1&job_title={{ doc.name }}'>
 	{{ _("Apply Now") }}</a>
 	{% endif %}
diff --git a/erpnext/templates/generators/student_admission.html b/erpnext/templates/generators/student_admission.html
index 8b15344..8cc58a0 100644
--- a/erpnext/templates/generators/student_admission.html
+++ b/erpnext/templates/generators/student_admission.html
@@ -14,7 +14,7 @@
 
 {%- if introduction -%}
 <div>{{ introduction }}</div>
-{% endif %} 
+{% endif %}
 
 {%- if doc.enable_admission_application -%}
 <p>
diff --git a/erpnext/templates/includes/cart/address_picker_card.html b/erpnext/templates/includes/cart/address_picker_card.html
index 2334ea2..646210e 100644
--- a/erpnext/templates/includes/cart/address_picker_card.html
+++ b/erpnext/templates/includes/cart/address_picker_card.html
@@ -9,4 +9,4 @@
 		</p>
 		<a href="/addresses?name={{address.name}}" class="card-link">{{ _('Edit') }}</a>
 	</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/templates/includes/cart/cart_address_picker.html b/erpnext/templates/includes/cart/cart_address_picker.html
index 72cc5f5..66a50ec 100644
--- a/erpnext/templates/includes/cart/cart_address_picker.html
+++ b/erpnext/templates/includes/cart/cart_address_picker.html
@@ -1,4 +1,3 @@
 <div class="mb-3 frappe-card p-5" data-section="shipping-address">
 	<h6>{{ _("Shipping Address") }}</h6>
 </div>
-
diff --git a/erpnext/templates/includes/cart/cart_items_dropdown.html b/erpnext/templates/includes/cart/cart_items_dropdown.html
index b2ba431..5d107fc 100644
--- a/erpnext/templates/includes/cart/cart_items_dropdown.html
+++ b/erpnext/templates/includes/cart/cart_items_dropdown.html
@@ -9,4 +9,4 @@
         {{ d.get_formatted("amount") }}
     </div>
 </div>
-{% endfor %}
\ No newline at end of file
+{% endfor %}
diff --git a/erpnext/templates/includes/course/macros.html b/erpnext/templates/includes/course/macros.html
index c80dca4..334b5ea 100644
--- a/erpnext/templates/includes/course/macros.html
+++ b/erpnext/templates/includes/course/macros.html
@@ -1 +1 @@
-{% macro back_link(doc) %}&back-to=/courses?course={{ doc.name }}&back-to-title={{ doc.course_name }}{% endmacro %}
\ No newline at end of file
+{% macro back_link(doc) %}&back-to=/courses?course={{ doc.name }}&back-to-title={{ doc.course_name }}{% endmacro %}
diff --git a/erpnext/templates/includes/itemised_tax_breakup.html b/erpnext/templates/includes/itemised_tax_breakup.html
index c2f1353..5652bb1 100644
--- a/erpnext/templates/includes/itemised_tax_breakup.html
+++ b/erpnext/templates/includes/itemised_tax_breakup.html
@@ -43,4 +43,4 @@
 			{% endfor %}
 		</tbody>
 	</table>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/templates/includes/macros.html b/erpnext/templates/includes/macros.html
index c44bfb5..be0d47f 100644
--- a/erpnext/templates/includes/macros.html
+++ b/erpnext/templates/includes/macros.html
@@ -120,4 +120,4 @@
 	{% endif %}
 </div>
 <a href="/{{ url or '#' }}" class="stretched-link"></a>
-{%- endmacro -%}
\ No newline at end of file
+{%- endmacro -%}
diff --git a/erpnext/templates/includes/navbar/navbar_items.html b/erpnext/templates/includes/navbar/navbar_items.html
index 133d99e..2912206 100644
--- a/erpnext/templates/includes/navbar/navbar_items.html
+++ b/erpnext/templates/includes/navbar/navbar_items.html
@@ -9,4 +9,4 @@
 			<span class="badge badge-primary cart-badge" id="cart-count"></span>
 		</a>
 	 </li>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/templates/includes/order/order_macros.html b/erpnext/templates/includes/order/order_macros.html
index da4fb8c..7b3c9a4 100644
--- a/erpnext/templates/includes/order/order_macros.html
+++ b/erpnext/templates/includes/order/order_macros.html
@@ -40,4 +40,4 @@
 			</div>
         </div>
     </div>
-{% endmacro %}
\ No newline at end of file
+{% endmacro %}
diff --git a/erpnext/templates/includes/projects.css b/erpnext/templates/includes/projects.css
index 5a717fc..5d9fc50 100644
--- a/erpnext/templates/includes/projects.css
+++ b/erpnext/templates/includes/projects.css
@@ -86,4 +86,4 @@
 .progress-hg{
 	margin-bottom: 30!important;
 	height:2px;
-}
\ No newline at end of file
+}
diff --git a/erpnext/templates/includes/projects/project_search_box.html b/erpnext/templates/includes/projects/project_search_box.html
index 6f53bae..d746687 100644
--- a/erpnext/templates/includes/projects/project_search_box.html
+++ b/erpnext/templates/includes/projects/project_search_box.html
@@ -27,4 +27,4 @@
 	});
 	$(".form-search").on("submit", function() { return false; });
 });
-</script>
\ No newline at end of file
+</script>
diff --git a/erpnext/templates/includes/salary_slip_log.html b/erpnext/templates/includes/salary_slip_log.html
index 107df51..d36ee6e 100644
--- a/erpnext/templates/includes/salary_slip_log.html
+++ b/erpnext/templates/includes/salary_slip_log.html
@@ -16,4 +16,4 @@
 			</tr>
 		{% endfor %}
 	</tbody>
-</table>
\ No newline at end of file
+</table>
diff --git a/erpnext/templates/includes/topic/topic_row.html b/erpnext/templates/includes/topic/topic_row.html
index 3401bd3..38d46b7 100644
--- a/erpnext/templates/includes/topic/topic_row.html
+++ b/erpnext/templates/includes/topic/topic_row.html
@@ -1,4 +1,4 @@
-<div class="web-list-item">	
+<div class="web-list-item">
 	<div class="row">
 		<a href = "/topics?topic={{ doc.name }}">
 			<div class="col-xs-12">
@@ -6,4 +6,4 @@
 			</div>
 		</a>
 	</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/templates/pages/cart_terms.html b/erpnext/templates/pages/cart_terms.html
index 521c583..6d84fb8 100644
--- a/erpnext/templates/pages/cart_terms.html
+++ b/erpnext/templates/pages/cart_terms.html
@@ -1,2 +1,2 @@
 
-<div>{{doc.terms}}</div>
\ No newline at end of file
+<div>{{doc.terms}}</div>
diff --git a/erpnext/templates/pages/courses.html b/erpnext/templates/pages/courses.html
index 42e7f3e..6592f7a 100644
--- a/erpnext/templates/pages/courses.html
+++ b/erpnext/templates/pages/courses.html
@@ -8,4 +8,4 @@
 
 <p class="post-description"> {{ intro }} </p>
 
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/templates/pages/courses.py b/erpnext/templates/pages/courses.py
index c80d8e7..92c38f6 100644
--- a/erpnext/templates/pages/courses.py
+++ b/erpnext/templates/pages/courses.py
@@ -17,4 +17,3 @@
 	context.doc = course
 	context.sidebar_title = sidebar_title
 	context.intro = course.course_intro
-
diff --git a/erpnext/templates/pages/home.css b/erpnext/templates/pages/home.css
index cf54766..785d805 100644
--- a/erpnext/templates/pages/home.css
+++ b/erpnext/templates/pages/home.css
@@ -6,4 +6,4 @@
 	padding: 10rem 0;
 }
 {% endif %}
-/* csslint ignore:end */
\ No newline at end of file
+/* csslint ignore:end */
diff --git a/erpnext/templates/pages/home.html b/erpnext/templates/pages/home.html
index 2ef9c10..9a61eab 100644
--- a/erpnext/templates/pages/home.html
+++ b/erpnext/templates/pages/home.html
@@ -72,4 +72,4 @@
 		{{ render_homepage_section(section) }}
 	{% endfor %}
 </main>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/templates/pages/integrations/gocardless_checkout.html b/erpnext/templates/pages/integrations/gocardless_checkout.html
index 7193d75..6072db4 100644
--- a/erpnext/templates/pages/integrations/gocardless_checkout.html
+++ b/erpnext/templates/pages/integrations/gocardless_checkout.html
@@ -13,4 +13,4 @@
 	<span class='gocardless-loading'>{{ _("Loading Payment System") }}</span>
 </p>
 
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/templates/pages/integrations/gocardless_checkout.py b/erpnext/templates/pages/integrations/gocardless_checkout.py
index 96a0f42..bdef79c 100644
--- a/erpnext/templates/pages/integrations/gocardless_checkout.py
+++ b/erpnext/templates/pages/integrations/gocardless_checkout.py
@@ -74,4 +74,4 @@
 
 	except Exception as e:
 		frappe.log_error(e, "GoCardless Payment Error")
-		return {"redirect_to": '/integrations/payment-failed'}
\ No newline at end of file
+		return {"redirect_to": '/integrations/payment-failed'}
diff --git a/erpnext/templates/pages/integrations/gocardless_confirmation.html b/erpnext/templates/pages/integrations/gocardless_confirmation.html
index 6ba154a..d961c63 100644
--- a/erpnext/templates/pages/integrations/gocardless_confirmation.html
+++ b/erpnext/templates/pages/integrations/gocardless_confirmation.html
@@ -13,4 +13,4 @@
 	<span class='gocardless-loading'>{{ _("Payment Confirmation") }}</span>
 </p>
 
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/templates/pages/integrations/gocardless_confirmation.py b/erpnext/templates/pages/integrations/gocardless_confirmation.py
index cfaa1a1..0b72e9f 100644
--- a/erpnext/templates/pages/integrations/gocardless_confirmation.py
+++ b/erpnext/templates/pages/integrations/gocardless_confirmation.py
@@ -86,4 +86,4 @@
 			}).insert(ignore_permissions=True)
 
 		except Exception:
-			frappe.log_error(frappe.get_traceback())
\ No newline at end of file
+			frappe.log_error(frappe.get_traceback())
diff --git a/erpnext/templates/pages/material_request_info.html b/erpnext/templates/pages/material_request_info.html
index 0c2772e..151d029 100644
--- a/erpnext/templates/pages/material_request_info.html
+++ b/erpnext/templates/pages/material_request_info.html
@@ -71,4 +71,4 @@
 		{% endfor %}
 	</div>
 </div>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/templates/pages/material_request_info.py b/erpnext/templates/pages/material_request_info.py
index 28e541a..e29860d 100644
--- a/erpnext/templates/pages/material_request_info.py
+++ b/erpnext/templates/pages/material_request_info.py
@@ -19,7 +19,7 @@
 
 	if not frappe.has_website_permission(context.doc):
 		frappe.throw(_("Not Permitted"), frappe.PermissionError)
-	
+
 	default_print_format = frappe.db.get_value('Property Setter', dict(property='default_print_format', doc_type=frappe.form_dict.doctype), "value")
 	if default_print_format:
 		context.print_format = default_print_format
@@ -45,5 +45,5 @@
 		item.delivered_qty = flt(frappe.db.sql("""select sum(transfer_qty)
 						from `tabStock Entry Detail` where material_request = %s
 						and item_code = %s and docstatus = 1""",
-						(material_request, item.item_code))[0][0])				
-	return items
\ No newline at end of file
+						(material_request, item.item_code))[0][0])
+	return items
diff --git a/erpnext/templates/pages/non_profit/join-chapter.html b/erpnext/templates/pages/non_profit/join-chapter.html
index 89a7d2a..4923efc 100644
--- a/erpnext/templates/pages/non_profit/join-chapter.html
+++ b/erpnext/templates/pages/non_profit/join-chapter.html
@@ -56,4 +56,4 @@
 
 {% endif %}
 
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/templates/pages/non_profit/leave-chapter.html b/erpnext/templates/pages/non_profit/leave-chapter.html
index bc4242f..fd7658b 100644
--- a/erpnext/templates/pages/non_profit/leave-chapter.html
+++ b/erpnext/templates/pages/non_profit/leave-chapter.html
@@ -39,4 +39,4 @@
 			});
 		})
 	</script>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/templates/pages/order.py b/erpnext/templates/pages/order.py
index 34985d9..816a259 100644
--- a/erpnext/templates/pages/order.py
+++ b/erpnext/templates/pages/order.py
@@ -32,9 +32,9 @@
 
 	if not frappe.has_website_permission(context.doc):
 		frappe.throw(_("Not Permitted"), frappe.PermissionError)
-	
+
 	# check for the loyalty program of the customer
-	customer_loyalty_program = frappe.db.get_value("Customer", context.doc.customer, "loyalty_program")	
+	customer_loyalty_program = frappe.db.get_value("Customer", context.doc.customer, "loyalty_program")
 	if customer_loyalty_program:
 		from erpnext.accounts.doctype.loyalty_program.loyalty_program import get_loyalty_program_details_with_points
 		loyalty_program_details = get_loyalty_program_details_with_points(context.doc.customer, customer_loyalty_program)
diff --git a/erpnext/templates/pages/product_search.py b/erpnext/templates/pages/product_search.py
index d0d72f0..9ab76de 100644
--- a/erpnext/templates/pages/product_search.py
+++ b/erpnext/templates/pages/product_search.py
@@ -47,4 +47,3 @@
 		set_product_info_for_website(item)
 
 	return [get_item_for_list_in_html(r) for r in data]
-
diff --git a/erpnext/templates/pages/projects.js b/erpnext/templates/pages/projects.js
index 262167f..bd6bcea 100644
--- a/erpnext/templates/pages/projects.js
+++ b/erpnext/templates/pages/projects.js
@@ -117,4 +117,4 @@
 		})
 		return false;
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/templates/pages/task_info.html b/erpnext/templates/pages/task_info.html
index 6cd6a7e..fe4d304 100644
--- a/erpnext/templates/pages/task_info.html
+++ b/erpnext/templates/pages/task_info.html
@@ -147,4 +147,4 @@
 					});
 				</script>
 
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/templates/pages/task_info.py b/erpnext/templates/pages/task_info.py
index b832b88..260e278 100644
--- a/erpnext/templates/pages/task_info.py
+++ b/erpnext/templates/pages/task_info.py
@@ -7,8 +7,8 @@
 	context.no_cache = 1
 
 	task = frappe.get_doc('Task', frappe.form_dict.task)
-	
+
 	context.comments = frappe.get_all('Communication', filters={'reference_name': task.name, 'comment_type': 'comment'},
 	fields=['subject', 'sender_full_name', 'communication_date'])
-	
-	context.doc = task
\ No newline at end of file
+
+	context.doc = task
diff --git a/erpnext/templates/pages/timelog_info.html b/erpnext/templates/pages/timelog_info.html
index 22ea3e4..be13826 100644
--- a/erpnext/templates/pages/timelog_info.html
+++ b/erpnext/templates/pages/timelog_info.html
@@ -45,4 +45,4 @@
 			</div>
 		</div>
 	</div>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/templates/pages/timelog_info.py b/erpnext/templates/pages/timelog_info.py
index 7a3361c..ee86483 100644
--- a/erpnext/templates/pages/timelog_info.py
+++ b/erpnext/templates/pages/timelog_info.py
@@ -7,5 +7,5 @@
 	context.no_cache = 1
 
 	timelog = frappe.get_doc('Time Log', frappe.form_dict.timelog)
-	
-	context.doc = timelog
\ No newline at end of file
+
+	context.doc = timelog
diff --git a/erpnext/templates/print_formats/includes/item_table_qty.html b/erpnext/templates/print_formats/includes/item_table_qty.html
index 8e68f1c..aaa9491 100644
--- a/erpnext/templates/print_formats/includes/item_table_qty.html
+++ b/erpnext/templates/print_formats/includes/item_table_qty.html
@@ -12,4 +12,3 @@
 	{%- endif %}
 	{{ doc.get_formatted("qty", doc) }}
 {%- endif %}
-
diff --git a/erpnext/tests/test_regional.py b/erpnext/tests/test_regional.py
index 282fc64..5b3f45a 100644
--- a/erpnext/tests/test_regional.py
+++ b/erpnext/tests/test_regional.py
@@ -14,4 +14,4 @@
 		self.assertEqual(test_method(), 'original')
 
 		frappe.flags.country = 'France'
-		self.assertEqual(test_method(), 'overridden')
\ No newline at end of file
+		self.assertEqual(test_method(), 'overridden')
diff --git a/erpnext/tests/test_subcontracting.py b/erpnext/tests/test_subcontracting.py
index 8b0ce09..f55137b 100644
--- a/erpnext/tests/test_subcontracting.py
+++ b/erpnext/tests/test_subcontracting.py
@@ -874,4 +874,4 @@
 
 def set_backflush_based_on(based_on):
 	frappe.db.set_value('Buying Settings', None,
-		'backflush_raw_materials_of_subcontract_based_on', based_on)
\ No newline at end of file
+		'backflush_raw_materials_of_subcontract_based_on', based_on)
diff --git a/erpnext/tests/ui/setup_wizard.js b/erpnext/tests/ui/setup_wizard.js
index aeb8d2a..ccff785 100644
--- a/erpnext/tests/ui/setup_wizard.js
+++ b/erpnext/tests/ui/setup_wizard.js
@@ -44,4 +44,4 @@
 	after: browser => {
 		browser.end();
 	},
-};
\ No newline at end of file
+};
diff --git a/erpnext/tests/ui_test_helpers.py b/erpnext/tests/ui_test_helpers.py
index fc3aa29..902fd64 100644
--- a/erpnext/tests/ui_test_helpers.py
+++ b/erpnext/tests/ui_test_helpers.py
@@ -56,4 +56,4 @@
 		frappe.get_doc({
 			'doctype': 'Designation',
 			'designation_name': 'CTO'
-		}).insert()
\ No newline at end of file
+		}).insert()
diff --git a/erpnext/utilities/activation.py b/erpnext/utilities/activation.py
index 50c4b25..0f9f2f8 100644
--- a/erpnext/utilities/activation.py
+++ b/erpnext/utilities/activation.py
@@ -13,33 +13,33 @@
 	min_count = 0
 	doctypes = {
 		"Asset": 5,
-		"BOM": 3, 
-		"Customer": 5, 
+		"BOM": 3,
+		"Customer": 5,
 		"Delivery Note": 5,
-		"Employee": 3, 
-		"Instructor": 5, 
+		"Employee": 3,
+		"Instructor": 5,
 		"Issue": 5,
-		"Item": 5, 
-		"Journal Entry": 3, 
+		"Item": 5,
+		"Journal Entry": 3,
 		"Lead": 3,
 		"Leave Application": 5,
 		"Material Request": 5,
-		"Opportunity": 5, 
-		"Payment Entry": 2, 
+		"Opportunity": 5,
+		"Payment Entry": 2,
 		"Project": 5,
-		"Purchase Order": 2, 
+		"Purchase Order": 2,
 		"Purchase Invoice": 5,
 		"Purchase Receipt": 5,
 		"Quotation": 3,
 		"Salary Slip": 5,
 		"Salary Structure": 5,
-		"Sales Order": 2, 
-		"Sales Invoice": 2, 
+		"Sales Order": 2,
+		"Sales Invoice": 2,
 		"Stock Entry": 3,
-		"Student": 5, 
+		"Student": 5,
 		"Supplier": 5,
 		"Task": 5,
-		"User": 5, 
+		"User": 5,
 		"Work Order": 5
 	}
 
diff --git a/erpnext/utilities/bot.py b/erpnext/utilities/bot.py
index b2e74da..485b0b3 100644
--- a/erpnext/utilities/bot.py
+++ b/erpnext/utilities/bot.py
@@ -36,4 +36,4 @@
 				return "\n\n".join(out)
 
 			else:
-				return _("Did not find any item called {0}").format(item)
\ No newline at end of file
+				return _("Did not find any item called {0}").format(item)
diff --git a/erpnext/utilities/doctype/rename_tool/rename_tool.py b/erpnext/utilities/doctype/rename_tool/rename_tool.py
index 0f8a7a3..5e3ac1a 100644
--- a/erpnext/utilities/doctype/rename_tool/rename_tool.py
+++ b/erpnext/utilities/doctype/rename_tool/rename_tool.py
@@ -29,4 +29,3 @@
 	rows = read_csv_content_from_attached_file(frappe.get_doc("Rename Tool", "Rename Tool"))
 
 	return bulk_rename(select_doctype, rows=rows)
-
diff --git a/erpnext/utilities/doctype/video/video_list.js b/erpnext/utilities/doctype/video/video_list.js
index 8273a4a..6f78f6e 100644
--- a/erpnext/utilities/doctype/video/video_list.js
+++ b/erpnext/utilities/doctype/video/video_list.js
@@ -4,4 +4,4 @@
 			frappe.set_route("Form","Video Settings", "Video Settings");
 		});
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/utilities/doctype/video_settings/video_settings.py b/erpnext/utilities/doctype/video_settings/video_settings.py
index 36fb54f..db021b4 100644
--- a/erpnext/utilities/doctype/video_settings/video_settings.py
+++ b/erpnext/utilities/doctype/video_settings/video_settings.py
@@ -19,4 +19,4 @@
 			except Exception:
 				title = _("Failed to Authenticate the API key.")
 				frappe.log_error(title + "\n\n" +  frappe.get_traceback(), title=title)
-				frappe.throw(title + " Please check the error logs.", title=_("Invalid Credentials"))
\ No newline at end of file
+				frappe.throw(title + " Please check the error logs.", title=_("Invalid Credentials"))
diff --git a/erpnext/utilities/hierarchy_chart.py b/erpnext/utilities/hierarchy_chart.py
index fb58a5d..384d841 100644
--- a/erpnext/utilities/hierarchy_chart.py
+++ b/erpnext/utilities/hierarchy_chart.py
@@ -26,4 +26,4 @@
 			if d.get('expandable'):
 				nodes_to_expand.append({'id': d.get('id'), 'name': d.get('name')})
 
-	return result
\ No newline at end of file
+	return result
diff --git a/erpnext/utilities/report/youtube_interactions/youtube_interactions.py b/erpnext/utilities/report/youtube_interactions/youtube_interactions.py
index 3516a35..29a489d 100644
--- a/erpnext/utilities/report/youtube_interactions/youtube_interactions.py
+++ b/erpnext/utilities/report/youtube_interactions/youtube_interactions.py
@@ -110,4 +110,4 @@
 			"datatype": "Float",
 		}
 	]
-	return chart_data, summary
\ No newline at end of file
+	return chart_data, summary
diff --git a/erpnext/utilities/web_form/addresses/addresses.js b/erpnext/utilities/web_form/addresses/addresses.js
index 699703c..ffc5e98 100644
--- a/erpnext/utilities/web_form/addresses/addresses.js
+++ b/erpnext/utilities/web_form/addresses/addresses.js
@@ -1,3 +1,3 @@
 frappe.ready(function() {
 	// bind events here
-})
\ No newline at end of file
+})
diff --git a/erpnext/www/all-products/index.html b/erpnext/www/all-products/index.html
index 92c76ad..7c18ecc 100644
--- a/erpnext/www/all-products/index.html
+++ b/erpnext/www/all-products/index.html
@@ -164,4 +164,4 @@
 	});
 </script>
 
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/www/all-products/item_row.html b/erpnext/www/all-products/item_row.html
index 20fc9a4..a7e994c 100644
--- a/erpnext/www/all-products/item_row.html
+++ b/erpnext/www/all-products/item_row.html
@@ -4,4 +4,3 @@
 	item.item_name or item.name, item.website_image or item.image, item.route, item.website_description or item.description,
 	item.formatted_price, item.item_group
 ) }}
-
diff --git a/erpnext/www/all-products/not_found.html b/erpnext/www/all-products/not_found.html
index e1986b4..91989a9 100644
--- a/erpnext/www/all-products/not_found.html
+++ b/erpnext/www/all-products/not_found.html
@@ -1 +1 @@
-<div class="d-flex justify-content-center p-3 text-muted">{{ _('No products found') }}</div>
\ No newline at end of file
+<div class="d-flex justify-content-center p-3 text-muted">{{ _('No products found') }}</div>
diff --git a/erpnext/www/book_appointment/index.css b/erpnext/www/book_appointment/index.css
index 6c49fde..2776108 100644
--- a/erpnext/www/book_appointment/index.css
+++ b/erpnext/www/book_appointment/index.css
@@ -12,7 +12,7 @@
 @media (max-width: 768px) {
     #submit-button-area {
         display: grid;
-        grid-template-areas: 
+        grid-template-areas:
         "submit"
         "back";
     }
diff --git a/erpnext/www/book_appointment/index.html b/erpnext/www/book_appointment/index.html
index f242f43..207175f 100644
--- a/erpnext/www/book_appointment/index.html
+++ b/erpnext/www/book_appointment/index.html
@@ -63,4 +63,4 @@
 </div>
 </div>
 
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/www/book_appointment/verify/index.html b/erpnext/www/book_appointment/verify/index.html
index ebb65b1..9bcd3d2 100644
--- a/erpnext/www/book_appointment/verify/index.html
+++ b/erpnext/www/book_appointment/verify/index.html
@@ -3,7 +3,7 @@
 {% block title %}
 {{ _("Verify Email") }}
 {% endblock%}
-    
+
 {% block page_content %}
 
     {% if success==True %}
@@ -15,4 +15,4 @@
             Verification failed please check the link
         </div>
     {% endif %}
-{% endblock%}
\ No newline at end of file
+{% endblock%}
diff --git a/erpnext/www/book_appointment/verify/index.py b/erpnext/www/book_appointment/verify/index.py
index d4478ae..bd766c0 100644
--- a/erpnext/www/book_appointment/verify/index.py
+++ b/erpnext/www/book_appointment/verify/index.py
@@ -17,4 +17,4 @@
 		return context
 	else:
 		context.success = False
-		return context
\ No newline at end of file
+		return context
diff --git a/erpnext/www/lms/content.py b/erpnext/www/lms/content.py
index 0c04845..05cbb16 100644
--- a/erpnext/www/lms/content.py
+++ b/erpnext/www/lms/content.py
@@ -65,4 +65,4 @@
 			and `tabTopic Content`.parent = `tabCourse Topic`.topic
 			and `tabProgram Course`.parent = %(program)s""", {'program': program})
 
-	return (content, content_type) in contents_of_program
\ No newline at end of file
+	return (content, content_type) in contents_of_program
diff --git a/erpnext/www/lms/course.html b/erpnext/www/lms/course.html
index 0d70ed5..c07b940 100644
--- a/erpnext/www/lms/course.html
+++ b/erpnext/www/lms/course.html
@@ -103,4 +103,4 @@
 		</div>
 	</div>
 </section>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/www/lms/index.py b/erpnext/www/lms/index.py
index 26f59a2..c14b943 100644
--- a/erpnext/www/lms/index.py
+++ b/erpnext/www/lms/index.py
@@ -13,4 +13,4 @@
 
 
 def get_featured_programs():
-	return utils.get_portal_programs() or []
\ No newline at end of file
+	return utils.get_portal_programs() or []
diff --git a/erpnext/www/lms/macros/card.html b/erpnext/www/lms/macros/card.html
index dc8fc5c..3cbdec6 100644
--- a/erpnext/www/lms/macros/card.html
+++ b/erpnext/www/lms/macros/card.html
@@ -31,4 +31,4 @@
 	<div class="h-100 d-none d-sm-block" style="border: 1px solid rgba(209,216,221,0.5);border-radius: 0.25rem;background-color: rgb(250, 251, 252);">
 	</div>
 </div>
-{% endmacro %}
\ No newline at end of file
+{% endmacro %}
diff --git a/erpnext/www/lms/macros/hero.html b/erpnext/www/lms/macros/hero.html
index 94f239e..e72bfc8 100644
--- a/erpnext/www/lms/macros/hero.html
+++ b/erpnext/www/lms/macros/hero.html
@@ -52,4 +52,4 @@
 	}
 </script>
 {% endblock %}
-{% endmacro %}
\ No newline at end of file
+{% endmacro %}
diff --git a/erpnext/www/lms/profile.py b/erpnext/www/lms/profile.py
index 4788ea6..7e338e3 100644
--- a/erpnext/www/lms/profile.py
+++ b/erpnext/www/lms/profile.py
@@ -23,4 +23,4 @@
 		completion = utils.get_program_completion(program)
 		student_progress.append({'program': program.program_name, 'name': program.name, 'progress':progress, 'completion': completion})
 
-	return student_progress
\ No newline at end of file
+	return student_progress
diff --git a/erpnext/www/lms/program.html b/erpnext/www/lms/program.html
index 7ad6186..30528c6 100644
--- a/erpnext/www/lms/program.html
+++ b/erpnext/www/lms/program.html
@@ -84,4 +84,4 @@
 		</div>
 	</div>
 </section>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/www/lms/program.py b/erpnext/www/lms/program.py
index 104d3fa..a4f588c 100644
--- a/erpnext/www/lms/program.py
+++ b/erpnext/www/lms/program.py
@@ -26,4 +26,4 @@
 
 def get_course_progress(courses, program):
 	progress = {course.name: utils.get_course_progress(course, program) for course in courses}
-	return progress or {}
\ No newline at end of file
+	return progress or {}
diff --git a/erpnext/www/lms/topic.html b/erpnext/www/lms/topic.html
index cd24616..dc69599 100644
--- a/erpnext/www/lms/topic.html
+++ b/erpnext/www/lms/topic.html
@@ -55,4 +55,4 @@
 		</div>
 	</div>
 </section>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/www/lms/topic.py b/erpnext/www/lms/topic.py
index 8abbc72..9938280 100644
--- a/erpnext/www/lms/topic.py
+++ b/erpnext/www/lms/topic.py
@@ -42,4 +42,4 @@
 					result = None
 				progress.append({'content': content, 'content_type': content.doctype, 'completed': status, 'score': score, 'result': result})
 
-	return progress
\ No newline at end of file
+	return progress
diff --git a/erpnext/www/support/index.html b/erpnext/www/support/index.html
index 12b4c2c..3c19198 100644
--- a/erpnext/www/support/index.html
+++ b/erpnext/www/support/index.html
@@ -96,6 +96,6 @@
 	.search-container {
 		margin-top: 1.2rem;
 		max-width: 500px;
-	}	
+	}
 </style>
 {%- endblock -%}
diff --git a/erpnext/www/support/index.py b/erpnext/www/support/index.py
index 5d26743..70090c7 100644
--- a/erpnext/www/support/index.py
+++ b/erpnext/www/support/index.py
@@ -8,7 +8,7 @@
 
 	context.greeting_title = setting.greeting_title
 	context.greeting_subtitle = setting.greeting_subtitle
-	
+
 	# Support content
 	favorite_articles = get_favorite_articles_by_page_view()
 	if len(favorite_articles) < 6:
@@ -16,15 +16,15 @@
 		if favorite_articles:
 			for article in favorite_articles:
 				name_list.append(article.name)
-		for record in (frappe.get_all("Help Article", 
-			fields=["title", "content", "route", "category"], 
-			filters={"name": ['not in', tuple(name_list)], "published": 1}, 
+		for record in (frappe.get_all("Help Article",
+			fields=["title", "content", "route", "category"],
+			filters={"name": ['not in', tuple(name_list)], "published": 1},
 			order_by="creation desc", limit=(6-len(favorite_articles)))):
 			favorite_articles.append(record)
-		
+
 	context.favorite_article_list = get_favorite_articles(favorite_articles)
 	context.help_article_list = get_help_article_list()
-	
+
 def get_favorite_articles_by_page_view():
 	return frappe.db.sql(
 			"""
@@ -34,13 +34,13 @@
 				t1.content as content,
 				t1.route as route,
 				t1.category as category,
-				count(t1.route) as count 
-			FROM `tabHelp Article` AS t1 
+				count(t1.route) as count
+			FROM `tabHelp Article` AS t1
 				INNER JOIN
-				`tabWeb Page View` AS t2 
-			ON t1.route = t2.path 
+				`tabWeb Page View` AS t2
+			ON t1.route = t2.path
 			WHERE t1.published = 1
-			GROUP BY route 
+			GROUP BY route
 			ORDER BY count DESC
 			LIMIT 6;
 			""", as_dict=True)
@@ -71,4 +71,4 @@
 				'articles': help_articles,
 			}
 			help_article_list.append(help_aricles_per_caetgory)
-	return help_article_list
\ No newline at end of file
+	return help_article_list