[fix] [client script] call cur_frm.cscript.custom_ type functions in the callback of standard functions

This commit is contained in:
Anand Doshi
2013-07-29 19:30:39 +05:30
parent 17082e71f1
commit 1fac2a98cf
68 changed files with 154 additions and 154 deletions

View File

@@ -26,7 +26,7 @@ erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({
customer: function() {
var me = this;
if(this.frm.doc.customer) {
this.frm.call({
return this.frm.call({
doc: this.frm.doc,
method: "set_customer_defaults",
});
@@ -56,7 +56,7 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
if(doc.customer)
get_server_fields('get_customer_address',
return get_server_fields('get_customer_address',
JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
}

View File

@@ -44,7 +44,7 @@ erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({
customer: function() {
var me = this;
if(this.frm.doc.customer) {
this.frm.call({
return this.frm.call({
doc: this.frm.doc,
method: "set_customer_defaults",
});
@@ -64,7 +64,7 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
}
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
if(doc.customer) return get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
}
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
@@ -90,7 +90,7 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
var fname = cur_frm.cscript.fname;
var d = locals[cdt][cdn];
if (d.item_code) {
get_server_fields('get_item_details',d.item_code, 'item_maintenance_detail',doc,cdt,cdn,1);
return get_server_fields('get_item_details',d.item_code, 'item_maintenance_detail',doc,cdt,cdn,1);
}
}
@@ -101,7 +101,7 @@ cur_frm.cscript.periodicity = function(doc, cdt, cdn){
arg.start_date = d.start_date;
arg.end_date = d.end_date;
arg.periodicity = d.periodicity;
get_server_fields('get_no_of_visits',docstring(arg),'item_maintenance_detail',doc, cdt, cdn, 1);
return get_server_fields('get_no_of_visits',docstring(arg),'item_maintenance_detail',doc, cdt, cdn, 1);
}
else{
msgprint("Please enter Start Date and End Date");
@@ -110,7 +110,7 @@ cur_frm.cscript.periodicity = function(doc, cdt, cdn){
cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
if (!doc.__islocal) {
$c('runserverobj', args={'method':'generate_schedule', 'docs':wn.model.compress(make_doclist(cdt,cdn))},
return $c('runserverobj', args={'method':'generate_schedule', 'docs':wn.model.compress(make_doclist(cdt,cdn))},
function(r,rt){
refresh_field('maintenance_schedule_detail');
}

View File

@@ -62,7 +62,7 @@ erpnext.support.MaintenanceVisit = wn.ui.form.Controller.extend({
customer: function() {
var me = this;
if(this.frm.doc.customer) {
this.frm.call({
return this.frm.call({
doc: this.frm.doc,
method: "set_customer_defaults",
});
@@ -86,7 +86,7 @@ cur_frm.cscript.hide_contact_info = function() {
}
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
if(doc.customer) return get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
}
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
@@ -111,7 +111,7 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
var fname = cur_frm.cscript.fname;
var d = locals[cdt][cdn];
if (d.item_code) {
get_server_fields('get_item_details',d.item_code, 'maintenance_visit_details',doc,cdt,cdn,1);
return get_server_fields('get_item_details',d.item_code, 'maintenance_visit_details',doc,cdt,cdn,1);
}
}

View File

@@ -19,7 +19,7 @@ cur_frm.cscript.refresh = function(doc) {
if(!doc.__islocal && !cint(doc.email_sent) && !doc.__unsaved
&& inList(wn.boot.profile.can_write, doc.doctype)) {
cur_frm.add_custom_button('Send', function() {
$c_obj(make_doclist(doc.doctype, doc.name), 'send_emails', '', function(r) {
return $c_obj(make_doclist(doc.doctype, doc.name), 'send_emails', '', function(r) {
cur_frm.refresh();
});
})
@@ -30,7 +30,7 @@ cur_frm.cscript.refresh = function(doc) {
repl("%(fullname)s <%(email)s>", wn.user_info(doc.owner)));
}
wn.call({
return wn.call({
method: "support.doctype.newsletter.newsletter.get_lead_options",
type: "GET",
callback: function(r) {

View File

@@ -23,7 +23,7 @@ erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({
customer: function() {
var me = this;
if(this.frm.doc.customer) {
this.frm.call({
return this.frm.call({
doc: this.frm.doc,
method: "set_customer_defaults",
});
@@ -93,7 +93,7 @@ $.extend(cur_frm.cscript, {
},
set_status: function(status) {
wn.call({
return wn.call({
method:"support.doctype.support_ticket.support_ticket.set_status",
args: {
name: cur_frm.doc.name,