Merge pull request #31002 from frappe/mergify/bp/version-13-hotfix/pr-30990

fix: Item rate reset on changing posting date (backport #30990)
This commit is contained in:
Deepesh Garg
2022-05-13 14:44:04 +05:30
committed by GitHub

View File

@@ -1035,12 +1035,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
}, },
currency: function() { currency: function() {
/* manqala 19/09/2016: let the translation date be whichever of the transaction_date or posting_date is available */ let transaction_date = this.frm.doc.transaction_date || this.frm.doc.posting_date;
var transaction_date = this.frm.doc.transaction_date || this.frm.doc.posting_date;
/* end manqala */ let me = this;
var me = this;
this.set_dynamic_labels(); 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 // 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 if(this.frm.doc.currency && this.frm.doc.currency !== company_currency
&& !(this.frm.doc.__onload && this.frm.doc.__onload.ignore_price_list)) { && !(this.frm.doc.__onload && this.frm.doc.__onload.ignore_price_list)) {
@@ -1054,7 +1053,9 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
} }
}); });
} else { } 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);
} }
}, },