Merge branch 'master' of github.com:webnotes/wnframework
This commit is contained in:
commit
8d83d47a14
2 changed files with 25 additions and 13 deletions
|
|
@ -53,7 +53,7 @@ _f.Frm = function(doctype, parent, in_form) {
|
|||
this.docname = '';
|
||||
this.doctype = doctype;
|
||||
this.display = 0;
|
||||
this.refresh_if_stale_for = 600;
|
||||
this.refresh_if_stale_for = 120;
|
||||
|
||||
var me = this;
|
||||
this.last_view_is_edit = {};
|
||||
|
|
@ -881,16 +881,31 @@ _f.Frm.prototype.reload_doc = function() {
|
|||
var me = this;
|
||||
var onsave = function(r, rtxt) {
|
||||
// n tweets and last comment
|
||||
me.runclientscript('setup', me.doctype, me.docname);
|
||||
//me.runclientscript('setup', me.doctype, me.docname);
|
||||
me.refresh();
|
||||
}
|
||||
|
||||
if(me.doc.__islocal) {
|
||||
// reload only doctype
|
||||
$c('webnotes.widgets.form.load.getdoctype', {'doctype':me.doctype }, onsave, null, null, 'Refreshing ' + me.doctype + '...');
|
||||
wn.call({
|
||||
method: "webnotes.widgets.form.load.getdoctype",
|
||||
args: {
|
||||
doctype: me.doctype
|
||||
},
|
||||
callback: function(r) {
|
||||
me.refresh();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// reload doc and docytpe
|
||||
$c('webnotes.widgets.form.load.getdoc', {'name':me.docname, 'doctype':me.doctype, 'getdoctype':1, 'user':user}, onsave, null, null, 'Refreshing ' + me.docname + '...');
|
||||
wn.call({
|
||||
method: "webnotes.widgets.form.load.getdoc",
|
||||
args: {
|
||||
doctype: me.doctype,
|
||||
name: me.docname
|
||||
},
|
||||
callback: function(r) {
|
||||
me.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import webnotes.model.doc
|
|||
import webnotes.utils
|
||||
|
||||
@webnotes.whitelist()
|
||||
def getdoc():
|
||||
def getdoc(doctype, name, user=None):
|
||||
"""
|
||||
Loads a doclist for a given document. This method is called directly from the client.
|
||||
Requries "doctype", "name" as form variables.
|
||||
|
|
@ -35,18 +35,15 @@ def getdoc():
|
|||
|
||||
import webnotes
|
||||
|
||||
form = webnotes.form_dict
|
||||
doctype, docname = form.get('doctype'), form.get('name')
|
||||
|
||||
if not (doctype and docname):
|
||||
if not (doctype and name):
|
||||
raise Exception, 'doctype and name required!'
|
||||
|
||||
doclist = []
|
||||
# single
|
||||
doclist = load_single_doc(doctype, docname, (form.get('user') or webnotes.session['user']))
|
||||
doclist = load_single_doc(doctype, name, user or webnotes.session.user)
|
||||
|
||||
# load doctype along with the doc
|
||||
if form.get('getdoctype'):
|
||||
if webnotes.form_dict.get('getdoctype'):
|
||||
import webnotes.model.doctype
|
||||
doclist += webnotes.model.doctype.get(doctype, processed=True)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue