Merge branch 'develop'

This commit is contained in:
Anand Doshi 2015-08-21 12:58:10 +05:30
commit f19a0e2a9e
13 changed files with 27 additions and 14 deletions

View file

@ -89,6 +89,7 @@ def init(site, sites_path=None):
local.error_log = []
local.message_log = []
local.debug_log = []
local.realtime_log = []
local.flags = _dict({
"ran_schedulers": [],
"redirect_location": "",

View file

@ -1,2 +1,2 @@
from __future__ import unicode_literals
__version__ = "6.0.3"
__version__ = "6.0.4"

View file

@ -17,6 +17,7 @@ import frappe
import frappe.handler
import frappe.auth
import frappe.api
import frappe.async
import frappe.utils.response
import frappe.website.render
from frappe.utils import get_site_name, get_site_path
@ -122,6 +123,10 @@ def application(request):
if updated_in_db:
frappe.db.commit()
# publish realtime
for args in frappe.local.realtime_log:
frappe.async.emit_via_redis(*args)
finally:
if frappe.local.request.method in ("POST", "PUT") and frappe.db and rollback:
frappe.db.rollback()

View file

@ -120,7 +120,7 @@ def is_file_old(file_path):
return ((time.time() - os.stat(file_path).st_mtime) > TASK_LOG_MAX_AGE)
def publish_realtime(event, message=None, room=None, user=None, doctype=None, docname=None):
def publish_realtime(event, message=None, room=None, user=None, doctype=None, docname=None, now=False):
"""Publish real-time updates
:param event: Event name, like `task_progress` etc.
@ -140,7 +140,10 @@ def publish_realtime(event, message=None, room=None, user=None, doctype=None, do
else:
room = get_site_room()
emit_via_redis(event, message, room)
if now:
emit_via_redis(event, message, room)
else:
frappe.local.realtime_log.append([event, message, room])
def emit_via_redis(event, message, room):
"""Publish real-time updates via redis

View file

@ -26,7 +26,7 @@ to ERPNext.
"""
app_icon = "octicon octicon-circuit-board"
app_version = "6.0.3"
app_version = "6.0.4"
app_color = "orange"
github_link = "https://github.com/frappe/frappe"

View file

@ -579,7 +579,7 @@ class Document(BaseDocument):
def notify_modified(self):
"""Publish realtime that the current document is modified"""
frappe.publish_realtime("doc_update", {"modified_by": frappe.session.user, "doctype": self.doctype, "name": self.name},
frappe.publish_realtime("doc_update", {"modified": self.modified, "doctype": self.doctype, "name": self.name},
doctype=self.doctype, docname=self.name)
if not self.meta.get("read_only") and not self.meta.get("issingle") and \

View file

@ -165,6 +165,7 @@ select.form-control {
font-size: 12px;
background-color: #fffce7;
margin-bottom: 0px;
margin: 0px -15px;
}
.delivery-status-indicator {
display: inline-block;

View file

@ -39,20 +39,20 @@ frappe.ui.form.save = function(frm, action, callback, btn) {
var cancel = function() {
var args = {
doctype: frm.doc.doctype,
doctype: frm.doc.doctype,
name: frm.doc.name
};
// update workflow state value if workflow exists
var workflow_state_fieldname = frappe.workflow.get_state_fieldname(frm.doctype);
if(workflow_state_fieldname) {
$.extend(args, {
workflow_state_fieldname: workflow_state_fieldname,
workflow_state: frm.doc[workflow_state_fieldname]
});
}
_call({
method: "frappe.desk.form.save.cancel",
args: args,

View file

@ -43,7 +43,7 @@ $.extend(frappe.model, {
if(doc) {
// current document is dirty, show message if its not me
if(cur_frm.doc.doctype===doc.doctype && cur_frm.doc.name===doc.name) {
if(data.modified_by!==user) {
if(!frappe.ui.form.is_saving && data.modified!=cur_frm.doc.modified) {
doc.__needs_refresh = true;
cur_frm.show_if_needs_refresh();
}

View file

@ -28,14 +28,14 @@ frappe.call = function(opts) {
args.cmd = opts.method;
}
var callback = function(data, xhr) {
var callback = function(data, response_text) {
if(data.task_id) {
// async call, subscribe
frappe.socket.subscribe(data.task_id, opts);
}
else {
else if (opts.callback) {
// ajax
return opts.callback(data, xhr);
return opts.callback(data, response_text);
}
}

View file

@ -317,6 +317,8 @@ _f.Frm.prototype.refresh_header = function(is_a_different_doc) {
this.toolbar.refresh();
}
this.dashboard.reset();
this.clear_custom_buttons();
this.show_web_link();

View file

@ -214,6 +214,7 @@ select.form-control {
font-size: @text-medium;
background-color: @light-yellow;
margin-bottom: 0px;
margin: 0px -15px;
}
.delivery-status-indicator {

View file

@ -1,6 +1,6 @@
from setuptools import setup, find_packages
version = "6.0.3"
version = "6.0.4"
with open("requirements.txt", "r") as f:
install_requires = f.readlines()