From 8df49ca772c046f9d4e091bba36096bb1ec43512 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 21 Jun 2013 12:05:35 +0530 Subject: [PATCH] [buying] [fix] on change of currency, set conversion rate = 1 if currency=company currency --- buying/doctype/purchase_common/purchase_common.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index dacee80e55..9e291f5f17 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -128,23 +128,27 @@ erpnext.buying.BuyingController = wn.ui.form.Controller.extend({ }, currency: function() { - this.set_dynamic_labels(); + if(this.frm.doc.currency === this.get_company_currency()) + this.frm.set_value("conversion_rate", 1.0); + + this.price_list_currency(); }, company: function() { - this.set_dynamic_labels(); + if(this.frm.fields_dict.currency) + this.set_dynamic_labels(); }, price_list_currency: function() { this.frm.toggle_reqd("plc_conversion_rate", !!(this.frm.doc.price_list_name && this.frm.doc.price_list_currency)); - this.set_dynamic_labels(); - if(this.frm.doc.price_list_currency === this.get_company_currency()) this.frm.set_value("plc_conversion_rate", 1.0); else if(this.frm.doc.price_list_currency === this.frm.doc.currency) this.frm.set_value("plc_conversion_rate", this.frm.doc.conversion_rate || 1.0); + + this.set_dynamic_labels(); }, set_dynamic_labels: function(doc, dt, dn) {