mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 13:39:18 +00:00
[fix] [client script] call cur_frm.cscript.custom_ type functions in the callback of standard functions
This commit is contained in:
@@ -66,7 +66,7 @@ cur_frm.cscript.setup_dashboard = function(doc) {
|
||||
cur_frm.dashboard.add_doctype_badge("Delivery Note", "customer");
|
||||
cur_frm.dashboard.add_doctype_badge("Sales Invoice", "customer");
|
||||
|
||||
wn.call({
|
||||
return wn.call({
|
||||
type: "GET",
|
||||
method:"selling.doctype.customer.customer.get_dashboard_info",
|
||||
args: {
|
||||
|
||||
@@ -78,7 +78,7 @@ erpnext.selling.InstallationNote = 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 @@ erpnext.selling.InstallationNote = wn.ui.form.Controller.extend({
|
||||
customer_address: function() {
|
||||
var me = this;
|
||||
if(this.frm.doc.customer) {
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
doc: this.frm.doc,
|
||||
args: {
|
||||
customer: this.frm.doc.customer,
|
||||
|
||||
@@ -86,7 +86,7 @@ erpnext.selling.Opportunity = 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",
|
||||
});
|
||||
@@ -140,7 +140,7 @@ cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code) {
|
||||
get_server_fields('get_item_details',d.item_code, 'enquiry_details',doc, cdt,cdn,1);
|
||||
return get_server_fields('get_item_details',d.item_code, 'enquiry_details',doc, cdt,cdn,1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ cur_frm.cscript.lead_cust_show = 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', 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.cscript.lead = function(doc, cdt, cdn) {
|
||||
@@ -195,7 +195,7 @@ cur_frm.cscript['Declare Opportunity Lost'] = function(){
|
||||
dialog.fields_dict.update.$input.click(function() {
|
||||
args = dialog.get_values();
|
||||
if(!args) return;
|
||||
cur_frm.call({
|
||||
return cur_frm.call({
|
||||
doc: cur_frm.doc,
|
||||
method: "declare_enquiry_lost",
|
||||
args: args.reason,
|
||||
|
||||
@@ -114,7 +114,7 @@ cur_frm.fields_dict.lead.get_query = function(doc,cdt,cdn) {
|
||||
|
||||
cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
||||
if(doc.lead) {
|
||||
cur_frm.call({
|
||||
return cur_frm.call({
|
||||
doc: cur_frm.doc,
|
||||
method: "set_lead_defaults",
|
||||
callback: function(r) {
|
||||
@@ -152,7 +152,7 @@ cur_frm.cscript['Declare Order Lost'] = function(){
|
||||
dialog.fields_dict.update.$input.click(function() {
|
||||
args = dialog.get_values();
|
||||
if(!args) return;
|
||||
cur_frm.call({
|
||||
return cur_frm.call({
|
||||
method: "declare_order_lost",
|
||||
doc: cur_frm.doc,
|
||||
args: args.reason,
|
||||
|
||||
@@ -18,7 +18,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.toggle_enable('new_item_code', doc.__islocal);
|
||||
if(!doc.__islocal) {
|
||||
cur_frm.add_custom_button("Check for Duplicates", function() {
|
||||
cur_frm.call_server('check_duplicate', 1)
|
||||
return cur_frm.call_server('check_duplicate', 1)
|
||||
}, 'icon-search')
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,6 @@ cur_frm.fields_dict.new_item_code.query_description = 'Select Item where "Is Sto
|
||||
cur_frm.cscript.item_code = function(doc, dt, dn) {
|
||||
var d = locals[dt][dn];
|
||||
if (d.item_code){
|
||||
get_server_fields('get_item_details', d.item_code, 'sales_bom_items', doc ,dt, dn, 1);
|
||||
return get_server_fields('get_item_details', d.item_code, 'sales_bom_items', doc ,dt, dn, 1);
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
msgprint(wn._("Please specify Company"));
|
||||
} else {
|
||||
var price_list_name = this.frm.doc.price_list_name;
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
doc: this.frm.doc,
|
||||
method: "set_customer_defaults",
|
||||
freeze: true,
|
||||
@@ -154,7 +154,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
customer_address: function() {
|
||||
var me = this;
|
||||
if(this.frm.doc.customer) {
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
doc: this.frm.doc,
|
||||
args: {
|
||||
customer: this.frm.doc.customer,
|
||||
@@ -183,7 +183,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
item.item_code = null;
|
||||
refresh_field("item_code", item.name, item.parentfield);
|
||||
} else {
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
method: "selling.utils.get_item_details",
|
||||
child: item,
|
||||
args: {
|
||||
@@ -292,7 +292,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
warehouse: function(doc, cdt, cdn) {
|
||||
var item = wn.model.get_doc(cdt, cdn);
|
||||
if(item.item_code && item.warehouse) {
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
method: "selling.utils.get_available_qty",
|
||||
child: item,
|
||||
args: {
|
||||
@@ -484,7 +484,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
charge: function() {
|
||||
var me = this;
|
||||
if(this.frm.doc.charge) {
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
doc: this.frm.doc,
|
||||
method: "get_other_charges",
|
||||
callback: function(r) {
|
||||
@@ -499,7 +499,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
shipping_rule: function() {
|
||||
var me = this;
|
||||
if(this.frm.doc.shipping_rule) {
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
doc: this.frm.doc,
|
||||
method: "apply_shipping_rule",
|
||||
callback: function(r) {
|
||||
|
||||
@@ -101,7 +101,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
||||
reserved_warehouse: function(doc, cdt, cdn) {
|
||||
var item = wn.model.get_doc(cdt, cdn);
|
||||
if(item.item_code && item.reserved_warehouse) {
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
method: "selling.utils.get_available_qty",
|
||||
child: item,
|
||||
args: {
|
||||
@@ -173,7 +173,7 @@ cur_frm.cscript['Stop Sales Order'] = function() {
|
||||
var check = confirm("Are you sure you want to STOP " + doc.name);
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', {
|
||||
return $c('runserverobj', {
|
||||
'method':'stop_sales_order',
|
||||
'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))
|
||||
}, function(r,rt) {
|
||||
@@ -188,7 +188,7 @@ cur_frm.cscript['Unstop Sales Order'] = function() {
|
||||
var check = confirm("Are you sure you want to UNSTOP " + doc.name);
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', {
|
||||
return $c('runserverobj', {
|
||||
'method':'unstop_sales_order',
|
||||
'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))
|
||||
}, function(r,rt) {
|
||||
|
||||
@@ -33,7 +33,7 @@ pscript['onload_Sales Browser'] = function(wrapper){
|
||||
|
||||
wrapper.make_tree = function() {
|
||||
var ctype = wn.get_route()[1] || 'Territory';
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'selling.page.sales_browser.sales_browser.get_children',
|
||||
args: {ctype: ctype},
|
||||
callback: function(r) {
|
||||
@@ -155,7 +155,7 @@ erpnext.SalesChart = Class.extend({
|
||||
v.parent = node.data('label');
|
||||
v.ctype = me.ctype;
|
||||
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: 'selling.page.sales_browser.sales_browser.add_node',
|
||||
args: v,
|
||||
callback: function() {
|
||||
|
||||
Reference in New Issue
Block a user