{
 "allow_copy": 0, 
 "allow_guest_to_view": 0, 
 "allow_import": 1, 
 "allow_rename": 0, 
 "autoname": "CustomScript.####", 
 "beta": 0, 
 "creation": "2013-01-10 16:34:01", 
 "custom": 0, 
 "description": "Adds a custom script (client or server) to a DocType", 
 "docstatus": 0, 
 "doctype": "DocType", 
 "document_type": "Document", 
 "editable_grid": 0, 
 "engine": "InnoDB", 
 "fields": [
  {
   "allow_bulk_edit": 0, 
   "allow_on_submit": 0, 
   "bold": 0, 
   "collapsible": 0, 
   "columns": 0, 
   "fieldname": "dt", 
   "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": "DocType", 
   "length": 0, 
   "no_copy": 0, 
   "oldfieldname": "dt", 
   "oldfieldtype": "Link", 
   "options": "DocType", 
   "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, 
   "unique": 0
  }, 
  {
   "allow_bulk_edit": 0, 
   "allow_on_submit": 0, 
   "bold": 0, 
   "collapsible": 0, 
   "columns": 0, 
   "default": "Client", 
   "fieldname": "script_type", 
   "fieldtype": "Select", 
   "hidden": 1, 
   "ignore_user_permissions": 0, 
   "ignore_xss_filter": 0, 
   "in_filter": 0, 
   "in_global_search": 0, 
   "in_list_view": 1, 
   "in_standard_filter": 1, 
   "label": "Script Type", 
   "length": 0, 
   "no_copy": 0, 
   "oldfieldname": "script_type", 
   "oldfieldtype": "Select", 
   "options": "Client", 
   "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, 
   "unique": 0
  }, 
  {
   "allow_bulk_edit": 0, 
   "allow_on_submit": 0, 
   "bold": 0, 
   "collapsible": 0, 
   "columns": 0, 
   "fieldname": "script", 
   "fieldtype": "Code", 
   "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": "Script", 
   "length": 0, 
   "no_copy": 0, 
   "oldfieldname": "script", 
   "oldfieldtype": "Code", 
   "options": "Script", 
   "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, 
   "unique": 0
  }, 
  {
   "allow_bulk_edit": 0, 
   "allow_on_submit": 0, 
   "bold": 0, 
   "collapsible": 0, 
   "columns": 0, 
   "fieldname": "sample", 
   "fieldtype": "HTML", 
   "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": "Sample", 
   "length": 0, 
   "no_copy": 0, 
   "options": "<h3>Custom Script Help</h3>\n<p>Custom Scripts are executed only on the client-side (i.e. in Forms). Here are some examples to get you started</p>\n<pre><code>\n\n// fetch local_tax_no on selection of customer\n// cur_frm.add_fetch(link_field, source_fieldname, target_fieldname);\ncur_frm.add_fetch(\"customer\", \"local_tax_no\", \"local_tax_no\");\n\n// additional validation on dates\nfrappe.ui.form.on(\"Task\", \"validate\", function(frm) {\n    if (frm.doc.from_date &lt; get_today()) {\n        msgprint(\"You can not select past date in From Date\");\n        validated = false;\n    }\n});\n\n// make a field read-only after saving\nfrappe.ui.form.on(\"Task\", {\n    refresh: function(frm) {\n        // use the __islocal value of doc, to check if the doc is saved or not\n        frm.set_df_property(\"myfield\", \"read_only\", frm.doc.__islocal ? 0 : 1);\n    }\n});\n\n// additional permission check\nfrappe.ui.form.on(\"Task\", {\n    validate: function(frm) {\n        if(user==\"user1@example.com\" &amp;&amp; frm.doc.purpose!=\"Material Receipt\") {\n            msgprint(\"You are only allowed Material Receipt\");\n            validated = false;\n        }\n    }\n});\n\n// calculate sales incentive\nfrappe.ui.form.on(\"Sales Invoice\", {\n    validate: function(frm) {\n        // calculate incentives for each person on the deal\n        total_incentive = 0\n        $.each(frm.doc.sales_team), function(i, d) {\n\n            // calculate incentive\n            var incentive_percent = 2;\n            if(frm.doc.base_grand_total &gt; 400) incentive_percent = 4;\n\n            // actual incentive\n            d.incentives = flt(frm.doc.base_grand_total) * incentive_percent / 100;\n            total_incentive += flt(d.incentives)\n        });\n\n        frm.doc.total_incentive = total_incentive;\n    }\n})\n\n</code>\n</pre>", 
   "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, 
   "unique": 0
  }
 ], 
 "has_web_view": 0, 
 "hide_heading": 0, 
 "hide_toolbar": 0, 
 "icon": "fa fa-glass", 
 "idx": 1, 
 "image_view": 0, 
 "in_create": 0, 
 "is_submittable": 0, 
 "issingle": 0, 
 "istable": 0, 
 "max_attachments": 0, 
 "modified": "2017-08-17 07:43:08.093341", 
 "modified_by": "Administrator", 
 "module": "Custom", 
 "name": "Custom Script", 
 "owner": "Administrator", 
 "permissions": [
  {
   "amend": 0, 
   "apply_user_permissions": 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": "System Manager", 
   "set_user_permissions": 0, 
   "share": 1, 
   "submit": 0, 
   "write": 1
  }, 
  {
   "amend": 0, 
   "apply_user_permissions": 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": "Administrator", 
   "set_user_permissions": 0, 
   "share": 1, 
   "submit": 0, 
   "write": 1
  }
 ], 
 "quick_entry": 0, 
 "read_only": 0, 
 "read_only_onload": 0, 
 "show_name_in_global_search": 0, 
 "sort_order": "ASC", 
 "track_changes": 1, 
 "track_seen": 0
}