Last active
August 29, 2015 14:04
-
-
Save nathando/740b3eb9131fafb029e8 to your computer and use it in GitHub Desktop.
Ajax client test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cur_frm.cscript.employee = function(doc,dt,dn){ | |
| return $c_obj(doc, 'get_emp_and_leave_details','',function(r, rt) { | |
| console.log("default====="); | |
| var doc = locals[dt][dn]; | |
| cur_frm.refresh(); // Once this called, the changes made using customize script are reverted | |
| calculate_all(doc, dt, dn); | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cur_frm.cscript.custom_employee = function(doc, dt, dn) { | |
| frappe.call({ | |
| method:"frappe.client.get_value", | |
| args: { | |
| doctype: "Sales Person", | |
| fieldname: "name", | |
| filters: {employee: doc.employee} | |
| }, | |
| callback: function(data) { | |
| // There is one sales person tied to this employee | |
| if (data.message) | |
| { | |
| console.log(data.message); | |
| cur_frm.set_value("sales_person", data.message.name); | |
| } | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment