[fix] taxes and charges input value
This commit is contained in:
parent
40557750d5
commit
2b3e065efc
@ -375,8 +375,6 @@ def validate_taxes_and_charges(tax):
|
|||||||
|
|
||||||
if tax.charge_type == "Actual":
|
if tax.charge_type == "Actual":
|
||||||
tax.rate = None
|
tax.rate = None
|
||||||
if not tax.tax_amount:
|
|
||||||
frappe.throw(_("Amount is mandatory for charge type 'Actual'"))
|
|
||||||
|
|
||||||
def validate_inclusive_tax(tax, doc):
|
def validate_inclusive_tax(tax, doc):
|
||||||
def _on_previous_row_error(row_range):
|
def _on_previous_row_error(row_range):
|
||||||
|
@ -36,25 +36,8 @@ frappe.ui.form.on(cur_frm.doctype, {
|
|||||||
},
|
},
|
||||||
validate: function(frm) {
|
validate: function(frm) {
|
||||||
// neither is absolutely mandatory
|
// neither is absolutely mandatory
|
||||||
// check mandatory based on charge_type
|
|
||||||
frm.get_docfield("taxes", "rate").reqd = 0;
|
frm.get_docfield("taxes", "rate").reqd = 0;
|
||||||
frm.get_docfield("taxes", "tax_amount").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) {
|
taxes_on_form_rendered: function(frm) {
|
||||||
erpnext.taxes.set_conditional_mandatory_rate_or_amount(frm);
|
erpnext.taxes.set_conditional_mandatory_rate_or_amount(frm);
|
||||||
|
Loading…
Reference in New Issue
Block a user