Merge pull request #1034 from akhileshdarjee/1310

[fix] [minor] updated message for conversion rate
This commit is contained in:
Nabin Hait 2013-11-12 19:10:47 -08:00
commit eaa911ae50
2 changed files with 14 additions and 14 deletions

View File

@ -499,16 +499,16 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
this.frm.doc.conversion_rate = flt(this.frm.doc.conversion_rate, precision("conversion_rate"));
var conversion_rate_label = wn.meta.get_label(this.frm.doc.doctype, "conversion_rate",
this.frm.doc.name);
if(this.frm.doc.conversion_rate == 0) {
wn.throw(wn._(conversion_rate_label) + " " + wn._("cannot be 0"));
}
var company_currency = this.get_company_currency();
if(!this.frm.doc.conversion_rate) {
wn.throw(wn._("Please enter valid") + " " + wn._(conversion_rate_label) +
" 1 " + this.frm.doc.currency + " = [?] " + company_currency);
wn.throw(wn._('%(conversion_rate_label)s is mandatory. Maybe Currency Exchange \
record is not created for %(from_currency)s to %(to_currency)s'),
{
"conversion_rate_label": conversion_rate_label,
"from_currency": self.doc.currency,
"to_currency": company_currency
});
}
},

View File

@ -426,15 +426,15 @@ def get_address_territory(address_doc):
def validate_conversion_rate(currency, conversion_rate, conversion_rate_label, company):
"""common validation for currency and price list currency"""
if conversion_rate == 0:
msgprint(conversion_rate_label + _(' cannot be 0'), raise_exception=True)
company_currency = webnotes.conn.get_value("Company", company, "default_currency")
if not conversion_rate:
msgprint(_('Please enter valid ') + conversion_rate_label + (': ')
+ ("1 %s = [?] %s" % (currency, company_currency)),
raise_exception=True)
msgprint(_('%(conversion_rate_label)s is mandatory. Maybe Currency Exchange \
record is not created for %(from_currency)s to %(to_currency)s') % {
"conversion_rate_label": conversion_rate_label,
"from_currency": currency,
"to_currency": company_currency
}, raise_exception=True)
def validate_item_fetch(args, item):
from stock.utils import validate_end_of_life