mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-07 04:24:13 +00:00
fix: dont auto-fetch latest exchange rate
- also use correct currency field for comparison
(cherry picked from commit 4ccd0a7407)
This commit is contained in:
@@ -111,6 +111,13 @@ frappe.ui.form.on("Opportunity", {
|
|||||||
},
|
},
|
||||||
__("Create")
|
__("Create")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let company_currency = erpnext.get_currency(frm.doc.company);
|
||||||
|
if (company_currency != frm.doc.currency) {
|
||||||
|
frm.add_custom_button(__("Fetch Latest Exchange Rate"), function () {
|
||||||
|
frm.trigger("currency");
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!frm.doc.__islocal && frm.perm[0].write && frm.doc.docstatus == 0) {
|
if (!frm.doc.__islocal && frm.perm[0].write && frm.doc.docstatus == 0) {
|
||||||
@@ -152,7 +159,7 @@ frappe.ui.form.on("Opportunity", {
|
|||||||
|
|
||||||
currency: function (frm) {
|
currency: function (frm) {
|
||||||
let company_currency = erpnext.get_currency(frm.doc.company);
|
let company_currency = erpnext.get_currency(frm.doc.company);
|
||||||
if (company_currency != frm.doc.company) {
|
if (company_currency != frm.doc.currency) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.setup.utils.get_exchange_rate",
|
method: "erpnext.setup.utils.get_exchange_rate",
|
||||||
args: {
|
args: {
|
||||||
@@ -278,7 +285,6 @@ erpnext.crm.Opportunity = class Opportunity extends frappe.ui.form.Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setup_queries();
|
this.setup_queries();
|
||||||
this.frm.trigger("currency");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
|
|||||||
Reference in New Issue
Block a user