From 54d6cf18fc2ee9bf2857b7d8d796954d5e7d6b51 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Fri, 13 May 2022 13:07:23 +0530 Subject: [PATCH] fix: Item rate reset on changing posting date (#30990) * fix: Item rate reset on changing posting date * chore: Remove debugger --- erpnext/public/js/controllers/transaction.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index c3812f3848..05a401bdee 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -923,12 +923,12 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe } currency() { - /* manqala 19/09/2016: let the translation date be whichever of the transaction_date or posting_date is available */ - var transaction_date = this.frm.doc.transaction_date || this.frm.doc.posting_date; - /* end manqala */ - var me = this; + // The transaction date be either transaction_date (from orders) or posting_date (from invoices) + let transaction_date = this.frm.doc.transaction_date || this.frm.doc.posting_date; + + let me = this; this.set_dynamic_labels(); - var company_currency = this.get_company_currency(); + let 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 && this.frm.doc.__onload.ignore_price_list)) { @@ -942,7 +942,9 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe } }); } else { - this.conversion_rate(); + // company currency and doc currency is same + // this will prevent unnecessary conversion rate triggers + this.frm.set_value("conversion_rate", 1.0); } }