浏览代码

[minor] [fixes

]
version-14
Rushabh Mehta 9 年前
父节点
当前提交
0a5c6a3e79
共有 6 个文件被更改,包括 15 次插入7 次删除
  1. +4
    -1
      frappe/public/js/frappe/form/document_flow.js
  2. +1
    -0
      frappe/public/js/frappe/list/doclistview.js
  3. +1
    -1
      frappe/public/js/legacy/form.js
  4. +2
    -2
      frappe/utils/data.py
  5. +7
    -2
      frappe/utils/make_random.py
  6. +0
    -1
      frappe/utils/setup_docs.py

+ 4
- 1
frappe/public/js/frappe/form/document_flow.js 查看文件

@@ -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")


+ 1
- 0
frappe/public/js/frappe/list/doclistview.js 查看文件

@@ -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) {


+ 1
- 1
frappe/public/js/legacy/form.js 查看文件

@@ -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() {


+ 2
- 2
frappe/utils/data.py 查看文件

@@ -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)


+ 7
- 2
frappe/utils/make_random.py 查看文件

@@ -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"]


+ 0
- 1
frappe/utils/setup_docs.py 查看文件

@@ -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




正在加载...
取消
保存