Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Rushabh Mehta 2012-12-06 10:30:54 +01:00
commit 9f8efba801
4 changed files with 42 additions and 41 deletions

View File

@ -902,7 +902,7 @@ def assign_task_to_owner(inv, msg, users):
def get_bank_cash_account(mode_of_payment): def get_bank_cash_account(mode_of_payment):
val = webnotes.conn.get_value("Mode of Payment", mode_of_payment, "default_account") val = webnotes.conn.get_value("Mode of Payment", mode_of_payment, "default_account")
if not val: if not val:
webnotes.msgprint("Default Account not set in Mode of Payment: %s" % mode_of_payment) webnotes.msgprint("Default Bank / Cash Account not set in Mode of Payment: %s. Please add a Default Account in Mode of Payment master." % mode_of_payment)
return { return {
"cash_bank_account": val "cash_bank_account": val
} }

View File

@ -128,13 +128,11 @@ erpnext.AccountsChart = Class.extend({
var node_links = []; var node_links = [];
// edit // edit
if (wn.boot.profile.can_read.indexOf(this.ctype) !== -1) { if (wn.model.can_read(this.ctype) !== -1) {
node_links.push('<a onclick="erpnext.account_chart.open();">Edit</a>'); node_links.push('<a onclick="erpnext.account_chart.open();">Edit</a>');
} }
if (data.expandable) { if (data.expandable) {
if(this.can_create) { node_links.push('<a onclick="erpnext.account_chart.new_node();">Add Child</a>');
node_links.push('<a onclick="erpnext.account_chart.new_node();">Add Child</a>');
}
} else if (this.ctype === 'Account' && wn.boot.profile.can_read.indexOf("GL Entry") !== -1) { } else if (this.ctype === 'Account' && wn.boot.profile.can_read.indexOf("GL Entry") !== -1) {
node_links.push('<a onclick="erpnext.account_chart.show_ledger();">View Ledger</a>'); node_links.push('<a onclick="erpnext.account_chart.show_ledger();">View Ledger</a>');
} }

View File

@ -17,6 +17,40 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes
def render(page_name):
"""render html page"""
import webnotes
try:
if page_name:
html = get_html(page_name)
else:
html = get_html('index')
except Exception, e:
html = get_html('404')
from webnotes.handler import eprint, print_zip
eprint("Content-Type: text/html")
print_zip(html)
def get_html(page_name):
"""get page html"""
page_name = scrub_page_name(page_name)
comments = get_comments(page_name)
import website.web_cache
html = website.web_cache.get_html(page_name, comments)
return html
def get_comments(page_name):
import webnotes
if page_name == '404':
comments = """error: %s""" % webnotes.getTraceback()
else:
comments = """page: %s""" % page_name
return comments
def scrub_page_name(page_name): def scrub_page_name(page_name):
if page_name.endswith('.html'): if page_name.endswith('.html'):
page_name = page_name[:-5] page_name = page_name[:-5]
@ -41,37 +75,3 @@ def page_name(title):
name = title.lower() name = title.lower()
name = re.sub('[~!@#$%^&*()<>,."\']', '', name) name = re.sub('[~!@#$%^&*()<>,."\']', '', name)
return '-'.join(name.split()[:4]) return '-'.join(name.split()[:4])
def render(page_name):
"""render html page"""
import webnotes
try:
if page_name:
html = get_html(page_name)
else:
html = get_html('index')
except Exception, e:
html = get_html('404')
from webnotes.handler import eprint, print_zip
eprint("Content-Type: text/html")
print_zip(html)
def get_html(page_name):
"""get page html"""
page_name = scrub_page_name(page_name)
comments = get_comments(page_name)
import website.web_cache
html = website.web_cache.get_html(page_name, comments)
return html
def get_comments(page_name):
import webnotes
if page_name == '404':
comments = """error: %s""" % webnotes.getTraceback()
else:
comments = """page: %s""" % page_name
return comments

View File

@ -31,6 +31,7 @@ def get_html(page_name, comments=''):
# load from cache, if auto cache clear is falsy # load from cache, if auto cache clear is falsy
if not (hasattr(conf, 'auto_cache_clear') and conf.auto_cache_clear or 0): if not (hasattr(conf, 'auto_cache_clear') and conf.auto_cache_clear or 0):
html = load_from_cache(page_name) html = load_from_cache(page_name)
comments += "\n\npage load status: from cache"
if not html: if not html:
html = load_into_cache(page_name) html = load_into_cache(page_name)
@ -82,7 +83,8 @@ def get_predefined_pages():
import conf import conf
import website.utils import website.utils
pages_path = os.path.join(os.path.dirname(conf.__file__), 'app', 'website', 'templates', 'pages') pages_path = os.path.join(os.path.dirname(conf.__file__), 'app',
'website', 'templates', 'pages')
page_list = [] page_list = []
@ -121,7 +123,8 @@ def get_home_page():
def get_doc_fields(page_name): def get_doc_fields(page_name):
import webnotes import webnotes
doc_type, doc_name = webnotes.conn.get_value('Web Cache', page_name, ['doc_type', 'doc_name']) doc_type, doc_name = webnotes.conn.get_value('Web Cache', page_name,
['doc_type', 'doc_name'])
import webnotes.model.code import webnotes.model.code
obj = webnotes.model.code.get_obj(doc_type, doc_name) obj = webnotes.model.code.get_obj(doc_type, doc_name)