From 71402b43a776d4af98912223c8299c4fd8bfbbfe Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Fri, 25 Mar 2022 21:49:19 +0530 Subject: [PATCH] fix: Check for onload property --- erpnext/public/js/controllers/transaction.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 0973a426e98..23932d117f0 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1043,7 +1043,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ var company_currency = this.get_company_currency(); // Added `ignore_price_list` to determine if document is loading after mapping from another doc if(this.frm.doc.currency && this.frm.doc.currency !== company_currency - && !this.frm.doc.__onload.ignore_price_list) { + && !(this.frm.doc.__onload && this.frm.doc.__onload.ignore_price_list)) { this.get_exchange_rate(transaction_date, this.frm.doc.currency, company_currency, function(exchange_rate) { @@ -1144,7 +1144,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ var company_currency = this.get_company_currency(); // Added `ignore_price_list` to determine if document is loading after mapping from another doc - if(this.frm.doc.price_list_currency !== company_currency && !this.frm.doc.__onload.ignore_price_list) { + if(this.frm.doc.price_list_currency !== company_currency && + !(this.frm.doc.__onload && this.frm.doc.__onload.ignore_price_list)) { this.get_exchange_rate(this.frm.doc.posting_date, this.frm.doc.price_list_currency, company_currency, function(exchange_rate) { me.frm.set_value("plc_conversion_rate", exchange_rate);