diff --git a/public/js/wn/views/communication.js b/public/js/wn/views/communication.js index 06c615bdc8..1fadb3c13a 100644 --- a/public/js/wn/views/communication.js +++ b/public/js/wn/views/communication.js @@ -10,10 +10,9 @@ wn.views.CommunicationList = Class.extend({ return; } - var sortfn = function (a, b) { return new Date(a.modified) > new Date(b.modified) - ? -1 : 1} + var sortfn = function (a, b) { return (b > a) ? 1 : -1; } this.list = this.list.sort(sortfn); - + this.make(); }, make: function() { diff --git a/webnotes/model/wrapper.py b/webnotes/model/wrapper.py index 1af9480a4a..1e59dfdd28 100644 --- a/webnotes/model/wrapper.py +++ b/webnotes/model/wrapper.py @@ -118,6 +118,9 @@ class ModelWrapper: SELECT modified FROM `tab%s` WHERE name="%s" for update""" % (self.doc.doctype, self.doc.name)) + if not tmp: + webnotes.msgprint("""This record does not exist. Please refresh.""", raise_exception=1) + if tmp and str(tmp[0][0]) != str(self.doc.modified): webnotes.msgprint(""" Document has been modified after you have opened it.