@@ -383,15 +383,28 @@ def reset_perms(context): | |||||
@click.command('execute') | @click.command('execute') | ||||
@click.argument('method') | @click.argument('method') | ||||
@click.option('--args') | |||||
@click.option('--kwargs') | |||||
@pass_context | @pass_context | ||||
def execute(context, method): | |||||
def execute(context, method, args=None, kwargs=None): | |||||
"execute a function" | "execute a function" | ||||
for site in context.sites: | for site in context.sites: | ||||
try: | try: | ||||
frappe.init(site=site) | frappe.init(site=site) | ||||
frappe.connect() | frappe.connect() | ||||
print frappe.local.site | print frappe.local.site | ||||
ret = frappe.get_attr(method)() | |||||
if args: | |||||
args = eval(args) | |||||
else: | |||||
args = () | |||||
if kwargs: | |||||
kwargs = eval(args) | |||||
else: | |||||
kwargs = {} | |||||
ret = frappe.get_attr(method)(*args, **kwargs) | |||||
if frappe.db: | if frappe.db: | ||||
frappe.db.commit() | frappe.db.commit() | ||||
@@ -32,6 +32,9 @@ frappe.ui.form.on("ToDo", { | |||||
frm.save(); | frm.save(); | ||||
}, null, "btn-default"); | }, null, "btn-default"); | ||||
} | } | ||||
frm.add_custom_button(__("New"), function() { | |||||
newdoc("ToDo") | |||||
}, null, "btn-default"); | |||||
} | } | ||||
} | } | ||||
}); | }); |
@@ -103,8 +103,8 @@ def notify_assignment(assigned_by, owner, doc_type, doc_name, action='CLOSE', | |||||
user_info = get_fullnames() | user_info = get_fullnames() | ||||
# Search for email address in description -- i.e. assignee | # Search for email address in description -- i.e. assignee | ||||
from frappe.utils import get_url_to_form | |||||
assignment = get_url_to_form(doc_type, doc_name, label="%s: %s" % (doc_type, doc_name)) | |||||
from frappe.utils import get_link_to_form | |||||
assignment = get_link_to_form(doc_type, doc_name, label="%s: %s" % (doc_type, doc_name)) | |||||
owner_name = user_info.get(owner, {}).get('fullname') | owner_name = user_info.get(owner, {}).get('fullname') | ||||
user_name = user_info.get(frappe.session.get('user'), {}).get('fullname') | user_name = user_info.get(frappe.session.get('user'), {}).get('fullname') | ||||
if action=='CLOSE': | if action=='CLOSE': | ||||
@@ -82,7 +82,7 @@ frappe.views.Gantt = frappe.views.CalendarBase.extend({ | |||||
gantt_area.gantt({ | gantt_area.gantt({ | ||||
source: me.get_source(r), | source: me.get_source(r), | ||||
navigate: "scroll", | navigate: "scroll", | ||||
scale: "days", | |||||
scale: me.gantt_scale || "days", | |||||
minScale: "hours", | minScale: "hours", | ||||
maxScale: "months", | maxScale: "months", | ||||
itemsPerPage: 20, | itemsPerPage: 20, | ||||
@@ -538,10 +538,16 @@ def get_url(uri=None, full_address=False): | |||||
def get_host_name(): | def get_host_name(): | ||||
return get_url().rsplit("//", 1)[-1] | return get_url().rsplit("//", 1)[-1] | ||||
def get_url_to_form(doctype, name, label=None): | |||||
def get_link_to_form(doctype, name, label=None): | |||||
if not label: label = name | if not label: label = name | ||||
return """<a href="/desk#!Form/%(doctype)s/%(name)s">%(label)s</a>""" % locals() | |||||
return """<a href="{0}">{1}</a>""".format(get_url_to_form(doctype, name), label) | |||||
def get_url_to_form(doctype, name): | |||||
return get_url(uri = "desk/#Form/{0}/{1}".format(doctype, name)) | |||||
def get_url_to_list(doctype): | |||||
return get_url(uri = "desk/#List/{0}".format(doctype)) | |||||
operator_map = { | operator_map = { | ||||
# startswith | # startswith | ||||