[model] [with doc] get doclist from server if docinfo is missing

This commit is contained in:
Anand Doshi 2013-06-12 16:24:06 +05:30
parent f1f2a7b740
commit 7d0180e64b

View file

@ -103,7 +103,7 @@ $.extend(wn.model, {
with_doc: function(doctype, name, callback) {
if(!name) name = doctype; // single type
if(locals[doctype] && locals[doctype][name]) {
if(locals[doctype] && locals[doctype][name] && wn.model.get_docinfo(doctype, name)) {
callback(name);
} else {
wn.call({
@ -118,6 +118,10 @@ $.extend(wn.model, {
}
},
get_docinfo: function(doctype, name) {
return wn.model.docinfo[doctype] && wn.model.docinfo[doctype][name] || null;
},
get_server_module_name: function(doctype) {
var dt = wn.model.scrub(doctype)
return wn.model.scrub(locals.DocType[doctype].module)