fixes in assign to url

This commit is contained in:
Anand Doshi 2013-02-14 13:36:41 +05:30
parent ea43fb7daf
commit bcb3382f4f
2 changed files with 14 additions and 9 deletions

View file

@ -780,3 +780,15 @@ def get_base_path():
import conf
import os
return os.path.dirname(os.path.abspath(conf.__file__))
def get_url_to_form(doctype, name, base_url=None, label=None):
if not base_url:
try:
from startup import get_url
base_url = get_url()
except ImportError:
base_url = get_request_site_address()
if not label: label = name
return """<a href="%(base_url)s/app.html#!Form/%(doctype)s/%(name)s">%(label)s</a>""" % locals()

View file

@ -111,15 +111,8 @@ def notify_assignment(assigned_by, owner, doc_type, doc_name, action='CLOSE', no
user_info = get_fullnames()
# Search for email address in description -- i.e. assignee
try:
from startup import get_url
url = get_url()
except ImportError:
from webnotes.utils import get_request_site_address
url = get_request_site_address()
assignment = """<a href="%s/app.html#!Form/%s/%s">%s: %s</a>""" % (url,
doc_type, doc_name, doc_type, doc_name)
from webnotes.utils import get_url_to_form
assignment = get_url_to_form(doc_type, doc_name, label="%s: %s" % (doc_type, doc_name))
if action=='CLOSE':
if owner == webnotes.session.get('user'):