@@ -63,7 +63,7 @@ frappe.ui.form.DocumentFlow = Class.extend({ | |||||
this.linked_with[for_doctype].show(); | this.linked_with[for_doctype].show(); | ||||
}, | }, | ||||
mark_completed_flow: function() { | mark_completed_flow: function() { | ||||
var me = this; | var me = this; | ||||
frappe.call({ | frappe.call({ | ||||
@@ -74,6 +74,9 @@ frappe.ui.form.DocumentFlow = Class.extend({ | |||||
frm_docname: me.frm.docname | frm_docname: me.frm.docname | ||||
}, | }, | ||||
callback: function(r){ | callback: function(r){ | ||||
if(!r.message) { | |||||
return; | |||||
} | |||||
$.each(me.doctypes, function(i, doctype) { | $.each(me.doctypes, function(i, doctype) { | ||||
if (r.message[doctype] && me.frm.doctype!=doctype) { | if (r.message[doctype] && me.frm.doctype!=doctype) { | ||||
me.wrapper.find("[data-doctype='"+doctype+"']a .indicator") | me.wrapper.find("[data-doctype='"+doctype+"']a .indicator") | ||||
@@ -351,6 +351,7 @@ frappe.views.DocListView = frappe.ui.Listing.extend({ | |||||
doctype = d.options; | doctype = d.options; | ||||
return false; | return false; | ||||
} | } | ||||
return true; | |||||
}); | }); | ||||
if(!doctype) { | if(!doctype) { | ||||
@@ -365,7 +365,7 @@ _f.Frm.prototype.show_web_link = function() { | |||||
_f.Frm.prototype.add_web_link = function(path) { | _f.Frm.prototype.add_web_link = function(path) { | ||||
this.web_link = this.sidebar.add_user_action("See on Website", | this.web_link = this.sidebar.add_user_action("See on Website", | ||||
function() {}).attr("href", this.doc.route).attr("target", "_blank"); | |||||
function() {}).attr("href", path || this.doc.route).attr("target", "_blank"); | |||||
} | } | ||||
_f.Frm.prototype.check_doc_perm = function() { | _f.Frm.prototype.check_doc_perm = function() { | ||||
@@ -133,8 +133,8 @@ def convert_utc_to_user_timezone(utc_timestamp): | |||||
def now(): | def now(): | ||||
"""return current datetime as yyyy-mm-dd hh:mm:ss""" | """return current datetime as yyyy-mm-dd hh:mm:ss""" | ||||
if getattr(frappe.local, "current_date", None): | |||||
return getdate(frappe.local.current_date).strftime(DATE_FORMAT) + " " + \ | |||||
if frappe.flags.current_date: | |||||
return getdate(frappe.flags.current_date).strftime(DATE_FORMAT) + " " + \ | |||||
now_datetime().strftime(TIME_FORMAT) | now_datetime().strftime(TIME_FORMAT) | ||||
else: | else: | ||||
return now_datetime().strftime(DATETIME_FORMAT) | return now_datetime().strftime(DATETIME_FORMAT) | ||||
@@ -25,7 +25,7 @@ def add_random_children(doc, fieldname, rows, randomize, unique=None): | |||||
else: | else: | ||||
doc.append(fieldname, d) | doc.append(fieldname, d) | ||||
def get_random(doctype, filters=None): | |||||
def get_random(doctype, filters=None, doc=False): | |||||
condition = [] | condition = [] | ||||
if filters: | if filters: | ||||
for key, val in filters.items(): | for key, val in filters.items(): | ||||
@@ -38,7 +38,12 @@ def get_random(doctype, filters=None): | |||||
out = frappe.db.sql("""select name from `tab%s` %s | out = frappe.db.sql("""select name from `tab%s` %s | ||||
order by RAND() limit 0,1""" % (doctype, condition)) | order by RAND() limit 0,1""" % (doctype, condition)) | ||||
return out and out[0][0] or None | |||||
out = out and out[0][0] or None | |||||
if doc and out: | |||||
return frappe.get_doc(doctype, out) | |||||
else: | |||||
return out | |||||
def can_make(doctype): | def can_make(doctype): | ||||
return random.random() < settings.prob.get(doctype, settings.prob["default"])["make"] | return random.random() < settings.prob.get(doctype, settings.prob["default"])["make"] | ||||
@@ -7,7 +7,6 @@ Call from command line: | |||||
""" | """ | ||||
import os, json, frappe, shutil, re | import os, json, frappe, shutil, re | ||||
import frappe.website.statics | |||||
from frappe.website.context import get_context | from frappe.website.context import get_context | ||||
from frappe.utils import markdown | from frappe.utils import markdown | ||||