Merge branch 'master' into edge
This commit is contained in:
commit
489cf52887
3 changed files with 15 additions and 7 deletions
|
|
@ -129,7 +129,7 @@ def get_template():
|
|||
webnotes.response['doctype'] = doctype
|
||||
|
||||
def getdocfield(fieldname):
|
||||
"""get docfield from doclist of doctype"""
|
||||
"""get docfield from doclist of doctype"""
|
||||
l = [d for d in doctype_dl if d.doctype=='DocField' and d.fieldname==fieldname]
|
||||
return l and l[0] or None
|
||||
|
||||
|
|
@ -256,6 +256,10 @@ def check_record(d, parenttype):
|
|||
if parenttype and not d.get('parent'):
|
||||
raise Exception, "parent is required."
|
||||
|
||||
global doctype_dl
|
||||
if not doctype_dl:
|
||||
doctype_dl = webnotes.model.doctype.get(d.doctype)
|
||||
|
||||
for key in d:
|
||||
docfield = getdocfield(key)
|
||||
val = d[key]
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ function flt(v, decimals) {
|
|||
}
|
||||
|
||||
// strip groups (,)
|
||||
if(wn.number_format_info[get_number_format()].group_sep==".") {
|
||||
if(get_number_format_info(get_number_format()).group_sep==".") {
|
||||
v = v.replace(/\./g,'');
|
||||
|
||||
// sanitize decimal separator to .
|
||||
|
|
|
|||
|
|
@ -12,14 +12,10 @@ wn.number_format_info = {
|
|||
}
|
||||
|
||||
window.format_number = function(v, format, decimals){
|
||||
|
||||
if (!format) {
|
||||
format = get_number_format();
|
||||
}
|
||||
var info = wn.number_format_info[format];
|
||||
if(!info) {
|
||||
info = {decimal_str:".", group_sep:",", precision:2};
|
||||
}
|
||||
info = get_number_format_info(format);
|
||||
|
||||
if(isNaN(+v) || v==null) {
|
||||
v=0;
|
||||
|
|
@ -105,4 +101,12 @@ function get_number_format() {
|
|||
|| "#,###.##";
|
||||
}
|
||||
return global_number_format;
|
||||
}
|
||||
|
||||
function get_number_format_info(format) {
|
||||
var info = wn.number_format_info[format];
|
||||
if(!info) {
|
||||
info = {decimal_str:".", group_sep:",", precision:2};
|
||||
}
|
||||
return info;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue