Agri fixes (#11988)

* minor fixes in agri

* updated desktop.py

* [agri] fixed recreation of dotypes in setup.py

* setup_wizard changes

- converted agriculture from alpha to beta
- rearranged the domains alphabetically

* [agri] linked doctype is collapsible
diff --git a/.swp b/.swp
new file mode 100644
index 0000000..5a492bd
--- /dev/null
+++ b/.swp
Binary files differ
diff --git a/erpnext/agriculture/doctype/disease/disease.json b/erpnext/agriculture/doctype/disease/disease.json
index e10b1ca..9294cc7 100644
--- a/erpnext/agriculture/doctype/disease/disease.json
+++ b/erpnext/agriculture/doctype/disease/disease.json
@@ -108,66 +108,6 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "description", 
-   "fieldtype": "Long Text", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Description", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "section_break_2", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Treatment Task", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
    "fieldname": "treatment_task", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -222,6 +162,66 @@
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "section_break_2", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Treatment Task", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "description", 
+   "fieldtype": "Long Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
  "has_web_view": 0, 
@@ -234,7 +234,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-12-04 19:20:19.352479", 
+ "modified": "2017-12-07 16:24:22.923154", 
  "modified_by": "Administrator", 
  "module": "Agriculture", 
  "name": "Disease", 
diff --git a/erpnext/agriculture/doctype/land_unit/land_unit.json b/erpnext/agriculture/doctype/land_unit/land_unit.json
index 9ed3d03..e5f6c0d 100644
--- a/erpnext/agriculture/doctype/land_unit/land_unit.json
+++ b/erpnext/agriculture/doctype/land_unit/land_unit.json
@@ -502,7 +502,7 @@
    "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
-   "collapsible": 0, 
+   "collapsible": 1, 
    "columns": 0, 
    "fieldname": "section_break_17", 
    "fieldtype": "Section Break", 
@@ -513,6 +513,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
+   "label": "Linked Analysis", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -631,7 +632,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-12-05 10:57:33.108504", 
+ "modified": "2017-12-13 16:50:18.581137", 
  "modified_by": "Administrator", 
  "module": "Agriculture", 
  "name": "Land Unit", 
diff --git a/erpnext/agriculture/setup.py b/erpnext/agriculture/setup.py
index b3b136a..9044e09 100644
--- a/erpnext/agriculture/setup.py
+++ b/erpnext/agriculture/setup.py
@@ -4,6 +4,12 @@
 from erpnext.setup.utils import insert_record
 
 def setup_agriculture():
+	if frappe.db.exists('Land Unit', 'All Land Units'):
+		# already setup
+		return
+	create_agriculture_data()
+
+def create_agriculture_data():
 	records = [
 		dict(
 			doctype="Land Unit",
@@ -182,7 +188,7 @@
 			linked_doctype='Soil Analysis'),
 		dict(
 			doctype='Agriculture Analysis Criteria',
-			title='pH',
+			title='Soil pH',
 			standard=1,
 			linked_doctype='Soil Analysis'),
 		dict(
@@ -272,7 +278,7 @@
 			linked_doctype='Soil Analysis'),
 		dict(
 			doctype='Agriculture Analysis Criteria',
-			title='pH',
+			title='Water pH',
 			standard=1,
 			linked_doctype='Water Analysis'),
 		dict(
@@ -424,11 +430,6 @@
 			doctype='Agriculture Analysis Criteria',
 			title='Degree Days',
 			standard=1,
-			linked_doctype='Weather'),
-		dict(
-			doctype='Agriculture Analysis Criteria',
-			title='Degree Days',
-			standard=1,
-			linked_doctype='Water Analysis')
+			linked_doctype='Weather')
 	] 
 	insert_record(records)
diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js
index 740c3b9..6fa710d 100644
--- a/erpnext/public/js/setup_wizard.js
+++ b/erpnext/public/js/setup_wizard.js
@@ -23,13 +23,13 @@
 				fieldtype: 'MultiCheck',
 				options: [
 					{ "label": __("Distribution"), "value": "Distribution" },
+					{ "label": __("Education"), "value": "Education" },
 					{ "label": __("Manufacturing"), "value": "Manufacturing" },
 					{ "label": __("Retail"), "value": "Retail" },
 					{ "label": __("Services"), "value": "Services" },
+					{ "label": __("Agriculture (beta)"), "value": "Agriculture" },
 					{ "label": __("Healthcare (beta)"), "value": "Healthcare" },
-					{ "label": __("Education"), "value": "Education" },
-					{ "label": __("Agriculture (alpha)"), "value": "Agriculture" },
-					{"label": __("Non Profit (beta)"), "value": "Non Profit"}
+					{ "label": __("Non Profit (beta)"), "value": "Non Profit" }
 				], reqd: 1
 			},
 		],