Merge pull request #46001 from frappe/mergify/bp/version-15-hotfix/pr-45882

fix(quotation): fetch exchange rate on currency change (backport #45882)
This commit is contained in:
ruthra kumar
2025-02-19 11:13:04 +05:30
committed by GitHub

View File

@@ -353,6 +353,26 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext.
);
dialog.show();
}
currency() {
super.currency();
let me = this;
const company_currency = this.get_company_currency();
if (this.frm.doc.currency && this.frm.doc.currency !== company_currency) {
this.get_exchange_rate(
this.frm.doc.transaction_date,
this.frm.doc.currency,
company_currency,
function (exchange_rate) {
if (exchange_rate != me.frm.doc.conversion_rate) {
me.set_margin_amount_based_on_currency(exchange_rate);
me.set_actual_charges_based_on_currency(exchange_rate);
me.frm.set_value("conversion_rate", exchange_rate);
}
}
);
}
}
};
cur_frm.script_manager.make(erpnext.selling.QuotationController);