Merge branch 'develop' into fix_indentation
diff --git a/erpnext/crm/doctype/opportunity/opportunity.json b/erpnext/crm/doctype/opportunity/opportunity.json
index 121a336..37f492e 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.json
+++ b/erpnext/crm/doctype/opportunity/opportunity.json
@@ -1,1561 +1,453 @@
 {
- "allow_copy": 0,
- "allow_events_in_timeline": 0,
- "allow_guest_to_view": 0,
  "allow_import": 1,
- "allow_rename": 0,
  "autoname": "naming_series:",
- "beta": 0,
  "creation": "2013-03-07 18:50:30",
- "custom": 0,
  "description": "Potential Sales Deal",
- "docstatus": 0,
  "doctype": "DocType",
  "document_type": "Document",
  "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+  "from_section",
+  "naming_series",
+  "opportunity_from",
+  "party_name",
+  "customer_name",
+  "column_break0",
+  "title",
+  "opportunity_type",
+  "status",
+  "converted_by",
+  "sales_stage",
+  "order_lost_reason",
+  "mins_to_first_response",
+  "next_contact",
+  "contact_by",
+  "contact_date",
+  "column_break2",
+  "to_discuss",
+  "section_break_14",
+  "currency",
+  "opportunity_amount",
+  "with_items",
+  "column_break_17",
+  "probability",
+  "items_section",
+  "items",
+  "contact_info",
+  "customer_address",
+  "address_display",
+  "territory",
+  "customer_group",
+  "column_break3",
+  "contact_person",
+  "contact_display",
+  "contact_email",
+  "contact_mobile",
+  "more_info",
+  "source",
+  "campaign",
+  "column_break1",
+  "company",
+  "transaction_date",
+  "amended_from",
+  "lost_reasons"
+ ],
  "fields": [
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "from_section",
    "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "",
-   "length": 0,
-   "no_copy": 0,
-   "options": "fa fa-user",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "options": "fa fa-user"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "",
-   "fetch_if_empty": 0,
    "fieldname": "naming_series",
    "fieldtype": "Select",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
    "in_list_view": 1,
-   "in_standard_filter": 0,
    "label": "Series",
-   "length": 0,
    "no_copy": 1,
    "oldfieldname": "naming_series",
    "oldfieldtype": "Select",
    "options": "CRM-OPP-.YYYY.-",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
    "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 1,
-   "translatable": 0,
-   "unique": 0
+   "set_only_once": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "opportunity_from",
    "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
    "in_list_view": 1,
    "in_standard_filter": 1,
    "label": "Opportunity From",
-   "length": 0,
-   "no_copy": 0,
    "oldfieldname": "enquiry_from",
    "oldfieldtype": "Select",
    "options": "DocType",
-   "permlevel": 0,
    "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "reqd": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
    "bold": 1,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fetch_if_empty": 0,
    "fieldname": "party_name",
    "fieldtype": "Dynamic Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
    "in_standard_filter": 1,
    "label": "Party",
-   "length": 0,
-   "no_copy": 0,
    "oldfieldname": "customer",
    "oldfieldtype": "Link",
    "options": "opportunity_from",
-   "permlevel": 0,
    "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "reqd": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
    "bold": 1,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fetch_from": "",
-   "fetch_if_empty": 0,
    "fieldname": "customer_name",
    "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
    "in_global_search": 1,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Customer / Lead Name",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "read_only": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "column_break0",
    "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "length": 0,
-   "no_copy": 0,
    "oldfieldtype": "Column Break",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0,
    "width": "50%"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "title",
    "fieldtype": "Data",
    "hidden": 1,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Title",
-   "length": 0,
-   "no_copy": 1,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "no_copy": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "default": "Sales",
-   "fetch_if_empty": 0,
    "fieldname": "opportunity_type",
    "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
    "in_list_view": 1,
-   "in_standard_filter": 0,
    "label": "Opportunity Type",
-   "length": 0,
-   "no_copy": 0,
    "oldfieldname": "enquiry_type",
    "oldfieldtype": "Select",
-   "options": "Opportunity Type",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "options": "Opportunity Type"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "default": "Open",
-   "fetch_if_empty": 0,
    "fieldname": "status",
    "fieldtype": "Select",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
    "in_list_view": 1,
    "in_standard_filter": 1,
    "label": "Status",
-   "length": 0,
    "no_copy": 1,
    "oldfieldname": "status",
    "oldfieldtype": "Select",
    "options": "Open\nQuotation\nConverted\nLost\nReplied\nClosed",
-   "permlevel": 0,
    "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "reqd": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.status===\"Lost\"",
-   "fetch_if_empty": 0,
    "fieldname": "order_lost_reason",
    "fieldtype": "Small Text",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Lost Reason",
-   "length": 0,
    "no_copy": 1,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "read_only": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
    "bold": 1,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "mins_to_first_response",
    "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Mins to first response",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "read_only": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
    "collapsible": 1,
    "collapsible_depends_on": "contact_by",
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "next_contact",
    "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": "Follow Up",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "label": "Follow Up"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "description": "",
-   "fetch_if_empty": 0,
    "fieldname": "contact_by",
    "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
    "in_standard_filter": 1,
    "label": "Next Contact By",
-   "length": 0,
-   "no_copy": 0,
    "oldfieldname": "contact_by",
    "oldfieldtype": "Link",
    "options": "User",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0,
    "width": "75px"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "description": "",
-   "fetch_if_empty": 0,
    "fieldname": "contact_date",
    "fieldtype": "Datetime",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Next Contact Date",
-   "length": 0,
-   "no_copy": 0,
    "oldfieldname": "contact_date",
-   "oldfieldtype": "Date",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "oldfieldtype": "Date"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "column_break2",
    "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "length": 0,
-   "no_copy": 0,
    "oldfieldtype": "Column Break",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0,
    "width": "50%"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "to_discuss",
    "fieldtype": "Small Text",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "To Discuss",
-   "length": 0,
    "no_copy": 1,
    "oldfieldname": "to_discuss",
-   "oldfieldtype": "Small Text",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "oldfieldtype": "Small Text"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "section_break_14",
    "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": "Sales",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "label": "Sales"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "currency",
    "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Currency",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Currency",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "options": "Currency"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "opportunity_amount",
    "fieldtype": "Currency",
-   "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": "Opportunity Amount",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "label": "Opportunity Amount"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
+   "default": "0",
    "fieldname": "with_items",
    "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "With Items",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "label": "With Items"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "column_break_17",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "fieldtype": "Column Break"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "default": "Prospecting",
-   "fetch_if_empty": 0,
    "fieldname": "sales_stage",
    "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Sales Stage",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Sales Stage",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "options": "Sales Stage"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "default": "100",
-   "fetch_if_empty": 0,
    "fieldname": "probability",
    "fieldtype": "Percent",
-   "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": "Probability (%)",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "label": "Probability (%)"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "with_items",
-   "fetch_if_empty": 0,
    "fieldname": "items_section",
    "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Items",
-   "length": 0,
-   "no_copy": 0,
    "oldfieldtype": "Section Break",
-   "options": "fa fa-shopping-cart",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "options": "fa fa-shopping-cart"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "description": "",
-   "fetch_if_empty": 0,
    "fieldname": "items",
    "fieldtype": "Table",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Items",
-   "length": 0,
-   "no_copy": 0,
    "oldfieldname": "enquiry_details",
    "oldfieldtype": "Table",
-   "options": "Opportunity Item",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "options": "Opportunity Item"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
    "collapsible": 1,
    "collapsible_depends_on": "next_contact_by",
-   "columns": 0,
    "depends_on": "eval:doc.party_name",
-   "fetch_if_empty": 0,
    "fieldname": "contact_info",
    "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Contact Info",
-   "length": 0,
-   "no_copy": 0,
-   "options": "fa fa-bullhorn",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "options": "fa fa-bullhorn"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.party_name",
-   "fetch_if_empty": 0,
    "fieldname": "customer_address",
    "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Customer / Lead Address",
-   "length": 0,
-   "no_copy": 0,
    "options": "Address",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "print_hide": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "address_display",
    "fieldtype": "Small Text",
    "hidden": 1,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Address",
-   "length": 0,
-   "no_copy": 0,
    "oldfieldname": "address",
    "oldfieldtype": "Small Text",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "read_only": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:",
-   "description": "",
-   "fetch_if_empty": 0,
    "fieldname": "territory",
    "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Territory",
-   "length": 0,
-   "no_copy": 0,
    "options": "Territory",
-   "permlevel": 0,
    "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "search_index": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.opportunity_from=='Customer' && doc.party_name",
-   "description": "",
-   "fetch_if_empty": 0,
    "fieldname": "customer_group",
    "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Customer Group",
-   "length": 0,
-   "no_copy": 0,
    "oldfieldname": "customer_group",
    "oldfieldtype": "Link",
    "options": "Customer Group",
-   "permlevel": 0,
    "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "search_index": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "column_break3",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "fieldtype": "Column Break"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.party_name",
-   "fetch_if_empty": 0,
    "fieldname": "contact_person",
    "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Contact Person",
-   "length": 0,
-   "no_copy": 0,
    "options": "Contact",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "print_hide": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.opportunity_from=='Customer' && doc.party_name",
-   "fetch_if_empty": 0,
    "fieldname": "contact_display",
    "fieldtype": "Small Text",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
    "in_global_search": 1,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Contact",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "read_only": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.party_name",
-   "fetch_if_empty": 0,
    "fieldname": "contact_email",
    "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Contact Email",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "read_only": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.party_name",
-   "fetch_if_empty": 0,
    "fieldname": "contact_mobile",
    "fieldtype": "Small Text",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Contact Mobile No",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "read_only": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
    "collapsible": 1,
-   "collapsible_depends_on": "",
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "more_info",
    "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Source",
-   "length": 0,
-   "no_copy": 0,
    "oldfieldtype": "Section Break",
-   "options": "fa fa-file-text",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "options": "fa fa-file-text"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "source",
    "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Source",
-   "length": 0,
-   "no_copy": 0,
    "oldfieldname": "source",
    "oldfieldtype": "Select",
-   "options": "Lead Source",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "options": "Lead Source"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval: doc.source==\"Campaign\"",
    "description": "Enter name of campaign if source of enquiry is campaign",
-   "fetch_if_empty": 0,
    "fieldname": "campaign",
    "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Campaign",
-   "length": 0,
-   "no_copy": 0,
    "oldfieldname": "campaign",
    "oldfieldtype": "Link",
-   "options": "Campaign",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "options": "Campaign"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "column_break1",
    "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "length": 0,
-   "no_copy": 0,
    "oldfieldtype": "Column Break",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0,
    "width": "50%"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "company",
    "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Company",
-   "length": 0,
-   "no_copy": 0,
    "oldfieldname": "company",
    "oldfieldtype": "Link",
    "options": "Company",
-   "permlevel": 0,
    "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
    "remember_last_selected_value": 1,
-   "report_hide": 0,
    "reqd": 1,
-   "search_index": 1,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "search_index": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "default": "Today",
-   "fetch_if_empty": 0,
    "fieldname": "transaction_date",
    "fieldtype": "Date",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Opportunity Date",
-   "length": 0,
-   "no_copy": 0,
    "oldfieldname": "transaction_date",
    "oldfieldtype": "Date",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
    "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0,
    "width": "50px"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "amended_from",
    "fieldtype": "Link",
-   "hidden": 0,
    "ignore_user_permissions": 1,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
    "label": "Amended From",
-   "length": 0,
    "no_copy": 1,
    "oldfieldname": "amended_from",
    "oldfieldtype": "Data",
    "options": "Opportunity",
-   "permlevel": 0,
    "print_hide": 1,
-   "print_hide_if_no_value": 0,
    "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0,
    "width": "150px"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "fieldname": "lost_reasons",
    "fieldtype": "Table MultiSelect",
-   "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": "Lost Reasons",
-   "length": 0,
-   "no_copy": 0,
    "options": "Lost Reason Detail",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "read_only": 1
+  },
+  {
+   "fieldname": "converted_by",
+   "fieldtype": "Link",
+   "label": "Converted By",
+   "options": "User"
   }
  ],
- "has_web_view": 0,
- "hide_heading": 0,
- "hide_toolbar": 0,
  "icon": "fa fa-info-sign",
  "idx": 195,
- "image_view": 0,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 0,
- "max_attachments": 0,
- "modified": "2019-06-19 19:03:32.740910",
+ "modified": "2019-09-12 09:37:30.127901",
  "modified_by": "Administrator",
  "module": "CRM",
  "name": "Opportunity",
  "owner": "Administrator",
  "permissions": [
   {
-   "amend": 0,
-   "cancel": 0,
    "create": 1,
    "delete": 1,
    "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
    "print": 1,
    "read": 1,
    "report": 1,
    "role": "Sales User",
-   "set_user_permissions": 0,
    "share": 1,
-   "submit": 0,
    "write": 1
   },
   {
-   "amend": 0,
-   "cancel": 0,
    "create": 1,
    "delete": 1,
    "email": 1,
    "export": 1,
-   "if_owner": 0,
    "import": 1,
-   "permlevel": 0,
    "print": 1,
    "read": 1,
    "report": 1,
    "role": "Sales Manager",
-   "set_user_permissions": 0,
    "share": 1,
-   "submit": 0,
    "write": 1
   }
  ],
- "quick_entry": 0,
- "read_only": 0,
- "read_only_onload": 0,
  "search_fields": "status,transaction_date,party_name,opportunity_type,territory,company",
  "show_name_in_global_search": 1,
  "sort_field": "modified",
  "sort_order": "DESC",
  "timeline_field": "party_name",
  "title_field": "title",
- "track_changes": 0,
  "track_seen": 1,
  "track_views": 1
 }
\ No newline at end of file
diff --git a/erpnext/erpnext_integrations/exotel_integration.py b/erpnext/erpnext_integrations/exotel_integration.py
index 09c399e..167fcb7 100644
--- a/erpnext/erpnext_integrations/exotel_integration.py
+++ b/erpnext/erpnext_integrations/exotel_integration.py
@@ -1,5 +1,6 @@
 import frappe
 import requests
+from frappe import _
 
 # api/method/erpnext.erpnext_integrations.exotel_integration.handle_incoming_call
 # api/method/erpnext.erpnext_integrations.exotel_integration.handle_end_call
@@ -7,19 +8,24 @@
 
 @frappe.whitelist(allow_guest=True)
 def handle_incoming_call(**kwargs):
-	exotel_settings = get_exotel_settings()
-	if not exotel_settings.enabled: return
+	try:
+		exotel_settings = get_exotel_settings()
+		if not exotel_settings.enabled: return
 
-	call_payload = kwargs
-	status = call_payload.get('Status')
-	if status == 'free':
-		return
+		call_payload = kwargs
+		status = call_payload.get('Status')
+		if status == 'free':
+			return
 
-	call_log = get_call_log(call_payload)
-	if not call_log:
-		create_call_log(call_payload)
-	else:
-		update_call_log(call_payload, call_log=call_log)
+		call_log = get_call_log(call_payload)
+		if not call_log:
+			create_call_log(call_payload)
+		else:
+			update_call_log(call_payload, call_log=call_log)
+	except Exception as e:
+		frappe.db.rollback()
+		frappe.log_error(title=_('Error in Exotel incoming call'))
+		frappe.db.commit()
 
 @frappe.whitelist(allow_guest=True)
 def handle_end_call(**kwargs):
@@ -101,4 +107,4 @@
 		api_token=settings.api_token,
 		sid=settings.account_sid,
 		action=action
-	)
\ No newline at end of file
+	)
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 7c1d8a0..8b3da8e 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -635,3 +635,4 @@
 erpnext.patches.v12_0.generate_leave_ledger_entries
 erpnext.patches.v12_0.move_credit_limit_to_customer_credit_limit
 erpnext.patches.v12_0.add_variant_of_in_item_attribute_table
+erpnext.patches.v12_0.create_default_energy_point_rules
diff --git a/erpnext/patches/v12_0/create_default_energy_point_rules.py b/erpnext/patches/v12_0/create_default_energy_point_rules.py
new file mode 100644
index 0000000..88233b4
--- /dev/null
+++ b/erpnext/patches/v12_0/create_default_energy_point_rules.py
@@ -0,0 +1,6 @@
+import frappe
+from erpnext.setup.install import create_default_energy_point_rules
+
+def execute():
+	frappe.reload_doc('social', 'doctype', 'energy_point_rule')
+	create_default_energy_point_rules()
\ No newline at end of file
diff --git a/erpnext/projects/doctype/task/task.json b/erpnext/projects/doctype/task/task.json
index c5131c7..794d816 100644
--- a/erpnext/projects/doctype/task/task.json
+++ b/erpnext/projects/doctype/task/task.json
@@ -1,381 +1,391 @@
 {
-  "allow_import": 1,
-  "autoname": "TASK-.YYYY.-.#####",
-  "creation": "2013-01-29 19:25:50",
-  "doctype": "DocType",
-  "document_type": "Setup",
-  "field_order": [
-   "subject",
-   "project",
-   "issue",
-   "type",
-   "is_group",
-   "column_break0",
-   "status",
-   "priority",
-   "task_weight",
-   "color",
-   "parent_task",
-   "sb_timeline",
-   "exp_start_date",
-   "expected_time",
-   "column_break_11",
-   "exp_end_date",
-   "progress",
-   "is_milestone",
-   "sb_details",
-   "description",
-   "sb_depends_on",
-   "depends_on",
-   "depends_on_tasks",
-   "sb_actual",
-   "act_start_date",
-   "actual_time",
-   "column_break_15",
-   "act_end_date",
-   "sb_costing",
-   "total_costing_amount",
-   "total_expense_claim",
-   "column_break_20",
-   "total_billing_amount",
-   "sb_more_info",
-   "review_date",
-   "closing_date",
-   "column_break_22",
-   "department",
-   "company",
-   "lft",
-   "rgt",
-   "old_parent"
-  ],
-  "fields": [
-   {
-    "fieldname": "subject",
-    "fieldtype": "Data",
-    "in_global_search": 1,
-    "label": "Subject",
-    "reqd": 1,
-    "search_index": 1,
-    "in_standard_filter": 1
-   },
-   {
-    "bold": 1,
-    "fieldname": "project",
-    "fieldtype": "Link",
-    "in_global_search": 1,
-    "in_list_view": 1,
-    "in_standard_filter": 1,
-    "label": "Project",
-    "oldfieldname": "project",
-    "oldfieldtype": "Link",
-    "options": "Project",
-    "remember_last_selected_value": 1,
-    "search_index": 1
-   },
-   {
-    "fieldname": "issue",
-    "fieldtype": "Link",
-    "label": "Issue",
-    "options": "Issue"
-   },
-   {
-    "fieldname": "type",
-    "fieldtype": "Link",
-    "label": "Type",
-    "options": "Task Type"
-   },
-   {
-    "bold": 1,
-    "default": "0",
-    "fieldname": "is_group",
-    "fieldtype": "Check",
-    "in_list_view": 1,
-    "label": "Is Group"
-   },
-   {
-    "fieldname": "column_break0",
-    "fieldtype": "Column Break",
-    "oldfieldtype": "Column Break",
-    "print_width": "50%",
-    "width": "50%"
-   },
-   {
-    "bold": 1,
-    "fieldname": "status",
-    "fieldtype": "Select",
-    "in_list_view": 1,
-    "in_standard_filter": 1,
-    "label": "Status",
-    "no_copy": 1,
-    "oldfieldname": "status",
-    "oldfieldtype": "Select",
-    "options": "Open\nWorking\nPending Review\nOverdue\nCompleted\nCancelled"
-   },
-   {
-    "fieldname": "priority",
-    "fieldtype": "Select",
-    "in_list_view": 1,
-    "in_standard_filter": 1,
-    "label": "Priority",
-    "oldfieldname": "priority",
-    "oldfieldtype": "Select",
-    "options": "Low\nMedium\nHigh\nUrgent",
-    "search_index": 1
-   },
-   {
-    "fieldname": "color",
-    "fieldtype": "Color",
-    "label": "Color"
-   },
-   {
-    "bold": 1,
-    "fieldname": "parent_task",
-    "fieldtype": "Link",
-    "ignore_user_permissions": 1,
-    "label": "Parent Task",
-    "options": "Task",
-    "search_index": 1
-   },
-   {
-    "collapsible": 1,
-    "collapsible_depends_on": "eval:doc.__islocal",
-    "fieldname": "sb_timeline",
-    "fieldtype": "Section Break",
-    "label": "Timeline"
-   },
-   {
-    "fieldname": "exp_start_date",
-    "fieldtype": "Date",
-    "label": "Expected Start Date",
-    "oldfieldname": "exp_start_date",
-    "oldfieldtype": "Date"
-   },
-   {
-    "default": "0",
-    "fieldname": "expected_time",
-    "fieldtype": "Float",
-    "label": "Expected Time (in hours)",
-    "oldfieldname": "exp_total_hrs",
-    "oldfieldtype": "Data"
-   },
-   {
-    "fetch_from": "type.weight",
-    "fieldname": "task_weight",
-    "fieldtype": "Float",
-    "label": "Weight"
-   },
-   {
-    "fieldname": "column_break_11",
-    "fieldtype": "Column Break"
-   },
-   {
-    "bold": 1,
-    "fieldname": "exp_end_date",
-    "fieldtype": "Date",
-    "label": "Expected End Date",
-    "oldfieldname": "exp_end_date",
-    "oldfieldtype": "Date",
-    "search_index": 1
-   },
-   {
-    "fieldname": "progress",
-    "fieldtype": "Percent",
-    "label": "% Progress"
-   },
-   {
-    "fieldname": "is_milestone",
-    "fieldtype": "Check",
-    "in_list_view": 1,
-    "label": "Is Milestone"
-   },
-   {
-    "fieldname": "sb_details",
-    "fieldtype": "Section Break",
-    "label": "Details",
-    "oldfieldtype": "Section Break"
-   },
-   {
-    "fieldname": "description",
-    "fieldtype": "Text Editor",
-    "in_preview": 1,
-    "label": "Task Description",
-    "oldfieldname": "description",
-    "oldfieldtype": "Text Editor",
-    "print_width": "300px",
-    "width": "300px"
-   },
-   {
-    "fieldname": "sb_depends_on",
-    "fieldtype": "Section Break",
-    "label": "Dependencies",
-    "oldfieldtype": "Section Break"
-   },
-   {
-    "fieldname": "depends_on",
-    "fieldtype": "Table",
-    "label": "Dependent Tasks",
-    "options": "Task Depends On"
-   },
-   {
-    "fieldname": "depends_on_tasks",
-    "fieldtype": "Code",
-    "hidden": 1,
-    "label": "Depends on Tasks",
-    "read_only": 1
-   },
-   {
-    "fieldname": "sb_actual",
-    "fieldtype": "Section Break",
-    "oldfieldtype": "Column Break",
-    "print_width": "50%",
-    "width": "50%"
-   },
-   {
-    "fieldname": "act_start_date",
-    "fieldtype": "Date",
-    "label": "Actual Start Date (via Time Sheet)",
-    "oldfieldname": "act_start_date",
-    "oldfieldtype": "Date",
-    "read_only": 1
-   },
-   {
-    "fieldname": "actual_time",
-    "fieldtype": "Float",
-    "label": "Actual Time (in hours)",
-    "read_only": 1
-   },
-   {
-    "fieldname": "column_break_15",
-    "fieldtype": "Column Break"
-   },
-   {
-    "fieldname": "act_end_date",
-    "fieldtype": "Date",
-    "label": "Actual End Date (via Time Sheet)",
-    "oldfieldname": "act_end_date",
-    "oldfieldtype": "Date",
-    "read_only": 1
-   },
-   {
-    "collapsible": 1,
-    "fieldname": "sb_costing",
-    "fieldtype": "Section Break",
-    "label": "Costing"
-   },
-   {
-    "fieldname": "total_costing_amount",
-    "fieldtype": "Currency",
-    "label": "Total Costing Amount (via Time Sheet)",
-    "oldfieldname": "actual_budget",
-    "oldfieldtype": "Currency",
-    "options": "Company:company:default_currency",
-    "read_only": 1
-   },
-   {
-    "fieldname": "total_expense_claim",
-    "fieldtype": "Currency",
-    "label": "Total Expense Claim (via Expense Claim)",
-    "options": "Company:company:default_currency",
-    "read_only": 1
-   },
-   {
-    "fieldname": "column_break_20",
-    "fieldtype": "Column Break"
-   },
-   {
-    "fieldname": "total_billing_amount",
-    "fieldtype": "Currency",
-    "label": "Total Billing Amount (via Time Sheet)",
-    "read_only": 1
-   },
-   {
-    "collapsible": 1,
-    "fieldname": "sb_more_info",
-    "fieldtype": "Section Break",
-    "label": "More Info"
-   },
-   {
-    "depends_on": "eval:doc.status == \"Closed\" || doc.status == \"Pending Review\"",
-    "fieldname": "review_date",
-    "fieldtype": "Date",
-    "label": "Review Date",
-    "oldfieldname": "review_date",
-    "oldfieldtype": "Date"
-   },
-   {
-    "depends_on": "eval:doc.status == \"Closed\"",
-    "fieldname": "closing_date",
-    "fieldtype": "Date",
-    "label": "Closing Date",
-    "oldfieldname": "closing_date",
-    "oldfieldtype": "Date"
-   },
-   {
-    "fieldname": "column_break_22",
-    "fieldtype": "Column Break"
-   },
-   {
-    "fieldname": "department",
-    "fieldtype": "Link",
-    "label": "Department",
-    "options": "Department"
-   },
-   {
-    "fieldname": "company",
-    "fieldtype": "Link",
-    "label": "Company",
-    "options": "Company",
-    "remember_last_selected_value": 1
-   },
-   {
-    "fieldname": "lft",
-    "fieldtype": "Int",
-    "hidden": 1,
-    "label": "lft",
-    "read_only": 1
-   },
-   {
-    "fieldname": "rgt",
-    "fieldtype": "Int",
-    "hidden": 1,
-    "label": "rgt",
-    "read_only": 1
-   },
-   {
-    "fieldname": "old_parent",
-    "fieldtype": "Data",
-    "hidden": 1,
-    "ignore_user_permissions": 1,
-    "label": "Old Parent",
-    "read_only": 1
-   }
-  ],
-  "icon": "fa fa-check",
-  "idx": 1,
-  "max_attachments": 5,
-  "modified": "2019-06-19 09:51:15.599416",
-  "modified_by": "Administrator",
-  "module": "Projects",
-  "name": "Task",
-  "owner": "Administrator",
-  "permissions": [
-   {
-    "create": 1,
-    "delete": 1,
-    "email": 1,
-    "print": 1,
-    "read": 1,
-    "report": 1,
-    "role": "Projects User",
-    "share": 1,
-    "write": 1
-   }
-  ],
-  "search_fields": "subject",
-  "show_name_in_global_search": 1,
-  "show_preview_popup": 1,
-  "sort_order": "DESC",
-  "timeline_field": "project",
-  "title_field": "subject",
-  "track_seen": 1
- }
\ No newline at end of file
+ "allow_import": 1,
+ "autoname": "TASK-.YYYY.-.#####",
+ "creation": "2013-01-29 19:25:50",
+ "doctype": "DocType",
+ "document_type": "Setup",
+ "engine": "InnoDB",
+ "field_order": [
+  "subject",
+  "project",
+  "issue",
+  "type",
+  "is_group",
+  "column_break0",
+  "status",
+  "priority",
+  "task_weight",
+  "completed_by",
+  "color",
+  "parent_task",
+  "sb_timeline",
+  "exp_start_date",
+  "expected_time",
+  "column_break_11",
+  "exp_end_date",
+  "progress",
+  "is_milestone",
+  "sb_details",
+  "description",
+  "sb_depends_on",
+  "depends_on",
+  "depends_on_tasks",
+  "sb_actual",
+  "act_start_date",
+  "actual_time",
+  "column_break_15",
+  "act_end_date",
+  "sb_costing",
+  "total_costing_amount",
+  "total_expense_claim",
+  "column_break_20",
+  "total_billing_amount",
+  "sb_more_info",
+  "review_date",
+  "closing_date",
+  "column_break_22",
+  "department",
+  "company",
+  "lft",
+  "rgt",
+  "old_parent"
+ ],
+ "fields": [
+  {
+   "fieldname": "subject",
+   "fieldtype": "Data",
+   "in_global_search": 1,
+   "in_standard_filter": 1,
+   "label": "Subject",
+   "reqd": 1,
+   "search_index": 1
+  },
+  {
+   "bold": 1,
+   "fieldname": "project",
+   "fieldtype": "Link",
+   "in_global_search": 1,
+   "in_list_view": 1,
+   "in_standard_filter": 1,
+   "label": "Project",
+   "oldfieldname": "project",
+   "oldfieldtype": "Link",
+   "options": "Project",
+   "remember_last_selected_value": 1,
+   "search_index": 1
+  },
+  {
+   "fieldname": "issue",
+   "fieldtype": "Link",
+   "label": "Issue",
+   "options": "Issue"
+  },
+  {
+   "fieldname": "type",
+   "fieldtype": "Link",
+   "label": "Type",
+   "options": "Task Type"
+  },
+  {
+   "bold": 1,
+   "default": "0",
+   "fieldname": "is_group",
+   "fieldtype": "Check",
+   "in_list_view": 1,
+   "label": "Is Group"
+  },
+  {
+   "fieldname": "column_break0",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "print_width": "50%",
+   "width": "50%"
+  },
+  {
+   "bold": 1,
+   "fieldname": "status",
+   "fieldtype": "Select",
+   "in_list_view": 1,
+   "in_standard_filter": 1,
+   "label": "Status",
+   "no_copy": 1,
+   "oldfieldname": "status",
+   "oldfieldtype": "Select",
+   "options": "Open\nWorking\nPending Review\nOverdue\nCompleted\nCancelled"
+  },
+  {
+   "fieldname": "priority",
+   "fieldtype": "Select",
+   "in_list_view": 1,
+   "in_standard_filter": 1,
+   "label": "Priority",
+   "oldfieldname": "priority",
+   "oldfieldtype": "Select",
+   "options": "Low\nMedium\nHigh\nUrgent",
+   "search_index": 1
+  },
+  {
+   "fieldname": "color",
+   "fieldtype": "Color",
+   "label": "Color"
+  },
+  {
+   "bold": 1,
+   "fieldname": "parent_task",
+   "fieldtype": "Link",
+   "ignore_user_permissions": 1,
+   "label": "Parent Task",
+   "options": "Task",
+   "search_index": 1
+  },
+  {
+   "collapsible": 1,
+   "collapsible_depends_on": "eval:doc.__islocal",
+   "fieldname": "sb_timeline",
+   "fieldtype": "Section Break",
+   "label": "Timeline"
+  },
+  {
+   "fieldname": "exp_start_date",
+   "fieldtype": "Date",
+   "label": "Expected Start Date",
+   "oldfieldname": "exp_start_date",
+   "oldfieldtype": "Date"
+  },
+  {
+   "default": "0",
+   "fieldname": "expected_time",
+   "fieldtype": "Float",
+   "label": "Expected Time (in hours)",
+   "oldfieldname": "exp_total_hrs",
+   "oldfieldtype": "Data"
+  },
+  {
+   "fetch_from": "type.weight",
+   "fieldname": "task_weight",
+   "fieldtype": "Float",
+   "label": "Weight"
+  },
+  {
+   "fieldname": "column_break_11",
+   "fieldtype": "Column Break"
+  },
+  {
+   "bold": 1,
+   "fieldname": "exp_end_date",
+   "fieldtype": "Date",
+   "label": "Expected End Date",
+   "oldfieldname": "exp_end_date",
+   "oldfieldtype": "Date",
+   "search_index": 1
+  },
+  {
+   "fieldname": "progress",
+   "fieldtype": "Percent",
+   "label": "% Progress"
+  },
+  {
+   "default": "0",
+   "fieldname": "is_milestone",
+   "fieldtype": "Check",
+   "in_list_view": 1,
+   "label": "Is Milestone"
+  },
+  {
+   "fieldname": "sb_details",
+   "fieldtype": "Section Break",
+   "label": "Details",
+   "oldfieldtype": "Section Break"
+  },
+  {
+   "fieldname": "description",
+   "fieldtype": "Text Editor",
+   "in_preview": 1,
+   "label": "Task Description",
+   "oldfieldname": "description",
+   "oldfieldtype": "Text Editor",
+   "print_width": "300px",
+   "width": "300px"
+  },
+  {
+   "fieldname": "sb_depends_on",
+   "fieldtype": "Section Break",
+   "label": "Dependencies",
+   "oldfieldtype": "Section Break"
+  },
+  {
+   "fieldname": "depends_on",
+   "fieldtype": "Table",
+   "label": "Dependent Tasks",
+   "options": "Task Depends On"
+  },
+  {
+   "fieldname": "depends_on_tasks",
+   "fieldtype": "Code",
+   "hidden": 1,
+   "label": "Depends on Tasks",
+   "read_only": 1
+  },
+  {
+   "fieldname": "sb_actual",
+   "fieldtype": "Section Break",
+   "oldfieldtype": "Column Break",
+   "print_width": "50%",
+   "width": "50%"
+  },
+  {
+   "fieldname": "act_start_date",
+   "fieldtype": "Date",
+   "label": "Actual Start Date (via Time Sheet)",
+   "oldfieldname": "act_start_date",
+   "oldfieldtype": "Date",
+   "read_only": 1
+  },
+  {
+   "fieldname": "actual_time",
+   "fieldtype": "Float",
+   "label": "Actual Time (in hours)",
+   "read_only": 1
+  },
+  {
+   "fieldname": "column_break_15",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "act_end_date",
+   "fieldtype": "Date",
+   "label": "Actual End Date (via Time Sheet)",
+   "oldfieldname": "act_end_date",
+   "oldfieldtype": "Date",
+   "read_only": 1
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "sb_costing",
+   "fieldtype": "Section Break",
+   "label": "Costing"
+  },
+  {
+   "fieldname": "total_costing_amount",
+   "fieldtype": "Currency",
+   "label": "Total Costing Amount (via Time Sheet)",
+   "oldfieldname": "actual_budget",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "read_only": 1
+  },
+  {
+   "fieldname": "total_expense_claim",
+   "fieldtype": "Currency",
+   "label": "Total Expense Claim (via Expense Claim)",
+   "options": "Company:company:default_currency",
+   "read_only": 1
+  },
+  {
+   "fieldname": "column_break_20",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "total_billing_amount",
+   "fieldtype": "Currency",
+   "label": "Total Billing Amount (via Time Sheet)",
+   "read_only": 1
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "sb_more_info",
+   "fieldtype": "Section Break",
+   "label": "More Info"
+  },
+  {
+   "depends_on": "eval:doc.status == \"Closed\" || doc.status == \"Pending Review\"",
+   "fieldname": "review_date",
+   "fieldtype": "Date",
+   "label": "Review Date",
+   "oldfieldname": "review_date",
+   "oldfieldtype": "Date"
+  },
+  {
+   "depends_on": "eval:doc.status == \"Closed\"",
+   "fieldname": "closing_date",
+   "fieldtype": "Date",
+   "label": "Closing Date",
+   "oldfieldname": "closing_date",
+   "oldfieldtype": "Date"
+  },
+  {
+   "fieldname": "column_break_22",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "department",
+   "fieldtype": "Link",
+   "label": "Department",
+   "options": "Department"
+  },
+  {
+   "fieldname": "company",
+   "fieldtype": "Link",
+   "label": "Company",
+   "options": "Company",
+   "remember_last_selected_value": 1
+  },
+  {
+   "fieldname": "lft",
+   "fieldtype": "Int",
+   "hidden": 1,
+   "label": "lft",
+   "read_only": 1
+  },
+  {
+   "fieldname": "rgt",
+   "fieldtype": "Int",
+   "hidden": 1,
+   "label": "rgt",
+   "read_only": 1
+  },
+  {
+   "fieldname": "old_parent",
+   "fieldtype": "Data",
+   "hidden": 1,
+   "ignore_user_permissions": 1,
+   "label": "Old Parent",
+   "read_only": 1
+  },
+  {
+   "fieldname": "completed_by",
+   "fieldtype": "Link",
+   "label": "Completed By",
+   "options": "User"
+  }
+ ],
+ "icon": "fa fa-check",
+ "idx": 1,
+ "max_attachments": 5,
+ "modified": "2019-09-10 13:46:24.631754",
+ "modified_by": "Administrator",
+ "module": "Projects",
+ "name": "Task",
+ "owner": "Administrator",
+ "permissions": [
+  {
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Projects User",
+   "share": 1,
+   "write": 1
+  }
+ ],
+ "search_fields": "subject",
+ "show_name_in_global_search": 1,
+ "show_preview_popup": 1,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "timeline_field": "project",
+ "title_field": "subject",
+ "track_seen": 1
+}
\ No newline at end of file
diff --git a/erpnext/setup/default_energy_point_rules.py b/erpnext/setup/default_energy_point_rules.py
new file mode 100644
index 0000000..94f5aa4
--- /dev/null
+++ b/erpnext/setup/default_energy_point_rules.py
@@ -0,0 +1,58 @@
+from __future__ import unicode_literals
+from frappe import _
+
+doctype_rule_map = {
+	'Item': {
+		'points': 5,
+		'for_doc_event': 'New'
+	},
+	'Customer': {
+		'points': 5,
+		'for_doc_event': 'New'
+	},
+	'Supplier': {
+		'points': 5,
+		'for_doc_event': 'New'
+	},
+	'Lead': {
+		'points': 2,
+		'for_doc_event': 'New'
+	},
+	'Opportunity': {
+		'points': 10,
+		'for_doc_event': 'Custom',
+		'condition': 'doc.status=="Converted"',
+		'rule_name': _('On Converting Opportunity'),
+		'user_field': 'converted_by'
+	},
+	'Sales Order': {
+		'points': 10,
+		'for_doc_event': 'Submit',
+		'rule_name': _('On Sales Order Submission'),
+		'user_field': 'modified_by'
+	},
+	'Purchase Order': {
+		'points': 10,
+		'for_doc_event': 'Submit',
+		'rule_name': _('On Purchase Order Submission'),
+		'user_field': 'modified_by'
+	},
+	'Task': {
+		'points': 5,
+		'condition': 'doc.status == "Completed"',
+		'rule_name': _('On Task Completion'),
+		'user_field': 'completed_by'
+	}
+}
+
+def get_default_energy_point_rules():
+	return [{
+		'doctype': 'Energy Point Rule',
+		'reference_doctype': doctype,
+		'for_doc_event': rule.get('for_doc_event') or 'Custom',
+		'condition': rule.get('condition'),
+		'rule_name': rule.get('rule_name') or _('On {0} Creation').format(doctype),
+		'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 6c2a97a..b8b09cb 100644
--- a/erpnext/setup/default_success_action.py
+++ b/erpnext/setup/default_success_action.py
@@ -2,26 +2,26 @@
 from frappe import _
 
 doctype_list = [
-    'Purchase Receipt',
-    'Purchase Invoice',
-    'Quotation',
-    'Sales Order',
-    'Delivery Note',
-    'Sales Invoice'
+	'Purchase Receipt',
+	'Purchase Invoice',
+	'Quotation',
+	'Sales Order',
+	'Delivery Note',
+	'Sales Invoice'
 ]
 
 def get_message(doctype):
-    return _("{0} has been submitted successfully".format(_(doctype)))
+	return _("{0} has been submitted successfully").format(_(doctype))
 
 def get_first_success_message(doctype):
-    return _("{0} has been submitted successfully".format(_(doctype)))
+	return get_message(doctype)
 
 def get_default_success_action():
-    return [{
-        'doctype': 'Success Action',
-        'ref_doctype': doctype,
-        'message': get_message(doctype),
-        'first_success_message': get_first_success_message(doctype),
-        'next_actions': 'new\nprint\nemail'
-    } for doctype in doctype_list]
+	return [{
+		'doctype': 'Success Action',
+		'ref_doctype': doctype,
+		'message': get_message(doctype),
+		'first_success_message': get_first_success_message(doctype),
+		'next_actions': 'new\nprint\nemail'
+	} for doctype in doctype_list]
 
diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py
index 5e85f7d..e666a41 100644
--- a/erpnext/setup/install.py
+++ b/erpnext/setup/install.py
@@ -9,6 +9,7 @@
 from frappe import _
 from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
 from frappe.custom.doctype.custom_field.custom_field import create_custom_field
+from erpnext.setup.default_energy_point_rules import get_default_energy_point_rules
 
 default_mail_footer = """<div style="padding: 7px; text-align: right; color: #888"><small>Sent via
 	<a style="color: #888" href="http://erpnext.org">ERPNext</a></div>"""
@@ -22,6 +23,7 @@
 	add_all_roles_to("Administrator")
 	create_default_cash_flow_mapper_templates()
 	create_default_success_action()
+	create_default_energy_point_rules()
 	add_company_to_session_defaults()
 	frappe.db.commit()
 
@@ -86,6 +88,17 @@
 			doc = frappe.get_doc(success_action)
 			doc.insert(ignore_permissions=True)
 
+def create_default_energy_point_rules():
+
+	for rule in get_default_energy_point_rules():
+		# check if any rule for ref. doctype exists
+		rule_exists = frappe.db.exists('Energy Point Rule', {
+			'reference_doctype': rule.get('reference_doctype')
+		})
+		if rule_exists: continue
+		doc = frappe.get_doc(rule)
+		doc.insert(ignore_permissions=True)
+
 def add_company_to_session_defaults():
 	settings = frappe.get_single("Session Default Settings")
 	settings.append("session_defaults", {