From c1a0f649cb08484f6eb558791531bd932ca86999 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 17 Dec 2021 19:06:19 +0530 Subject: [PATCH] fix: convert asynchronous field update to synchronous (#28930) (cherry picked from commit 5adf85f5b7ba94591381b03709b1fee6aa9331a5) Co-authored-by: Dan Navarro on Ubuntu Work --- erpnext/public/js/utils.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 93a273187a..9339c5d998 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -430,12 +430,9 @@ erpnext.utils.select_alternate_items = function(opts) { qty = row.qty; } row[item_field] = d.alternate_item; - frm.script_manager.trigger(item_field, row.doctype, row.name) - .then(() => { - frappe.model.set_value(row.doctype, row.name, 'qty', qty); - frappe.model.set_value(row.doctype, row.name, - opts.original_item_field, d.item_code); - }); + frappe.model.set_value(row.doctype, row.name, 'qty', qty); + frappe.model.set_value(row.doctype, row.name, opts.original_item_field, d.item_code); + frm.trigger(item_field, row.doctype, row.name); }); refresh_field(opts.child_docname);