Rushabh Mehta | f56d73c | 2013-10-10 16:35:09 +0530 | [diff] [blame] | 1 | |
| 2 | // get tax rate |
| 3 | cur_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 Mehta | 793ba6b | 2014-02-14 15:47:51 +0530 | [diff] [blame] | 7 | frappe.model.set_value(cdt, cdn, "account_head", ""); |
Rushabh Mehta | f56d73c | 2013-10-10 16:35:09 +0530 | [diff] [blame] | 8 | } else if(d.account_head && d.charge_type!=="Actual") { |
Rushabh Mehta | 793ba6b | 2014-02-14 15:47:51 +0530 | [diff] [blame] | 9 | frappe.call({ |
Rushabh Mehta | f56d73c | 2013-10-10 16:35:09 +0530 | [diff] [blame] | 10 | type:"GET", |
Anand Doshi | 9a4a13c | 2013-12-31 17:38:21 +0530 | [diff] [blame] | 11 | method: "erpnext.controllers.accounts_controller.get_tax_rate", |
Rushabh Mehta | f56d73c | 2013-10-10 16:35:09 +0530 | [diff] [blame] | 12 | args: {"account_head":d.account_head}, |
| 13 | callback: function(r) { |
Rushabh Mehta | 793ba6b | 2014-02-14 15:47:51 +0530 | [diff] [blame] | 14 | frappe.model.set_value(cdt, cdn, "rate", r.message || 0); |
Rushabh Mehta | f56d73c | 2013-10-10 16:35:09 +0530 | [diff] [blame] | 15 | } |
| 16 | }) |
| 17 | } |
| 18 | } |