[buying] [fix] on change of currency, set conversion rate = 1 if currency=company currency

This commit is contained in:
Anand Doshi 2013-06-21 12:05:35 +05:30
parent 3c6c3cf5ee
commit 8df49ca772

View File

@ -128,10 +128,14 @@ erpnext.buying.BuyingController = wn.ui.form.Controller.extend({
}, },
currency: function() { 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() { company: function() {
if(this.frm.fields_dict.currency)
this.set_dynamic_labels(); this.set_dynamic_labels();
}, },
@ -139,12 +143,12 @@ erpnext.buying.BuyingController = wn.ui.form.Controller.extend({
this.frm.toggle_reqd("plc_conversion_rate", this.frm.toggle_reqd("plc_conversion_rate",
!!(this.frm.doc.price_list_name && this.frm.doc.price_list_currency)); !!(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()) if(this.frm.doc.price_list_currency === this.get_company_currency())
this.frm.set_value("plc_conversion_rate", 1.0); this.frm.set_value("plc_conversion_rate", 1.0);
else if(this.frm.doc.price_list_currency === this.frm.doc.currency) 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.frm.set_value("plc_conversion_rate", this.frm.doc.conversion_rate || 1.0);
this.set_dynamic_labels();
}, },
set_dynamic_labels: function(doc, dt, dn) { set_dynamic_labels: function(doc, dt, dn) {