This commit is contained in:
Rushabh Mehta 2015-03-02 16:29:56 +05:30
parent 3384cb7e63
commit 8c84fca182

View File

@ -139,31 +139,37 @@ frappe.ui.form.on(cur_frm.doctype, "taxes_on_form_rendered", function(frm) {
erpnext.taxes.set_conditional_mandatory_rate_or_amount(frm); erpnext.taxes.set_conditional_mandatory_rate_or_amount(frm);
}); });
// setup queries for taxes
frappe.ui.form.on(cur_frm.doctype, "onload", function(frm) {
if(frm.get_field("taxes")) {
frm.set_query("account_head", "taxes", function(doc) {
if(frm.cscript.tax_table == "Sales Taxes and Charges") {
var account_type = ["Tax", "Chargeable", "Expense Account"];
} else {
var account_type = ["Tax", "Chargeable", "Income Account"];
}
cur_frm.set_query("account_head", "taxes", function(doc) { return {
if(cur_frm.cscript.tax_table == "Sales Taxes and Charges") { query: "erpnext.controllers.queries.tax_account_query",
var account_type = ["Tax", "Chargeable", "Expense Account"]; filters: {
} else { "account_type": account_type,
var account_type = ["Tax", "Chargeable", "Income Account"]; "company": doc.company
} }
}
});
return { frm.set_query("cost_center", "taxes", function(doc) {
query: "erpnext.controllers.queries.tax_account_query", return {
filters: { filters: {
"account_type": account_type, 'company': doc.company,
"company": doc.company 'group_or_ledger': "Ledger"
} }
}
});
} }
}); });
cur_frm.set_query("cost_center", "taxes", function(doc) {
return {
filters: {
'company': doc.company,
'group_or_ledger': "Ledger"
}
}
});
// For customizing print // For customizing print
cur_frm.pformat.total = function(doc) { return ''; } cur_frm.pformat.total = function(doc) { return ''; }