Quellcode durchsuchen

[minor] no quick entry for custom script

version-14
Rushabh Mehta vor 9 Jahren
Ursprung
Commit
b67ebc86c3
3 geänderte Dateien mit 28 neuen und 5 gelöschten Zeilen
  1. +5
    -2
      frappe/custom/doctype/custom_field/custom_field.json
  2. +8
    -0
      frappe/custom/doctype/custom_script/custom_script.js
  3. +15
    -3
      frappe/custom/doctype/custom_script/custom_script.json

+ 5
- 2
frappe/custom/doctype/custom_field/custom_field.json Datei anzeigen

@@ -2,6 +2,7 @@
"allow_copy": 0, "allow_copy": 0,
"allow_import": 1, "allow_import": 1,
"allow_rename": 0, "allow_rename": 0,
"beta": 0,
"creation": "2013-01-10 16:34:01", "creation": "2013-01-10 16:34:01",
"custom": 0, "custom": 0,
"description": "Adds a custom field to a DocType", "description": "Adds a custom field to a DocType",
@@ -895,7 +896,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-03-03 05:10:38.033237",
"modified": "2016-05-14 09:22:58.789603",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Custom", "module": "Custom",
"name": "Custom Field", "name": "Custom Field",
@@ -942,8 +943,10 @@
"write": 1 "write": 1
} }
], ],
"quick_entry": 0,
"read_only": 0, "read_only": 0,
"read_only_onload": 0, "read_only_onload": 0,
"search_fields": "dt,label,fieldtype,options", "search_fields": "dt,label,fieldtype,options",
"sort_order": "ASC"
"sort_order": "ASC",
"track_seen": 0
} }

+ 8
- 0
frappe/custom/doctype/custom_script/custom_script.js Datei anzeigen

@@ -0,0 +1,8 @@
// Copyright (c) 2016, Frappe Technologies and contributors
// For license information, please see license.txt

frappe.ui.form.on('Custom Script', {
refresh: function(frm) {

}
});

+ 15
- 3
frappe/custom/doctype/custom_script/custom_script.json Datei anzeigen

@@ -3,6 +3,7 @@
"allow_import": 1, "allow_import": 1,
"allow_rename": 0, "allow_rename": 0,
"autoname": "CustomScript.####", "autoname": "CustomScript.####",
"beta": 0,
"creation": "2013-01-10 16:34:01", "creation": "2013-01-10 16:34:01",
"custom": 0, "custom": 0,
"description": "Adds a custom script (client or server) to a DocType", "description": "Adds a custom script (client or server) to a DocType",
@@ -17,6 +18,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "DocType", "label": "DocType",
@@ -27,6 +29,7 @@
"options": "DocType", "options": "DocType",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@@ -43,6 +46,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 1, "hidden": 1,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Script Type", "label": "Script Type",
@@ -53,6 +57,7 @@
"options": "Client", "options": "Client",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1, "read_only": 1,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@@ -68,6 +73,7 @@
"fieldtype": "Code", "fieldtype": "Code",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Script", "label": "Script",
@@ -78,6 +84,7 @@
"options": "Script", "options": "Script",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@@ -93,14 +100,16 @@
"fieldtype": "HTML", "fieldtype": "HTML",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Sample", "label": "Sample",
"length": 0, "length": 0,
"no_copy": 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 < 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\" && 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>",
"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, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@@ -119,7 +128,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2015-11-16 06:29:44.183199",
"modified": "2016-05-14 09:22:45.601963",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Custom", "module": "Custom",
"name": "Custom Script", "name": "Custom Script",
@@ -166,6 +175,9 @@
"write": 1 "write": 1
} }
], ],
"quick_entry": 0,
"read_only": 0, "read_only": 0,
"read_only_onload": 0
"read_only_onload": 0,
"sort_order": "ASC",
"track_seen": 0
} }

Laden…
Abbrechen
Speichern