Merge pull request #20962 from marination/pick-list-enhance

fix: Pick List Enhancements
diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js
index efac1af..f62d076 100644
--- a/erpnext/accounts/doctype/account/account_tree.js
+++ b/erpnext/accounts/doctype/account/account_tree.js
@@ -1,7 +1,7 @@
 frappe.provide("frappe.treeview_settings")
 
 frappe.treeview_settings["Account"] = {
-	breadcrumbs: "Accounts",
+	breadcrumb: "Accounts",
 	title: __("Chart Of Accounts"),
 	get_tree_root: false,
 	filters: [
diff --git a/erpnext/accounts/doctype/cost_center/cost_center_tree.js b/erpnext/accounts/doctype/cost_center/cost_center_tree.js
index 16d9734..fde4123 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center_tree.js
+++ b/erpnext/accounts/doctype/cost_center/cost_center_tree.js
@@ -1,5 +1,5 @@
 frappe.treeview_settings["Cost Center"] = {
-	breadcrumbs: "Accounts",
+	breadcrumb: "Accounts",
 	get_tree_root: false,
 	filters: [{
 		fieldname: "company",
diff --git a/erpnext/accounts/doctype/payment_order/payment_order.js b/erpnext/accounts/doctype/payment_order/payment_order.js
index d6d4946..d12e474 100644
--- a/erpnext/accounts/doctype/payment_order/payment_order.js
+++ b/erpnext/accounts/doctype/payment_order/payment_order.js
@@ -15,11 +15,11 @@
 		if (frm.doc.docstatus == 0) {
 			frm.add_custom_button(__('Payment Request'), function() {
 				frm.trigger("get_from_payment_request");
-			}, __("Get from"));
+			}, __("Get Payments from"));
 
 			frm.add_custom_button(__('Payment Entry'), function() {
 				frm.trigger("get_from_payment_entry");
-			}, __("Get from"));
+			}, __("Get Payments from"));
 
 			frm.trigger('remove_button');
 		}
diff --git a/erpnext/accounts/doctype/payment_order/payment_order.json b/erpnext/accounts/doctype/payment_order/payment_order.json
index 2e12ad3..2ed0a4a 100644
--- a/erpnext/accounts/doctype/payment_order/payment_order.json
+++ b/erpnext/accounts/doctype/payment_order/payment_order.json
@@ -59,7 +59,6 @@
    "fieldtype": "Section Break"
   },
   {
-   "allow_bulk_edit": 1,
    "fieldname": "references",
    "fieldtype": "Table",
    "label": "Payment Order Reference",
@@ -108,7 +107,7 @@
   }
  ],
  "is_submittable": 1,
- "modified": "2019-05-14 17:12:24.912666",
+ "modified": "2020-04-06 18:00:56.022642",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Payment Order",
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 76eb56f..5a3ec4e 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -439,7 +439,7 @@
 
 		if account_currency not in valid_currency:
 			frappe.throw(_("Account {0} is invalid. Account Currency must be {1}")
-						 .format(account, _(" or ").join(valid_currency)))
+				.format(account, (' ' + _("or") + ' ').join(valid_currency)))
 
 	def clear_unallocated_advances(self, childtype, parentfield):
 		self.set(parentfield, self.get(parentfield, {"allocated_amount": ["not in", [0, None, ""]]}))
diff --git a/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py b/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py
index c2ac0d7..5bebd43 100644
--- a/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py
+++ b/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py
@@ -14,7 +14,7 @@
 	student_batch_name = filters.get("student_batch_name")
 
 	columns = get_columns()
-	
+
 	program_enrollments = frappe.get_list("Program Enrollment", fields=["student", "student_name"],
 		filters={"academic_year": academic_year, "program": program, "student_batch_name": student_batch_name})
 
@@ -46,9 +46,9 @@
 
 def get_columns():
 	columns = [
-		_(" Group Roll No") + "::60",  
-		_("Student ID") + ":Link/Student:90", 
-		_("Student Name") + "::150", 
+		_("Group Roll No") + "::60",
+		_("Student ID") + ":Link/Student:90",
+		_("Student Name") + "::150",
 		_("Student Mobile No.") + "::110",
 		_("Student Email ID") + "::125",
 		_("Student Address") + "::175",
@@ -84,10 +84,10 @@
 
 	guardian_list = list(set([g.guardian for g in guardian_details])) or ['']
 
-	guardian_mobile_no = dict(frappe.db.sql("""select name, mobile_number from `tabGuardian` 
+	guardian_mobile_no = dict(frappe.db.sql("""select name, mobile_number from `tabGuardian`
 			where name in (%s)""" % ", ".join(['%s']*len(guardian_list)), tuple(guardian_list)))
 
-	guardian_email_id = dict(frappe.db.sql("""select name, email_address from `tabGuardian` 
+	guardian_email_id = dict(frappe.db.sql("""select name, email_address from `tabGuardian`
 			where name in (%s)""" % ", ".join(['%s']*len(guardian_list)), tuple(guardian_list)))
 
 	for guardian in guardian_details:
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index f78e17f..afd52de 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -687,8 +687,7 @@
 			"to_date": d.to_date,
 			"docstatus": d.docstatus,
 			"color": d.color,
-			"title": cstr(d.employee_name) + \
-				(d.half_day and _(" (Half Day)") or ""),
+			"title": cstr(d.employee_name) + (' ' + _('(Half Day)') if d.half_day else ''),
 		}
 		if e not in events:
 			events.append(e)
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index d03a3dd..c637215 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -356,13 +356,13 @@
 
 	def eval_condition_and_formula(self, d, data):
 		try:
-			condition = d.condition.strip() if d.condition else None
+			condition = d.condition.strip().replace("\n", " ") if d.condition else None
 			if condition:
 				if not frappe.safe_eval(condition, self.whitelisted_globals, data):
 					return None
 			amount = d.amount
 			if d.amount_based_on_formula:
-				formula = d.formula.strip() if d.formula else None
+				formula = d.formula.strip().replace("\n", " ") if d.formula else None
 				if formula:
 					amount = flt(frappe.safe_eval(formula, self.whitelisted_globals, data), d.precision("amount"))
 			if amount:
diff --git a/erpnext/patches/v10_0/update_address_template_for_india.py b/erpnext/patches/v10_0/update_address_template_for_india.py
index 145ed45..1ddca93 100644
--- a/erpnext/patches/v10_0/update_address_template_for_india.py
+++ b/erpnext/patches/v10_0/update_address_template_for_india.py
@@ -3,10 +3,10 @@
 
 from __future__ import unicode_literals
 import frappe
-from erpnext.regional.india.setup import update_address_template
+from erpnext.regional.address_template.setup import set_up_address_templates
 
 def execute():
 	if frappe.db.get_value('Company',  {'country': 'India'},  'name'):
 		address_template = frappe.db.get_value('Address Template', 'India', 'template')
 		if not address_template or "gstin" not in address_template:
-			update_address_template()
+			set_up_address_templates(default_country='India')
diff --git a/erpnext/patches/v12_0/set_task_status.py b/erpnext/patches/v12_0/set_task_status.py
index 70f6509..dbd7e5a 100644
--- a/erpnext/patches/v12_0/set_task_status.py
+++ b/erpnext/patches/v12_0/set_task_status.py
@@ -1,16 +1,15 @@
 import frappe
 
 def execute():
-    frappe.reload_doctype('Task')
+	frappe.reload_doctype('Task')
 
-    # add "Completed" if customized
-    for doctype in ('Task'):
-        property_setter_name = frappe.db.exists('Property Setter', dict(doc_type = doctype, field_name = 'status', property = 'options'))
-        if property_setter_name:
-            property_setter = frappe.get_doc('Property Setter', property_setter_name)
-            if not "Completed" in property_setter.value:
-                property_setter.value = property_setter.value + '\nCompleted'
-                property_setter.save()
+	# add "Completed" if customized
+	property_setter_name = frappe.db.exists('Property Setter', dict(doc_type='Task', field_name = 'status', property = 'options'))
+	if property_setter_name:
+		property_setter = frappe.get_doc('Property Setter', property_setter_name)
+		if not "Completed" in property_setter.value:
+			property_setter.value = property_setter.value + '\nCompleted'
+			property_setter.save()
 
-    # renamed default status to Completed as status "Closed" is ambiguous
-    frappe.db.sql('update tabTask set status = "Completed" where status = "Closed"')
\ No newline at end of file
+	# renamed default status to Completed as status "Closed" is ambiguous
+	frappe.db.sql('update tabTask set status = "Completed" where status = "Closed"')
diff --git a/erpnext/patches/v8_1/gst_fixes.py b/erpnext/patches/v8_1/gst_fixes.py
index 22fa53b..34255eb 100644
--- a/erpnext/patches/v8_1/gst_fixes.py
+++ b/erpnext/patches/v8_1/gst_fixes.py
@@ -1,7 +1,8 @@
 from __future__ import unicode_literals
 import frappe
 from frappe.custom.doctype.custom_field.custom_field import create_custom_field
-from erpnext.regional.india.setup import update_address_template
+from erpnext.regional.address_template.setup import set_up_address_templates
+
 
 def execute():
 	company = frappe.get_all('Company', filters = {'country': 'India'})
@@ -10,9 +11,10 @@
 
 	update_existing_custom_fields()
 	add_custom_fields()
-	update_address_template()
+	set_up_address_templates(default_country='India')
 	frappe.reload_doc("regional", "print_format", "gst_tax_invoice")
 
+
 def update_existing_custom_fields():
 	frappe.db.sql("""update `tabCustom Field` set label = 'HSN/SAC'
 		where fieldname='gst_hsn_code' and label='GST HSN Code'
@@ -34,6 +36,7 @@
 		where fieldname='gst_hsn_code' and dt in ('Sales Invoice Item', 'Purchase Invoice Item')
 	""")
 
+
 def add_custom_fields():
 	hsn_sac_field = dict(fieldname='gst_hsn_code', label='HSN/SAC',
 		fieldtype='Data', options='item_code.gst_hsn_code', insert_after='description')
diff --git a/erpnext/projects/report/billing_summary.py b/erpnext/projects/report/billing_summary.py
index 76379f1..b808268 100644
--- a/erpnext/projects/report/billing_summary.py
+++ b/erpnext/projects/report/billing_summary.py
@@ -53,7 +53,7 @@
 def get_data(filters):
 	data = []
 	if(filters.from_date > filters.to_date):
-		frappe.msgprint(_(" From Date can not be greater than To Date"))
+		frappe.msgprint(_("From Date can not be greater than To Date"))
 		return data
 
 	timesheets = get_timesheets(filters)
diff --git a/erpnext/public/js/conf.js b/erpnext/public/js/conf.js
index 615f6a4..9870f81 100644
--- a/erpnext/public/js/conf.js
+++ b/erpnext/public/js/conf.js
@@ -43,7 +43,6 @@
 $.extend(frappe.breadcrumbs.module_map, {
 	'ERPNext Integrations': 'Integrations',
 	'Geo': 'Settings',
-	'Accounts': 'Accounting',
 	'Portal': 'Website',
 	'Utilities': 'Settings',
 	'Shopping Cart': 'Website',
diff --git a/erpnext/regional/address_template/README.md b/erpnext/regional/address_template/README.md
new file mode 100644
index 0000000..9915734
--- /dev/null
+++ b/erpnext/regional/address_template/README.md
@@ -0,0 +1,18 @@
+To add an **Address Template** for your country, place a new file in this directory:
+
+  * File name: `your_country.html` (lower case with underscores)
+  * File content: a [Jinja Template](http://jinja.pocoo.org/docs/templates/).
+
+All the fields of **Address** (including Custom Fields, if any) will be available to the template. Example:
+
+```jinja
+{{ address_line1 }}<br>
+{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}
+{{ city }}<br>
+{% if state %}{{ state }}<br>{% endif -%}
+{% if pincode %} PIN:  {{ pincode }}<br>{% endif -%}
+{{ country }}<br>
+{% if phone %}Phone: {{ phone }}<br>{% endif -%}
+{% if fax %}Fax: {{ fax }}<br>{% endif -%}
+{% if email_id %}Email: {{ email_id }}<br>{% endif -%}
+```
diff --git a/erpnext/regional/address_template/__init__.py b/erpnext/regional/address_template/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/regional/address_template/__init__.py
diff --git a/erpnext/regional/address_template/setup.py b/erpnext/regional/address_template/setup.py
new file mode 100644
index 0000000..9f318de
--- /dev/null
+++ b/erpnext/regional/address_template/setup.py
@@ -0,0 +1,53 @@
+"""Import Address Templates from ./templates directory."""
+import os
+import frappe
+
+def set_up_address_templates(default_country=None):
+	for country, html in get_address_templates():
+		is_default = 1 if country == default_country else 0
+		update_address_template(country, html, is_default)
+
+def get_address_templates():
+	"""
+	Return country and path for all HTML files in this directory.
+	
+	Returns a list of dicts.
+	"""
+	def country(file_name):
+		"""Convert 'united_states.html' to 'United States'."""
+		suffix_pos = file_name.find(".html")
+		country_snake_case = file_name[:suffix_pos]
+		country_title_case = " ".join(country_snake_case.split("_")).title()
+		return country_title_case
+
+	def get_file_content(file_name):
+		"""Convert 'united_states.html' to '/path/to/united_states.html'."""
+		full_path = os.path.join(template_dir, file_name)
+		with open(full_path, "r") as f:
+			content = f.read()
+		return content
+
+	dir_name = os.path.dirname(__file__)
+	template_dir = os.path.join(dir_name, "templates")
+	file_names = os.listdir(template_dir)
+	html_files = [file for file in file_names if file.endswith(".html")]
+
+	return [(country(file_name), get_file_content(file_name)) for file_name in html_files]
+
+
+def update_address_template(country, html, is_default=0):
+	"""Update existing Address Template or create a new one."""
+	if not frappe.db.exists("Country", country):
+		frappe.log_error("Country {} for regional Address Template does not exist.".format(country))
+		return
+
+	if frappe.db.exists("Address Template", country):
+		frappe.db.set_value("Address Template", country, "template", html)
+		frappe.db.set_value("Address Template", country, "is_default", is_default)
+	else:
+		frappe.get_doc(dict(
+			doctype="Address Template",
+			country=country,
+			is_default=is_default,
+			template=html
+		)).insert()
diff --git a/erpnext/regional/germany/address_template.html b/erpnext/regional/address_template/templates/germany.html
similarity index 100%
rename from erpnext/regional/germany/address_template.html
rename to erpnext/regional/address_template/templates/germany.html
diff --git a/erpnext/regional/india/address_template.html b/erpnext/regional/address_template/templates/india.html
similarity index 99%
rename from erpnext/regional/india/address_template.html
rename to erpnext/regional/address_template/templates/india.html
index 55cc9af..ffb9d05 100644
--- a/erpnext/regional/india/address_template.html
+++ b/erpnext/regional/address_template/templates/india.html
@@ -6,4 +6,4 @@
 {% if phone %}Phone: {{ phone }}<br>{% endif -%}
 {% if fax %}Fax: {{ fax }}<br>{% endif -%}
 {% if email_id %}Email: {{ email_id }}<br>{% endif -%}
-{% if gstin %}GSTIN: {{ gstin }}<br>{% endif -%}
\ No newline at end of file
+{% if gstin %}GSTIN: {{ gstin }}<br>{% endif -%}
diff --git a/erpnext/regional/united_states/address_template.html b/erpnext/regional/address_template/templates/united_states.html
similarity index 100%
rename from erpnext/regional/united_states/address_template.html
rename to erpnext/regional/address_template/templates/united_states.html
diff --git a/erpnext/regional/address_template/test_regional_address_template.py b/erpnext/regional/address_template/test_regional_address_template.py
new file mode 100644
index 0000000..8a05ea2
--- /dev/null
+++ b/erpnext/regional/address_template/test_regional_address_template.py
@@ -0,0 +1,45 @@
+from __future__ import unicode_literals
+from unittest import TestCase
+
+import frappe
+from erpnext.regional.address_template.setup import get_address_templates
+from erpnext.regional.address_template.setup import update_address_template
+
+def ensure_country(country):
+	if frappe.db.exists("Country", country):
+		return frappe.get_doc("Country", country)
+	else:
+		c = frappe.get_doc({
+			"doctype": "Country",
+			"country_name": country
+		})
+		c.insert()
+		return c
+
+class TestRegionalAddressTemplate(TestCase):
+	def test_get_address_templates(self):
+		"""Get the countries and paths from the templates directory."""
+		templates = get_address_templates()
+		self.assertIsInstance(templates, list)
+		self.assertIsInstance(templates[0], tuple)
+
+	def test_create_address_template(self):
+		"""Create a new Address Template."""
+		country = ensure_country("Germany")
+		update_address_template(country.name, "TEST")
+		doc = frappe.get_doc("Address Template", country.name)
+		self.assertEqual(doc.template, "TEST")
+
+	def test_update_address_template(self):
+		"""Update an existing Address Template."""
+		country = ensure_country("Germany")
+		if not frappe.db.exists("Address Template", country.name):
+			template = frappe.get_doc({
+				"doctype": "Address Template",
+				"country": country.name,
+				"template": "EXISTING"
+			}).insert()
+
+		update_address_template(country.name, "NEW")
+		doc = frappe.get_doc("Address Template", country.name)
+		self.assertEqual(doc.template, "NEW")
diff --git a/erpnext/regional/germany/setup.py b/erpnext/regional/germany/setup.py
index a547136..d6047e8 100644
--- a/erpnext/regional/germany/setup.py
+++ b/erpnext/regional/germany/setup.py
@@ -3,29 +3,4 @@
 
 
 def setup(company=None, patch=True):
-	if not patch:
-		update_address_template()
-
-
-def update_address_template():
-	"""
-	Read address template from file. Update existing Address Template or create a
-	new one.
-	"""
-	dir_name = os.path.dirname(__file__)
-	template_path = os.path.join(dir_name, 'address_template.html')
-
-	with open(template_path, 'r') as template_file:
-		template_html = template_file.read()
-
-	address_template = frappe.db.get_value('Address Template', 'Germany')
-
-	if address_template:
-		frappe.db.set_value('Address Template', 'Germany', 'template', template_html)
-	else:
-		# make new html template for Germany
-		frappe.get_doc(dict(
-			doctype='Address Template',
-			country='Germany',
-			template=template_html
-		)).insert()
+	pass
diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py
index 75f29b8..28b1f8f 100644
--- a/erpnext/regional/india/setup.py
+++ b/erpnext/regional/india/setup.py
@@ -13,7 +13,6 @@
 def setup(company=None, patch=True):
 	setup_company_independent_fixtures()
 	if not patch:
-		update_address_template()
 		make_fixtures(company)
 
 # TODO: for all countries
@@ -24,21 +23,6 @@
 	frappe.enqueue('erpnext.regional.india.setup.add_hsn_sac_codes', now=frappe.flags.in_test)
 	add_print_formats()
 
-def update_address_template():
-	with open(os.path.join(os.path.dirname(__file__), 'address_template.html'), 'r') as f:
-		html = f.read()
-
-	address_template = frappe.db.get_value('Address Template', 'India')
-	if address_template:
-		frappe.db.set_value('Address Template', 'India', 'template', html)
-	else:
-		# make new html template for India
-		frappe.get_doc(dict(
-			doctype='Address Template',
-			country='India',
-			template=html
-		)).insert()
-
 def add_hsn_sac_codes():
 	# HSN codes
 	with open(os.path.join(os.path.dirname(__file__), 'hsn_code_data.json'), 'r') as f:
diff --git a/erpnext/regional/report/datev/datev.py b/erpnext/regional/report/datev/datev.py
index a657912..a8e40cc 100644
--- a/erpnext/regional/report/datev/datev.py
+++ b/erpnext/regional/report/datev/datev.py
@@ -13,6 +13,7 @@
 import zlib
 import zipfile
 import six
+from csv import QUOTE_NONNUMERIC
 from six import BytesIO
 from six import string_types
 import frappe
@@ -80,7 +81,7 @@
 			
 			gl.posting_date as 'Belegdatum',
 			gl.voucher_no as 'Belegfeld 1',
-			gl.remarks as 'Buchungstext',
+			LEFT(gl.remarks, 60) as 'Buchungstext',
 			gl.voucher_type as 'Beleginfo - Art 1',
 			gl.voucher_no as 'Beleginfo - Inhalt 1',
 			gl.against_voucher_type as 'Beleginfo - Art 2',
@@ -268,7 +269,9 @@
 		# Do not number rows
 		index=False,
 		# Use all columns defined above
-		columns=csv_class.COLUMNS
+		columns=csv_class.COLUMNS,
+		# Quote most fields, even currency values with "," separator
+		quoting=QUOTE_NONNUMERIC
 	)
 
 	if not six.PY2:
@@ -285,6 +288,7 @@
 
 def get_header(filters, csv_class):
 	coa = frappe.get_value("Company", filters.get("company"), "chart_of_accounts")
+	description = filters.get("voucher_type", csv_class.FORMAT_NAME)
 	coa_used = "04" if "SKR04" in coa else ("03" if "SKR03" in coa else "")
 
 	header = [
@@ -323,12 +327,8 @@
 		frappe.utils.formatdate(filters.get('from_date'), "yyyyMMdd"),
 		# P = Transaction batch end date (YYYYMMDD)
 		frappe.utils.formatdate(filters.get('to_date'), "yyyyMMdd"),
-		# Q = Description (for example, "January - February 2019 Transactions")
-		'"{} - {} {}"'.format(
-				frappe.utils.formatdate(filters.get('from_date'), "MMMM yyyy"),
-				frappe.utils.formatdate(filters.get('to_date'), "MMMM yyyy"),
-				csv_class.FORMAT_NAME
-		),
+		# Q = Description (for example, "Sales Invoice") Max. 30 chars
+		'"{}"'.format(_(description)),
 		# R = Diktatkürzel
 		'',
 		# S = Buchungstyp
diff --git a/erpnext/regional/united_states/setup.py b/erpnext/regional/united_states/setup.py
index cb82b63..6d34402 100644
--- a/erpnext/regional/united_states/setup.py
+++ b/erpnext/regional/united_states/setup.py
@@ -5,12 +5,9 @@
 import frappe
 from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
 
-
 def setup(company=None, patch=True):
 	make_custom_fields()
 	add_print_formats()
-	update_address_template()
-
 
 def make_custom_fields():
 	custom_fields = {
@@ -21,22 +18,7 @@
 	}
 	create_custom_fields(custom_fields)
 
-
 def add_print_formats():
 	frappe.reload_doc("regional", "print_format", "irs_1099_form")
 	frappe.db.sql(""" update `tabPrint Format` set disabled = 0 where
 		name in('IRS 1099 Form') """)
-
-
-def update_address_template():
-	html = """{{ address_line1 }}<br>
-		{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}
-		{{ city }}, {% if state %}{{ state }}{% endif -%}{% if pincode %} {{ pincode }}<br>{% endif -%}
-		{% if country != "United States" %}{{ country|upper }}{% endif -%}
-		"""
-
-	address_template = frappe.db.get_value('Address Template', 'United States')
-	if address_template:
-		frappe.db.set_value('Address Template', 'United States', 'template', html)
-	else:
-		frappe.get_doc(dict(doctype='Address Template', country='United States', template=html)).insert()
diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py
index ebd7b50..e4986e3 100644
--- a/erpnext/setup/setup_wizard/operations/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py
@@ -8,9 +8,11 @@
 from frappe import _
 from frappe.desk.page.setup_wizard.setup_wizard import make_records
 from frappe.utils import cstr, getdate
-from erpnext.accounts.doctype.account.account import RootNotEditable
 from frappe.desk.doctype.global_search_settings.global_search_settings import update_global_search_doctypes
 
+from erpnext.accounts.doctype.account.account import RootNotEditable
+from erpnext.regional.address_template.setup import set_up_address_templates
+
 default_lead_sources = ["Existing Customer", "Reference", "Advertisement",
 	"Cold Calling", "Exhibition", "Supplier Reference", "Mass Mailing",
 	"Customer's Vendor", "Campaign", "Walk In"]
@@ -30,7 +32,7 @@
 		{ 'doctype': 'Domain', 'domain': 'Agriculture'},
 		{ 'doctype': 'Domain', 'domain': 'Non Profit'},
 
-		# address template
+		# ensure at least an empty Address Template exists for this Country	
 		{'doctype':"Address Template", "country": country},
 
 		# item group
@@ -269,12 +271,11 @@
 
 	# Records for the Supplier Scorecard
 	from erpnext.buying.doctype.supplier_scorecard.supplier_scorecard import make_default_records
+	
 	make_default_records()
-
 	make_records(records)
-
+	set_up_address_templates(default_country=country)
 	set_more_defaults()
-
 	update_global_search_doctypes()
 
 	# path = frappe.get_app_path('erpnext', 'regional', frappe.scrub(country))
diff --git a/erpnext/stock/dashboard/item_dashboard.js b/erpnext/stock/dashboard/item_dashboard.js
index 1bfa2cf..9bd03d4 100644
--- a/erpnext/stock/dashboard/item_dashboard.js
+++ b/erpnext/stock/dashboard/item_dashboard.js
@@ -108,8 +108,8 @@
 		if (context.data.length > 0) {
 			$(frappe.render_template('item_dashboard_list', context)).appendTo(this.result);
 		} else {
-			var message = __(" Currently no stock available in any warehouse")
-			$("<span class='text-muted small'>"+message+"</span>").appendTo(this.result);
+			var message = __("Currently no stock available in any warehouse");
+			$(`<span class='text-muted small'>  ${message} </span>`).appendTo(this.result);
 		}
 	},
 	get_item_dashboard_data: function(data, max_count, show_item) {
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 7d31942..c62b3ab 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -308,7 +308,7 @@
 		if self.retain_sample and not frappe.db.get_single_value('Stock Settings', 'sample_retention_warehouse'):
 			frappe.throw(_("Please select Sample Retention Warehouse in Stock Settings first"))
 		if self.retain_sample and not self.has_batch_no:
-			frappe.throw(_(" {0} Retain Sample is based on batch, please check Has Batch No to retain sample of item").format(
+			frappe.throw(_("{0} Retain Sample is based on batch, please check Has Batch No to retain sample of item").format(
 				self.item_code))
 
 	def get_context(self, context):