fix to modules & js+css in doctype

This commit is contained in:
Rushabh Mehta 2011-07-27 18:13:56 +05:30
parent ba9262c0b7
commit c5a0e909b0
2 changed files with 12 additions and 2 deletions

View file

@ -263,8 +263,13 @@ class _DocType:
doclist = self._load_from_cache()
from webnotes.modules import Module
# add custom script if present
from webnotes.model.code import get_custom_script
custom = get_custom_script(dt, 'Client') or ''
doc = doclist[0]
doc.fields['__js'] = Module(doc.module).get_doc_file('doctype', doc.name, '.js').read()
doc.fields['__js'] = Module(doc.module).get_doc_file('doctype', doc.name, '.js').read() + custom
doc.fields['__css'] = Module(doc.module).get_doc_file('doctype', doc.name, '.css').read()
self._load_select_options(doclist)
self._clear_code(doclist)

View file

@ -305,6 +305,7 @@ class JsModuleFile(ModuleFile):
"""
name = match.group('name')
custom = ''
import webnotes.defs, os
if os.path.sep in name:
@ -313,8 +314,12 @@ class JsModuleFile(ModuleFile):
else:
# its a doctype
path = os.path.join(get_doc_path('DocType', name), scrub(name) + '.js')
# add custom script if present
from webnotes.model.code import get_custom_script
custom = get_custom_script(dt, 'Client') or ''
return JsModuleFile(path).read()
return JsModuleFile(path).read() + custom
def read(self):
"""