Bläddra i källkod

[precision and currency] [fix] fix in get precision and display of currency

version-14
Anand Doshi 12 år sedan
förälder
incheckning
2baa15d4a2
3 ändrade filer med 5 tillägg och 3 borttagningar
  1. +2
    -1
      public/js/wn/misc/number_format.js
  2. +1
    -1
      public/js/wn/model/meta.js
  3. +2
    -1
      webnotes/model/meta.py

+ 2
- 1
public/js/wn/misc/number_format.js Visa fil

@@ -120,7 +120,7 @@ function get_currency_symbol(currency) {
if(!currency)
currency = wn.boot.sysdefaults.currency;

return wn.model.get_value("Currency", currency, "symbol") || currency;
return wn.model.get_value(":Currency", currency, "symbol") || currency;
} else {
// load in template
return wn.currency_symbols[currency];
@@ -161,5 +161,6 @@ function roundNumber(num, dec) {
function precision(fieldname, doc) {
if(!doc) doc = cur_frm.doc;
var df = wn.meta.get_docfield(doc.doctype, fieldname, doc.parent || doc.name);
if(!df) console.log(fieldname + ": could not find docfield in method precision()");
return wn.meta.get_field_precision(df, doc);
}

+ 1
- 1
public/js/wn/model/meta.js Visa fil

@@ -159,7 +159,7 @@ $.extend(wn.meta, {
get_field_precision: function(df, doc) {
var precision = wn.defaults.get_default("float_precision") || 6;
if(df.fieldtype === "Currency") {
if(df && df.fieldtype === "Currency") {
var currency = this.get_field_currency(df, doc);
var number_format = get_number_format(currency);
var number_format_info = get_number_format_info(number_format);


+ 2
- 1
webnotes/model/meta.py Visa fil

@@ -24,6 +24,7 @@

from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr
def get_dt_values(doctype, fields, as_dict = 0):
return webnotes.conn.sql('SELECT %s FROM tabDocType WHERE name="%s"' % (fields, doctype), as_dict = as_dict)
@@ -88,7 +89,7 @@ def get_field_currency(df, doc):
"""get currency based on DocField options and fieldvalue in doc"""
currency = None
if ":" in df.options:
if ":" in cstr(df.options):
split_opts = df.options.split(":")
if len(split_opts)==3:
currency = webnotes.conn.get_value(split_opts[0], doc.fields.get(split_opts[1]),


Laddar…
Avbryt
Spara