Merge branch 'master' of github.com:webnotes/wnframework
This commit is contained in:
commit
e745a17e9c
45 changed files with 101 additions and 110 deletions
|
|
@ -36,7 +36,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
|||
|
||||
cur_frm.cscript.contact = function(doc, dt, dn) {
|
||||
if (doc.contact) {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'support.doctype.communication.communication.get_customer_supplier',
|
||||
args: {
|
||||
contact: doc.contact
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ cur_frm.cscript.dt = function(doc, dt, dn) {
|
|||
set_field_options('insert_after', '');
|
||||
return;
|
||||
}
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'core.doctype.custom_field.custom_field.get_fields_label',
|
||||
args: { doctype: doc.dt, fieldname: doc.fieldname },
|
||||
callback: function(r, rt) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ $(cur_frm.wrapper).on("grid-row-render", function(e, grid_row) {
|
|||
})
|
||||
|
||||
cur_frm.cscript.doc_type = function(doc, dt, dn) {
|
||||
cur_frm.call({
|
||||
return cur_frm.call({
|
||||
method: "get",
|
||||
doc: cur_frm.doc,
|
||||
callback: function(r) {
|
||||
|
|
@ -58,7 +58,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
|||
|
||||
cur_frm.add_custom_button('Update', function() {
|
||||
if(cur_frm.doc.doc_type) {
|
||||
cur_frm.call({
|
||||
return cur_frm.call({
|
||||
doc: cur_frm.doc,
|
||||
method: "post",
|
||||
callback: function(r) {
|
||||
|
|
@ -129,7 +129,7 @@ cur_frm.confirm = function(msg, doc, dt, dn) {
|
|||
$y(button_wrapper, {paddingTop: '15px'});
|
||||
|
||||
var proceed_btn = $btn(button_wrapper, 'Proceed', function() {
|
||||
cur_frm.call({
|
||||
return cur_frm.call({
|
||||
doc: cur_frm.doc,
|
||||
method: "delete",
|
||||
callback: function(r) {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ wn.docs.generate_all = function(logarea) {
|
|||
|
||||
logarea.empty().append("Downloading server docs...<br>");
|
||||
|
||||
wn.call({
|
||||
return wn.call({
|
||||
"method": "core.doctype.documentation_tool.documentation_tool.get_docs",
|
||||
args: {options: cur_frm.doc},
|
||||
callback: function(r) {
|
||||
|
|
@ -86,7 +86,7 @@ wn.docs.generate_all = function(logarea) {
|
|||
make_page("docs");
|
||||
|
||||
logarea.append("Writing...<br>");
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: "core.doctype.documentation_tool.documentation_tool.write_docs",
|
||||
args: {
|
||||
data: JSON.stringify(wn.docs.to_write),
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ wn.RoleEditor = Class.extend({
|
|||
var me = this;
|
||||
this.wrapper = wrapper;
|
||||
$(wrapper).html('<div class="help">Loading...</div>')
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method:'core.doctype.profile.profile.get_all_roles',
|
||||
callback: function(r) {
|
||||
me.roles = r.message;
|
||||
|
|
@ -174,7 +174,7 @@ wn.RoleEditor = Class.extend({
|
|||
if(!this.perm_dialog)
|
||||
this.make_perm_dialog()
|
||||
$(this.perm_dialog.body).empty();
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method:'core.doctype.profile.profile.get_perm_info',
|
||||
args: {role: role},
|
||||
callback: function(r) {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ wn.pages['data-import-tool'].onload = function(wrapper) {
|
|||
$('#dit-download').empty();
|
||||
|
||||
// get options
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method:'core.page.data_import_tool.data_import_tool.get_doctype_options',
|
||||
args: {doctype: val},
|
||||
callback: function(r) {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ erpnext.Messages = Class.extend({
|
|||
$('#post-message .btn').click(function() {
|
||||
var txt = $('#post-message textarea').val();
|
||||
if(txt) {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
module:'core',
|
||||
page:'messages',
|
||||
method:'post',
|
||||
|
|
@ -163,7 +163,7 @@ erpnext.Messages = Class.extend({
|
|||
},
|
||||
delete: function(ele) {
|
||||
$(ele).parent().css('opacity', 0.6);
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method:'core.page.messages.messages.delete',
|
||||
args: {name : $(ele).attr('data-name')},
|
||||
callback: function() {
|
||||
|
|
@ -173,7 +173,7 @@ erpnext.Messages = Class.extend({
|
|||
},
|
||||
show_active_users: function() {
|
||||
var me = this;
|
||||
wn.call({
|
||||
return wn.call({
|
||||
module:'core',
|
||||
page:'messages',
|
||||
method:'get_active_users',
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ wn.modules_setup = {
|
|||
ml.push($(this).attr('data-module'));
|
||||
});
|
||||
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'core.page.modules_setup.modules_setup.update',
|
||||
args: {
|
||||
ml: ml
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ wn.PermissionEngine = Class.extend({
|
|||
var me = this;
|
||||
|
||||
me.make_reset_button();
|
||||
wn.call({
|
||||
return wn.call({
|
||||
module:"core",
|
||||
page:"permission_manager",
|
||||
method: "get_roles_and_doctypes",
|
||||
|
|
@ -120,7 +120,7 @@ wn.PermissionEngine = Class.extend({
|
|||
var me = this;
|
||||
me.reset_button = me.wrapper.appframe.add_button("Reset Permissions", function() {
|
||||
if(wn.confirm("Reset Permissions for " + me.get_doctype() + "?", function() {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
module:"core",
|
||||
page:"permission_manager",
|
||||
method:"reset",
|
||||
|
|
@ -279,7 +279,7 @@ wn.PermissionEngine = Class.extend({
|
|||
.attr("data-name", d.name)
|
||||
.attr("data-doctype", d.parent)
|
||||
.click(function() {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
module: "core",
|
||||
page: "permission_manager",
|
||||
method: "remove",
|
||||
|
|
@ -307,7 +307,7 @@ wn.PermissionEngine = Class.extend({
|
|||
ptype: chk.attr("data-ptype"),
|
||||
value: chk.prop("checked") ? 1 : 0
|
||||
}
|
||||
wn.call({
|
||||
return wn.call({
|
||||
module: "core",
|
||||
page: "permission_manager",
|
||||
method: "update",
|
||||
|
|
@ -416,7 +416,7 @@ wn.PermissionEngine = Class.extend({
|
|||
.click(function() {
|
||||
var match_value = $(dialog.wrapper).find(":radio:checked").val();
|
||||
var perm = me.get_perm($(this).attr('data-name'))
|
||||
wn.call({
|
||||
return wn.call({
|
||||
module: "core",
|
||||
page: "permission_manager",
|
||||
method: "update_match",
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ wn.provide('erpnext.todo');
|
|||
|
||||
erpnext.todo.refresh = function() {
|
||||
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'core.page.todo.todo.get',
|
||||
callback: function(r,rt) {
|
||||
var todo_list = $('#todo-list div.todo-content');
|
||||
|
|
@ -172,7 +172,7 @@ erpnext.todo.save = function(btn) {
|
|||
}
|
||||
|
||||
det.name = d.det.name || '';
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method:'core.page.todo.todo.edit',
|
||||
args: det,
|
||||
btn: btn,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ wn.UpdateThisApp = Class.extend({
|
|||
</div> \
|
||||
<div>' + wn._("Update is in progress. This may take some time.") + '</div>');
|
||||
|
||||
wn.call({
|
||||
return wn.call({
|
||||
module: "core",
|
||||
page: "update_manager",
|
||||
method: "update_this_app",
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ wn.UserProperties = Class.extend({
|
|||
},
|
||||
make: function() {
|
||||
var me = this;
|
||||
wn.call({
|
||||
return wn.call({
|
||||
module:"core",
|
||||
page:"user_properties",
|
||||
method: "get_users_and_links",
|
||||
|
|
@ -101,7 +101,7 @@ wn.UserProperties = Class.extend({
|
|||
return;
|
||||
}
|
||||
// get permissions
|
||||
wn.call({
|
||||
return wn.call({
|
||||
module: "core",
|
||||
page: "user_properties",
|
||||
method: "get_properties",
|
||||
|
|
@ -147,7 +147,7 @@ wn.UserProperties = Class.extend({
|
|||
.attr("data-name", d.name)
|
||||
.attr("data-user", d.parent)
|
||||
.click(function() {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
module: "core",
|
||||
page: "user_properties",
|
||||
method: "remove",
|
||||
|
|
|
|||
|
|
@ -20,29 +20,9 @@
|
|||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
// Client Side Scripting API
|
||||
// ======================================================================================
|
||||
|
||||
$c_get_values = function(args, doc, dt, dn, user_callback) {
|
||||
var call_back = function(r,rt) {
|
||||
if(!r.message)return;
|
||||
if(user_callback) user_callback(r.message);
|
||||
|
||||
var fl = args.fields.split(',');
|
||||
for(var i in fl) {
|
||||
locals[dt][dn][fl[i]] = r.message[fl[i]]; // set value
|
||||
if(args.table_field)
|
||||
refresh_field(fl[i], dn, args.table_field);
|
||||
else
|
||||
refresh_field(fl[i]);
|
||||
}
|
||||
}
|
||||
$c('webnotes.widgets.form.utils.get_fields',args,call_back);
|
||||
}
|
||||
|
||||
get_server_fields = function(method, arg, table_field, doc, dt, dn, allow_edit, call_back) {
|
||||
wn.dom.freeze();
|
||||
$c('runserverobj',
|
||||
return $c('runserverobj',
|
||||
args={'method':method,
|
||||
'docs':wn.model.compress(make_doclist(doc.doctype, doc.name)),
|
||||
'arg':arg
|
||||
|
|
@ -205,7 +185,7 @@ _f.Frm.prototype.toggle_display = function(fnames, show) {
|
|||
}
|
||||
|
||||
_f.Frm.prototype.call_server = function(method, args, callback) {
|
||||
$c_obj(cur_frm.get_doclist(), method, args, callback);
|
||||
return $c_obj(cur_frm.get_doclist(), method, args, callback);
|
||||
}
|
||||
|
||||
_f.Frm.prototype.get_files = function() {
|
||||
|
|
@ -270,7 +250,7 @@ _f.Frm.prototype.call = function(opts) {
|
|||
}
|
||||
|
||||
}
|
||||
wn.call(opts);
|
||||
return wn.call(opts);
|
||||
}
|
||||
|
||||
_f.Frm.prototype.get_field = function(field) {
|
||||
|
|
|
|||
|
|
@ -611,7 +611,7 @@ _f.Frm.prototype.runscript = function(scriptname, callingfield, onrefresh) {
|
|||
if(callingfield)
|
||||
$(callingfield.input).set_working();
|
||||
|
||||
$c('runserverobj', {'docs':doclist, 'method':scriptname },
|
||||
return $c('runserverobj', {'docs':doclist, 'method':scriptname },
|
||||
function(r, rtxt) {
|
||||
// run refresh
|
||||
if(onrefresh)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
//
|
||||
|
||||
function $c(command, args, callback, error, no_spinner, freeze_msg, btn) {
|
||||
wn.request.call({
|
||||
return wn.request.call({
|
||||
args: $.extend(args, {cmd: command}),
|
||||
success: callback,
|
||||
error: error,
|
||||
|
|
@ -46,7 +46,7 @@ function $c_obj(doclist, method, arg, callback, no_spinner, freeze_msg, btn) {
|
|||
else
|
||||
args.docs = wn.model.compress(doclist)
|
||||
|
||||
wn.request.call({
|
||||
return wn.request.call({
|
||||
args: args,
|
||||
success: callback,
|
||||
btn: btn,
|
||||
|
|
@ -58,7 +58,7 @@ function $c_obj(doclist, method, arg, callback, no_spinner, freeze_msg, btn) {
|
|||
// For call a page metho
|
||||
function $c_page(module, page, method, arg, callback, no_spinner, freeze_msg, btn) {
|
||||
if(arg && typeof arg!='string') arg = JSON.stringify(arg);
|
||||
wn.request.call({
|
||||
return wn.request.call({
|
||||
args: {
|
||||
cmd: module+'.page.'+page+'.'+page+'.'+method,
|
||||
arg: arg,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ wn.Application = Class.extend({
|
|||
load_startup: function() {
|
||||
var me = this;
|
||||
if(window.app) {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'startup',
|
||||
callback: function(r, rt) {
|
||||
wn.provide('wn.boot');
|
||||
|
|
@ -109,7 +109,7 @@ wn.Application = Class.extend({
|
|||
|
||||
refresh_notifications: function() {
|
||||
if(wn.session_alive) {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: "webnotes.widgets.notification.get",
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
|
|
@ -175,7 +175,7 @@ wn.Application = Class.extend({
|
|||
logout: function() {
|
||||
var me = this;
|
||||
me.logged_out = true;
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method:'logout',
|
||||
callback: function(r) {
|
||||
if(r.exc) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ wn.defaults = {
|
|||
value = JSON.stringify(value);
|
||||
|
||||
wn.boot.profile.defaults[key] = value;
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: "webnotes.client.set_default",
|
||||
args: {
|
||||
key: key,
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ wn.ui.form.AssignTo = Class.extend({
|
|||
var assign_to = me.dialog.fields_dict.assign_to.get_value();
|
||||
var args = me.dialog.get_values();
|
||||
if(assign_to) {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method:'webnotes.widgets.form.assign_to.add',
|
||||
args: $.extend(args, {
|
||||
doctype: me.frm.doctype,
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ wn.ui.form.Attachments = Class.extend({
|
|||
wn.confirm(wn._("Are you sure you want to delete the attachment?"),
|
||||
function() {
|
||||
var data = $(remove_btn).data("fileid");
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'webnotes.widgets.form.utils.remove_attach',
|
||||
args: {
|
||||
fid: data,
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ wn.ui.form.Comments = Class.extend({
|
|||
comment_by: user
|
||||
};
|
||||
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: "webnotes.widgets.form.utils.add_comment",
|
||||
args: {
|
||||
doclist:[comment]
|
||||
|
|
@ -97,7 +97,7 @@ wn.ui.form.Comments = Class.extend({
|
|||
},
|
||||
delete_comment: function(name) {
|
||||
var me = this;
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: "webnotes.client.delete",
|
||||
args: {
|
||||
doctype: "Comment",
|
||||
|
|
|
|||
|
|
@ -619,7 +619,11 @@ wn.ui.form.ControlLink = wn.ui.form.ControlData.extend({
|
|||
//this.bind_change_event();
|
||||
var me = this;
|
||||
this.$input.on("blur", function() {
|
||||
if(me.doctype && me.docname && !me.autocomplete_open) {
|
||||
if(me.selected) {
|
||||
me.selected = false;
|
||||
return;
|
||||
}
|
||||
if(me.doctype && me.docname) {
|
||||
var value = me.get_value();
|
||||
if(value!==me.last_value) {
|
||||
me.parse_validate_and_set_in_model(value);
|
||||
|
|
@ -671,7 +675,7 @@ wn.ui.form.ControlLink = wn.ui.form.ControlData.extend({
|
|||
|
||||
me.set_custom_query(args);
|
||||
|
||||
wn.call({
|
||||
return wn.call({
|
||||
type: "GET",
|
||||
method:'webnotes.widgets.search.search_link',
|
||||
args: args,
|
||||
|
|
@ -693,6 +697,7 @@ wn.ui.form.ControlLink = wn.ui.form.ControlData.extend({
|
|||
select: function(event, ui) {
|
||||
me.autocomplete_open = false;
|
||||
if(me.frm && me.frm.doc) {
|
||||
me.selected = true;
|
||||
me.parse_validate_and_set_in_model(ui.item.value);
|
||||
} else {
|
||||
me.$input.val(ui.item.value);
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ wn.ui.form.InfoBar = Class.extend({
|
|||
},
|
||||
go_prev_next: function(prev) {
|
||||
var me = this;
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: "webnotes.widgets.form.utils.get_next",
|
||||
args: {
|
||||
doctype: me.frm.doctype,
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ wn.ui.form.LinkSelector = Class.extend({
|
|||
|
||||
this.target.set_custom_query(args);
|
||||
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: "webnotes.widgets.search.search_widget",
|
||||
type: "GET",
|
||||
args: args,
|
||||
|
|
|
|||
|
|
@ -6,13 +6,17 @@ wn.ui.form.ScriptManager = Class.extend({
|
|||
this.frm.cscript = $.extend(this.frm.cscript, new ControllerClass({frm: this.frm}));
|
||||
},
|
||||
trigger: function(event_name, doctype, name) {
|
||||
var me = this;
|
||||
doctype = doctype || this.frm.doctype;
|
||||
name = name || this.frm.docname;
|
||||
if(this.frm.cscript[event_name])
|
||||
this.frm.cscript[event_name](this.frm.doc, doctype, name);
|
||||
|
||||
if(this.frm.cscript["custom_" + event_name])
|
||||
if(this.frm.cscript[event_name]) {
|
||||
$.when(this.frm.cscript[event_name](this.frm.doc, doctype, name)).then(function() {
|
||||
if(me.frm.cscript["custom_" + event_name])
|
||||
me.frm.cscript["custom_" + event_name](me.frm.doc, doctype, name);
|
||||
});
|
||||
} else if(this.frm.cscript["custom_" + event_name]) {
|
||||
this.frm.cscript["custom_" + event_name](this.frm.doc, doctype, name);
|
||||
}
|
||||
},
|
||||
setup: function() {
|
||||
var doctype = this.frm.meta;
|
||||
|
|
@ -46,7 +50,7 @@ wn.ui.form.ScriptManager = Class.extend({
|
|||
if(this.frm && this.frm.fetch_dict[df.fieldname])
|
||||
fetch = this.frm.fetch_dict[df.fieldname].columns.join(', ');
|
||||
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method:'webnotes.widgets.form.utils.validate_link',
|
||||
type: "GET",
|
||||
args: {
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ $.extend(wn.model, {
|
|||
},
|
||||
|
||||
open_mapped_doc: function(opts) {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
type: "GET",
|
||||
method: opts.method,
|
||||
args: {
|
||||
|
|
@ -151,7 +151,7 @@ $.extend(wn.model, {
|
|||
}
|
||||
}
|
||||
var _map = function() {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
type: "GET",
|
||||
method: opts.method,
|
||||
args: {
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ wn.model.DocList = Class.extend({
|
|||
// btn: btn
|
||||
// }
|
||||
$(opts.btn).attr("disabled", true);
|
||||
wn.call({
|
||||
return wn.call({
|
||||
freeze: true,
|
||||
method: opts.method,
|
||||
args: opts.args,
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ $.extend(wn.model, {
|
|||
var cached_doclist = JSON.parse(localStorage["_doctype:" + doctype]);
|
||||
cached_timestamp = cached_doclist[0].modified;
|
||||
}
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method:'webnotes.widgets.form.load.getdoctype',
|
||||
type: "GET",
|
||||
args: {
|
||||
|
|
@ -106,7 +106,7 @@ $.extend(wn.model, {
|
|||
if(locals[doctype] && locals[doctype][name] && wn.model.get_docinfo(doctype, name)) {
|
||||
callback(name);
|
||||
} else {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'webnotes.widgets.form.load.getdoc',
|
||||
type: "GET",
|
||||
args: {
|
||||
|
|
@ -410,7 +410,7 @@ $.extend(wn.model, {
|
|||
|
||||
delete_doc: function(doctype, docname, callback) {
|
||||
wn.confirm("Permanently delete "+ docname + "?", function() {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'webnotes.model.delete_doc',
|
||||
args: {
|
||||
dt:doctype,
|
||||
|
|
@ -441,7 +441,7 @@ $.extend(wn.model, {
|
|||
var args = d.get_values();
|
||||
if(!args) return;
|
||||
d.get_input("rename").set_working();
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method:"webnotes.model.rename_doc.rename_doc",
|
||||
args: {
|
||||
doctype: doctype,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ wn.call = function(opts) {
|
|||
}
|
||||
}
|
||||
|
||||
wn.request.call({
|
||||
return wn.request.call({
|
||||
type: opts.type || "POST",
|
||||
args: args,
|
||||
success: opts.callback,
|
||||
|
|
@ -110,7 +110,7 @@ wn.request.call = function(opts) {
|
|||
})
|
||||
}
|
||||
|
||||
$.ajax(ajax_args);
|
||||
return $.ajax(ajax_args);
|
||||
}
|
||||
|
||||
// call execute serverside request
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ wn.ui.Listing = Class.extend({
|
|||
if(!me.opts.no_loading)
|
||||
me.set_working(true);
|
||||
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: this.opts.method || 'webnotes.widgets.query_builder.runquery',
|
||||
type: "GET",
|
||||
args: this.get_call_args(),
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@ wn.ui.TagEditor = Class.extend({
|
|||
placeholderText: 'Add Tag',
|
||||
onTagAdded: function(ev, tag) {
|
||||
if(me.initialized) {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'webnotes.widgets.tags.add_tag',
|
||||
args: me.get_args(tag.find('.tagit-label').text())
|
||||
});
|
||||
}
|
||||
},
|
||||
onTagRemoved: function(ev, tag) {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'webnotes.widgets.tags.remove_tag',
|
||||
args: me.get_args(tag.find('.tagit-label').text())
|
||||
});
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ wn.ui.toolbar.clear_cache = function() {
|
|||
|
||||
wn.ui.toolbar.download_backup = function() {
|
||||
msgprint(wn._("Your download is being built, this may take a few moments..."));
|
||||
$c('webnotes.utils.backups.get_backup',{},function(r,rt) {});
|
||||
return $c('webnotes.utils.backups.get_backup',{},function(r,rt) {});
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ wn.ui.TreeNode = Class.extend({
|
|||
|
||||
$(me.$a).set_working();
|
||||
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: this.tree.method,
|
||||
args: args,
|
||||
callback: function(r) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ wn.upload = {
|
|||
|
||||
var _upload_file = function() {
|
||||
var msgbox = msgprint(wn._("Uploading..."));
|
||||
wn.call({
|
||||
return wn.call({
|
||||
"method": "uploadfile",
|
||||
args: args,
|
||||
callback: function(r) {
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ wn.views.Calendar = Class.extend({
|
|||
selectable: true,
|
||||
selectHelper: true,
|
||||
events: function(start, end, callback) {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: me.get_events_method || "webnotes.widgets.calendar.get_events",
|
||||
type: "GET",
|
||||
args: me.get_args(start, end),
|
||||
|
|
@ -180,7 +180,7 @@ wn.views.Calendar = Class.extend({
|
|||
update_event: function(event, revertFunc) {
|
||||
var me = this;
|
||||
wn.model.remove_from_locals(me.doctype, event.name);
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: me.update_event_method || "webnotes.widgets.calendar.update_event",
|
||||
args: me.get_update_args(event),
|
||||
callback: function(r) {
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ wn.views.CommunicationComposer = Class.extend({
|
|||
var print_html = "";
|
||||
}
|
||||
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method:"core.doctype.communication.communication.make",
|
||||
args: {
|
||||
sender: [wn.user_info(user).fullname, wn.boot.profile.email],
|
||||
|
|
@ -331,7 +331,7 @@ wn.views.CommunicationComposer = Class.extend({
|
|||
})
|
||||
.autocomplete({
|
||||
source: function(request, response) {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method:'webnotes.utils.email_lib.get_contact_list',
|
||||
args: {
|
||||
'select': "email_id",
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
|
|||
wn.confirm(wn._('This is permanent action and you cannot undo. Continue?'),
|
||||
function() {
|
||||
me.set_working(true);
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'webnotes.widgets.reportview.delete_items',
|
||||
args: {
|
||||
items: $.map(dl, function(d, i) { return d.name }),
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ wn.views.Gantt = Class.extend({
|
|||
.html('<div class="alert">Loading...</div>');
|
||||
|
||||
var me = this;
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: this.get_events_method,
|
||||
type: "GET",
|
||||
args: {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ $.extend(wn.report_dump, {
|
|||
last_modified: {},
|
||||
with_data: function(doctypes, callback, progress_bar) {
|
||||
var pre_loaded = keys(wn.report_dump.last_modified);
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: "webnotes.widgets.report_dump.get_data",
|
||||
type: "GET",
|
||||
args: {
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ wn.views.moduleview.ModuleView = Class.extend({
|
|||
render_dynamic: function() {
|
||||
// render reports
|
||||
var me = this;
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: "webnotes.widgets.moduleview.get_data",
|
||||
args: {
|
||||
module: me.module,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ wn.views.pageview = {
|
|||
callback();
|
||||
} else {
|
||||
// get fresh
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'webnotes.widgets.page.getpage',
|
||||
args: {'name':name },
|
||||
callback: function(r) {
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ wn.views.QueryReport = Class.extend({
|
|||
me.appframe.set_title(wn._("Query Report")+": " + me.report_name);
|
||||
|
||||
if(!wn.query_reports[me.report_name]) {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method:"webnotes.widgets.query_report.get_script",
|
||||
args: {
|
||||
report_name: me.report_name
|
||||
|
|
@ -142,7 +142,7 @@ wn.views.QueryReport = Class.extend({
|
|||
$.each(this.filters || [], function(i, f) {
|
||||
filters[f.df.fieldname] = f.get_parsed_value();
|
||||
})
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: "webnotes.widgets.query_report.run",
|
||||
args: {
|
||||
"report_name": me.report_name,
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ wn.views.ReportView = wn.ui.Listing.extend({
|
|||
}
|
||||
|
||||
// callback
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'webnotes.widgets.reportview.save_report',
|
||||
args: {
|
||||
name: name,
|
||||
|
|
@ -416,7 +416,7 @@ wn.views.ReportView = wn.ui.Listing.extend({
|
|||
return;
|
||||
if(wn.confirm(wn._("This is PERMANENT action and you cannot undo. Continue?"),
|
||||
function() {
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'webnotes.widgets.reportview.delete_items',
|
||||
args: {
|
||||
items: delete_list,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ wn.views.SidebarStats = Class.extend({
|
|||
},
|
||||
get_stats: function() {
|
||||
var me = this
|
||||
wn.call({
|
||||
return wn.call({
|
||||
type: "GET",
|
||||
method: 'webnotes.widgets.reportview.get_stats',
|
||||
args: {
|
||||
|
|
|
|||
|
|
@ -75,8 +75,8 @@ def parse_date(date):
|
|||
return parsed_date
|
||||
|
||||
def get_user_date_format():
|
||||
global user_date_format
|
||||
if not user_date_format:
|
||||
global user_date_format
|
||||
user_date_format = webnotes.defaults.get_global_default("date_format")
|
||||
return user_date_format
|
||||
|
||||
|
|
|
|||
|
|
@ -248,18 +248,20 @@ def get_tables(doctype, fields):
|
|||
tables = ['`tab' + doctype + '`']
|
||||
|
||||
# add tables from fields
|
||||
for f in fields or []:
|
||||
if "." not in f: continue
|
||||
if fields:
|
||||
for f in fields:
|
||||
if "." not in f: continue
|
||||
|
||||
table_name = f.split('.')[0]
|
||||
if table_name.lower().startswith('group_concat('):
|
||||
table_name = table_name[13:]
|
||||
if table_name.lower().startswith('ifnull('):
|
||||
table_name = table_name[7:]
|
||||
if not table_name[0]=='`':
|
||||
table_name = '`' + table_name + '`'
|
||||
if not table_name in tables:
|
||||
tables.append(table_name)
|
||||
table_name = f.split('.')[0]
|
||||
if table_name.lower().startswith('group_concat('):
|
||||
table_name = table_name[13:]
|
||||
if table_name.lower().startswith('ifnull('):
|
||||
table_name = table_name[7:]
|
||||
if not table_name[0]=='`':
|
||||
table_name = '`' + table_name + '`'
|
||||
if not table_name in tables:
|
||||
tables.append(table_name)
|
||||
|
||||
return tables
|
||||
|
||||
@webnotes.whitelist()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue