When i want to make a new custom script, a js error will be throw:
Error code:
Error in Template:
var _p=[],print=function(){_p.push.apply(_p,arguments)};with(obj){
_p.push('<h3>Custom Script Help</h3> <p>Custom Scripts are executed only on the client-side (i.e. in Forms). Here are some examples to get you started</p> <pre><code> // fetch local_tax_no on selection of customer // cur_frm.add_fetch(link_field, source_fieldname, target_fieldname); cur_frm.add_fetch('customer', 'local_tax_no', 'local_tax_no'); // additional validation on dates frappe.ui.form.on('Task', 'validate', function(frm) { if (frm.doc.from_date < get_today()) { msgprint('You can not select past date in From Date'); validated = false; } }); // make a field read-only after saving frappe.ui.form.on('Task', { refresh: function(frm) { // use the __islocal value of doc, to check if the doc is saved or not frm.set_df_property('myfield', 'read_only', frm.doc.__islocal ? 0 : 1); } }); // additional permission check frappe.ui.form.on('Task', { validate: function(frm) { if(user=='user1@example.com' && frm.doc.purpose!='Material Receipt') { msgprint('You are only allowed Material Receipt'); validated = false; } } }); // calculate sales incentive frappe.ui.form.on('Sales Invoice\', { validate: function(frm) { // calculate incentives for each person on the deal total_incentive = 0 $.each(frm.doc.sales_team, function(i, d) { // calculate incentive var incentive_percent = 2; if(frm.doc.base_grand_total > 400) incentive_percent = 4; // actual incentive d.incentives = flt(frm.doc.base_grand_total) * incentive_percent / 100; total_incentive += flt(d.incentives) }); frm.doc.total_incentive = total_incentive; } }) </code></pre>');}return _p.join('');
Error in Line 4, Col 308:
undefined
can anybod reproduce this bug?
If yes, i will make an GitHub Issue