[fix] taxes and charges input value

This commit is contained in:
Nabin Hait
2015-05-05 16:33:58 +05:30
parent 40557750d5
commit 2b3e065efc
2 changed files with 0 additions and 19 deletions

View File

@@ -36,25 +36,8 @@ frappe.ui.form.on(cur_frm.doctype, {
},
validate: function(frm) {
// neither is absolutely mandatory
// check mandatory based on charge_type
frm.get_docfield("taxes", "rate").reqd = 0;
frm.get_docfield("taxes", "tax_amount").reqd = 0;
$.each(frm.doc.taxes || [], function(i, d) {
if(d.charge_type==="Actual") {
d.rate = 0;
if(!d.tax_amount) {
msgprint(__("Amount is mandatory for {0}", [d.account_head]));
validated = false;
}
} else {
d.tax_amount = 0;
if(!d.rate) {
msgprint(__("Rate is mandatory for {0}", [d.account_head]));
validated = false;
}
}
});
},
taxes_on_form_rendered: function(frm) {
erpnext.taxes.set_conditional_mandatory_rate_or_amount(frm);