Browse Source

Merge pull request #2230 from shreyasp/bulk_update_validation

[Minor] Added validation to bulk update in case user does not specify value field
version-14
Nabin Hait 8 years ago
committed by GitHub
parent
commit
4f7a737024
1 changed files with 18 additions and 13 deletions
  1. +18
    -13
      frappe/desk/doctype/bulk_update/bulk_update.js

+ 18
- 13
frappe/desk/doctype/bulk_update/bulk_update.js View File

@@ -4,19 +4,24 @@
frappe.ui.form.on('Bulk Update', { frappe.ui.form.on('Bulk Update', {
refresh: function(frm) { refresh: function(frm) {
frm.page.set_primary_action(__('Update'), function() { frm.page.set_primary_action(__('Update'), function() {
frappe.call({
method: 'frappe.desk.doctype.bulk_update.bulk_update.update',
args: {
doctype: frm.doc.document_type,
field: frm.doc.field,
value: frm.doc.update_value,
condition: frm.doc.condition,
limit: frm.doc.limit
},
callback: function() {
frappe.hide_progress();
}
});
if(!frm.doc.update_value){
frappe.throw(__('Field "value" is mandatory. Please specify value to be updated'));
}
else{
frappe.call({
method: 'frappe.desk.doctype.bulk_update.bulk_update.update',
args: {
doctype: frm.doc.document_type,
field: frm.doc.field,
value: frm.doc.update_value,
condition: frm.doc.condition,
limit: frm.doc.limit
},
callback: function() {
frappe.hide_progress();
}
});
}
}); });
}, },
document_type: function(frm) { document_type: function(frm) {


Loading…
Cancel
Save