in new doc, convert defaults if type in Int, Check, Currency, Float

This commit is contained in:
Anand Doshi 2013-02-19 16:50:01 +05:30
parent c5a0fda30b
commit b6dd274f3f

View file

@ -40,6 +40,11 @@ $.extend(wn.model, {
if(!in_list(no_value_fields, f.fieldtype) && doc[f.fieldname]==null) {
var v = wn.model.get_default_value(f);
if(v) {
if(in_list(["Int", "Check"], f.fieldtype))
v = cint(v);
else if(in_list(["Currency", "Float"], f.fieldtype))
v = flt(v);
doc[f.fieldname] = v;
updated.push(f.fieldname);
}