From b98d3514ab1bef6a6a26f2b5c0a3c9dde0f0b6fc Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Sat, 28 Jan 2023 13:51:33 +0530 Subject: [PATCH] fix: item rate not fetching (cherry picked from commit 0d7f98b496ac49872654b1a9c47183f337544ce1) --- erpnext/public/js/controllers/transaction.js | 4 ++++ erpnext/stock/doctype/item/item.js | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index b1bf8b24047..b6fab544220 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1691,6 +1691,10 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe var me = this; var valid = true; + if (frappe.flags.ignore_company_party_validation) { + return valid; + } + $.each(["company", "customer"], function(i, fieldname) { if(frappe.meta.has_field(me.frm.doc.doctype, fieldname) && me.frm.doc.doctype != "Purchase Order") { if (!me.frm.doc[fieldname]) { diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index e61f0f514e3..5bcb05aa988 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -894,6 +894,12 @@ function open_form(frm, doctype, child_doctype, parentfield) { new_child_doc.uom = frm.doc.stock_uom; new_child_doc.description = frm.doc.description; - frappe.ui.form.make_quick_entry(doctype, null, null, new_doc); + frappe.run_serially([ + () => frappe.ui.form.make_quick_entry(doctype, null, null, new_doc), + () => { + frappe.flags.ignore_company_party_validation = true; + frappe.model.trigger("item_code", frm.doc.name, new_child_doc); + } + ]) }); }