浏览代码

[float precision] load float precision from defaults

version-14
Anand Doshi 12 年前
父节点
当前提交
4cf24c33c6
共有 1 个文件被更改,包括 4 次插入7 次删除
  1. +4
    -7
      webnotes/model/doctype.py

+ 4
- 7
webnotes/model/doctype.py 查看文件

@@ -33,11 +33,11 @@ Get metadata (main doctype with fields and permissions with all table doctypes)
from __future__ import unicode_literals from __future__ import unicode_literals


# imports # imports
import conf
import webnotes import webnotes
import webnotes.model import webnotes.model
import webnotes.model.doc import webnotes.model.doc
import webnotes.model.doclist import webnotes.model.doclist
from webnotes.utils import cint


doctype_cache = {} doctype_cache = {}
docfield_types = None docfield_types = None
@@ -210,7 +210,6 @@ def from_cache(doctype, processed):


doclist = webnotes.cache().get_value(cache_name(doctype, processed)) doclist = webnotes.cache().get_value(cache_name(doctype, processed))
if doclist: if doclist:
import json
from webnotes.model.doclist import DocList from webnotes.model.doclist import DocList
doclist = DocList([webnotes.model.doc.Document(fielddata=d) doclist = DocList([webnotes.model.doc.Document(fielddata=d)
for d in doclist]) for d in doclist])
@@ -219,9 +218,7 @@ def from_cache(doctype, processed):


def to_cache(doctype, processed, doclist): def to_cache(doctype, processed, doclist):
global doctype_cache global doctype_cache
import json
from webnotes.handler import json_handler

webnotes.cache().set_value(cache_name(doctype, processed), webnotes.cache().set_value(cache_name(doctype, processed),
[d.fields for d in doclist]) [d.fields for d in doclist])


@@ -259,7 +256,7 @@ def clear_cache(doctype=None):
clear_single(dt[0]) clear_single(dt[0])


def add_code(doctype, doclist): def add_code(doctype, doclist):
import os, conf
import os
from webnotes.modules import scrub, get_module_path from webnotes.modules import scrub, get_module_path
doc = doclist[0] doc = doclist[0]
@@ -373,7 +370,7 @@ def update_language(doclist):
def add_precision(doctype, doclist): def add_precision(doctype, doclist):
type_precision_map = { type_precision_map = {
"Currency": 2, "Currency": 2,
"Float": 6
"Float": cint(webnotes.conn.get_default("float_precision")) or 6
} }
for df in doclist.get({"doctype": "DocField", for df in doclist.get({"doctype": "DocField",
"fieldtype": ["in", type_precision_map.keys()]}): "fieldtype": ["in", type_precision_map.keys()]}):


正在加载...
取消
保存