blob: 03e1890b8be85ce1c36210692db3fd6c673665f8 [file] [log] [blame]
Rushabh Mehtaf56d73c2013-10-10 16:35:09 +05301
2// get tax rate
3cur_frm.cscript.account_head = function(doc, cdt, cdn) {
4 var d = locals[cdt][cdn];
5 if(!d.charge_type && d.account_head){
6 msgprint("Please select Charge Type first");
Rushabh Mehta793ba6b2014-02-14 15:47:51 +05307 frappe.model.set_value(cdt, cdn, "account_head", "");
Rushabh Mehtaf56d73c2013-10-10 16:35:09 +05308 } else if(d.account_head && d.charge_type!=="Actual") {
Rushabh Mehta793ba6b2014-02-14 15:47:51 +05309 frappe.call({
Rushabh Mehtaf56d73c2013-10-10 16:35:09 +053010 type:"GET",
Anand Doshi9a4a13c2013-12-31 17:38:21 +053011 method: "erpnext.controllers.accounts_controller.get_tax_rate",
Rushabh Mehtaf56d73c2013-10-10 16:35:09 +053012 args: {"account_head":d.account_head},
13 callback: function(r) {
Rushabh Mehta793ba6b2014-02-14 15:47:51 +053014 frappe.model.set_value(cdt, cdn, "rate", r.message || 0);
Rushabh Mehtaf56d73c2013-10-10 16:35:09 +053015 }
16 })
17 }
18}