Validate Bank name in Setup wizard on the same slide (#12968)
* validate bank name before moving on to next slide * Update setup_wizard.js
This commit is contained in:
@@ -137,11 +137,35 @@ erpnext.setup.slides_settings = [
|
||||
},
|
||||
|
||||
validate: function () {
|
||||
let me = this;
|
||||
let exist;
|
||||
|
||||
// validate fiscal year start and end dates
|
||||
if (this.values.fy_start_date == 'Invalid date' || this.values.fy_end_date == 'Invalid date') {
|
||||
frappe.msgprint(__("Please enter valid Financial Year Start and End Dates"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validate bank name
|
||||
if(me.values.bank_account){
|
||||
frappe.call({
|
||||
async: false,
|
||||
method: "erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts.validate_bank_account",
|
||||
args: {
|
||||
"coa": me.values.chart_of_accounts,
|
||||
"bank_account": me.values.bank_account
|
||||
},
|
||||
callback: function (r) {
|
||||
if(r.message){
|
||||
exist = r.message;
|
||||
me.get_field("bank_account").set_value("");
|
||||
frappe.msgprint(__(`Account ${me.values.bank_account} already exists, enter a different name for your bank account`));
|
||||
}
|
||||
}
|
||||
});
|
||||
return !exist; // Return False if exist = true
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user