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,31 +17,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes
def scrub_page_name(page_name):
if page_name.endswith('.html'):
page_name = page_name[:-5]
return page_name
def make_template(doc, path, convert_fields = ['main_section', 'side_section']):
"""make template"""
import os, jinja2
markdown(doc, convert_fields)
# write template
with open(path, 'r') as f:
temp = jinja2.Template(f.read())
return temp.render(doc = doc.fields)
def page_name(title):
"""make page name from title"""
import re
name = title.lower()
name = re.sub('[~!@#$%^&*()<>,."\']', '', name)
return '-'.join(name.split()[:4])
def render(page_name): def render(page_name):
"""render html page""" """render html page"""
import webnotes import webnotes
@ -75,3 +50,28 @@ def get_comments(page_name):
comments = """page: %s""" % page_name comments = """page: %s""" % page_name
return comments return comments
def scrub_page_name(page_name):
if page_name.endswith('.html'):
page_name = page_name[:-5]
return page_name
def make_template(doc, path, convert_fields = ['main_section', 'side_section']):
"""make template"""
import os, jinja2
markdown(doc, convert_fields)
# write template
with open(path, 'r') as f:
temp = jinja2.Template(f.read())
return temp.render(doc = doc.fields)
def page_name(title):
"""make page name from title"""
import re
name = title.lower()
name = re.sub('[~!@#$%^&*()<>,."\']', '', name)
return '-'.join(name.split()[:4])

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)