瀏覽代碼

Merge branch 'master' of git://github.com/rmehta/wnframework

version-14
nabinhait 14 年之前
父節點
當前提交
178219d359
共有 4 個檔案被更改,包括 20 行新增6 行删除
  1. +9
    -1
      cgi-bin/webnotes/model/meta.py
  2. +2
    -2
      cgi-bin/webnotes/model/utils.py
  3. +1
    -1
      cgi-bin/webnotes/modules/export_module.py
  4. +8
    -2
      cgi-bin/webnotes/modules/import_module.py

+ 9
- 1
cgi-bin/webnotes/model/meta.py 查看文件

@@ -30,7 +30,15 @@ def set_fieldname(field_id, fieldname):
#=================================================================================

def get_link_fields(doctype):
return webnotes.conn.sql("SELECT fieldname, options, label FROM tabDocField WHERE parent='%s' and (fieldtype='Link' or (fieldtype='Select' and `options` like 'link:%%'))" % (doctype))
"""
Returns list of link fields for a doctype in tuple (fieldname, options, label)
"""
return webnotes.conn.sql("""
SELECT fieldname, options, label
FROM tabDocField
WHERE parent='%s'
and (fieldtype='Link' or (fieldtype='Select' and `options` like 'link:%%'))
and fieldname!='owner'""" % (doctype))

#=================================================================================



+ 2
- 2
cgi-bin/webnotes/model/utils.py 查看文件

@@ -168,7 +168,7 @@ def to_html(doclist):
return out

def commonify_doclist(doclist):
def commonify_doclist(doclist, with_comments=1):
"""
Makes a doclist more readable by extracting common properties.
This is used for printing Documents in files
@@ -239,7 +239,7 @@ def uncommonify_doclist(dl):
final = []

for d in dl[1:]:
if d['name']=='__common__':
if 'name' in d and d['name']=='__common__':
del d['name']
common_dict[d['doctype']] = d
else:


+ 1
- 1
cgi-bin/webnotes/modules/export_module.py 查看文件

@@ -69,7 +69,7 @@ def write_document_file(doclist, record_module=None):
Write a doclist to file, can optionally specify module name
"""
import os
from webnotes.utils import pprint_doclist
from webnotes.model.utils import pprint_doclist

module = get_module_name(doclist, record_module)



+ 8
- 2
cgi-bin/webnotes/modules/import_module.py 查看文件

@@ -37,14 +37,20 @@ def import_module(module, verbose=0):
def get_doclist(path, doctype, docname):
"returns a doclist (list of dictionaries) of multiple records for the given parameters"
import os
from webnotes.utils import peval_doclist
from webnotes.model.utils import peval_doclist
do_not_import = ('control_panel')
fname = os.path.join(path,doctype,docname,docname+'.txt')
if os.path.exists(fname) and (doctype not in do_not_import):
f = open(fname,'r')
dl = peval_doclist(f.read())
txt = f.read()
# if exported using pprint_doclist, then file starts with a comment
if txt.startswith('#'):
dl = peval_doclist(txt)
else:
dl = eval(txt)
f.close()
return dl
else:


Loading…
取消
儲存