Merge pull request #25742 from ankush/disable_submit_btn
fix: duplicate stock entry on multiple click
This commit is contained in:
commit
ab34f5b485
@ -230,7 +230,6 @@ erpnext.stock.move_item = function (item, source, target, actual_qty, rate, call
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
var submitted = false;
|
|
||||||
dialog.show();
|
dialog.show();
|
||||||
dialog.get_field('item_code').set_input(item);
|
dialog.get_field('item_code').set_input(item);
|
||||||
|
|
||||||
@ -254,7 +253,6 @@ erpnext.stock.move_item = function (item, source, target, actual_qty, rate, call
|
|||||||
}
|
}
|
||||||
|
|
||||||
dialog.set_primary_action(__('Submit'), function () {
|
dialog.set_primary_action(__('Submit'), function () {
|
||||||
if(submitted) return;
|
|
||||||
var values = dialog.get_values();
|
var values = dialog.get_values();
|
||||||
if (!values) {
|
if (!values) {
|
||||||
return;
|
return;
|
||||||
@ -267,11 +265,12 @@ erpnext.stock.move_item = function (item, source, target, actual_qty, rate, call
|
|||||||
frappe.msgprint(__('Source and target warehouse must be different'));
|
frappe.msgprint(__('Source and target warehouse must be different'));
|
||||||
}
|
}
|
||||||
|
|
||||||
submitted = true;
|
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'erpnext.stock.doctype.stock_entry.stock_entry_utils.make_stock_entry',
|
method: 'erpnext.stock.doctype.stock_entry.stock_entry_utils.make_stock_entry',
|
||||||
args: values,
|
args: values,
|
||||||
|
btn: dialog.get_primary_btn(),
|
||||||
freeze: true,
|
freeze: true,
|
||||||
|
freeze_message: __('Creating Stock Entry'),
|
||||||
callback: function (r) {
|
callback: function (r) {
|
||||||
frappe.show_alert(__('Stock Entry {0} created',
|
frappe.show_alert(__('Stock Entry {0} created',
|
||||||
['<a href="/app/stock-entry/' + r.message.name + '">' + r.message.name + '</a>']));
|
['<a href="/app/stock-entry/' + r.message.name + '">' + r.message.name + '</a>']));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user