Merge pull request #15349 from sagarvora/py3-fixes

[py3] print, StringIO import, and other fixes
diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.json b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.json
index 771d1f2..607ca4f 100644
--- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.json
+++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.json
@@ -864,7 +864,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "default": "1", 
+   "default": "", 
    "description": "Check this to enable a scheduled Daily synchronization routine via scheduler", 
    "fieldname": "enable_synch", 
    "fieldtype": "Check", 
@@ -935,7 +935,7 @@
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-08-23 20:52:58.471424", 
+ "modified": "2018-09-07 16:45:44.439834", 
  "modified_by": "Administrator", 
  "module": "ERPNext Integrations", 
  "name": "Amazon MWS Settings", 
diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py
index 7f1ee9c..249a73f 100644
--- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py
+++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py
@@ -12,7 +12,10 @@
 class AmazonMWSSettings(Document):
 	def validate(self):
 		if self.enable_amazon == 1:
+			self.enable_synch = 1
 			setup_custom_fields()
+		else:
+			self.enable_synch = 0
 
 	def get_products_details(self):
 		if self.enable_amazon == 1:
@@ -25,7 +28,7 @@
 
 def schedule_get_order_details():
 	mws_settings = frappe.get_doc("Amazon MWS Settings")
-	if mws_settings.enable_synch:
+	if mws_settings.enable_synch and mws_settings.enable_amazon:
 		after_date = dateutil.parser.parse(mws_settings.after_date).strftime("%Y-%m-%d")
 		get_orders(after_date = after_date)
 
diff --git a/erpnext/patches/v11_0/redesign_healthcare_billing_work_flow.py b/erpnext/patches/v11_0/redesign_healthcare_billing_work_flow.py
index f8ff015..dc7ff13 100644
--- a/erpnext/patches/v11_0/redesign_healthcare_billing_work_flow.py
+++ b/erpnext/patches/v11_0/redesign_healthcare_billing_work_flow.py
@@ -15,6 +15,9 @@
 	frappe.reload_doc('accounts', 'doctype', 'loyalty_program')
 	frappe.reload_doc('accounts', 'doctype', 'sales_invoice_item')
 
+	if "healthcare" not in frappe.get_active_domains():
+		return
+
 	healthcare_custom_field_in_sales_invoice()
 	for si_ref_doc in sales_invoice_referenced_doc:
 		if frappe.db.exists('DocType', si_ref_doc):
diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json
index 96d1116..9a245e2 100644
--- a/erpnext/setup/doctype/company/company.json
+++ b/erpnext/setup/doctype/company/company.json
@@ -837,7 +837,7 @@
    "label": "Create Chart Of Accounts Based On", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nStandard Template\nExisting Company\n\n\n", 
+   "options": "\nStandard Template\nExisting Company", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -871,7 +871,7 @@
    "label": "Chart Of Accounts Template", 
    "length": 0, 
    "no_copy": 1, 
-   "options": "\n\n\n", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -2836,7 +2836,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2018-09-01 16:03:30.716918", 
+ "modified": "2018-09-07 16:03:30.716918", 
  "modified_by": "cave@aperture.com", 
  "module": "Setup", 
  "name": "Company",