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:
@@ -112,7 +112,7 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.serial_no = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.serial_no) {
|
||||
get_server_fields('get_serial_details',d.serial_no,'delivery_note_details',doc,cdt,cdn,1);
|
||||
return get_server_fields('get_serial_details',d.serial_no,'delivery_note_details',doc,cdt,cdn,1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ cur_frm.cscript.refresh = function(doc) {
|
||||
var enabled = (r.message == 'exists') ? false : true;
|
||||
cur_frm.toggle_enable(['has_serial_no', 'is_stock_item', 'valuation_method'], enabled);
|
||||
}
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'check_if_sle_exists','',callback);
|
||||
return $c_obj(make_doclist(doc.doctype, doc.name),'check_if_sle_exists','',callback);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ cur_frm.fields_dict['item_tax'].grid.get_field("tax_type").get_query = function(
|
||||
|
||||
cur_frm.cscript.tax_type = function(doc, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
get_server_fields('get_tax_rate',d.tax_type,'item_tax',doc, cdt, cdn, 1);
|
||||
return get_server_fields('get_tax_rate',d.tax_type,'item_tax',doc, cdt, cdn, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ cur_frm.cscript['Stop Material Request'] = function() {
|
||||
var check = confirm("Do you really want to STOP this Material Request?");
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
return $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
@@ -135,7 +135,7 @@ cur_frm.cscript['Unstop Material Request'] = function(){
|
||||
var check = confirm("Do you really want to UNSTOP this Material Request?");
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
return $c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
cur_frm.cscript.get_items = function(doc, cdt, cdn) {
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
doc: this.frm.doc,
|
||||
method: "get_items",
|
||||
callback: function(r) {
|
||||
|
||||
@@ -54,7 +54,7 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
||||
// Supplier
|
||||
//-------------
|
||||
cur_frm.cscript.supplier = function(doc,dt,dn) {
|
||||
if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
|
||||
if(doc.supplier) return get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
|
||||
if(doc.supplier) unhide_field(['supplier_name','address_display']);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
account_for = "stock_received_but_not_billed";
|
||||
else account_for = "stock_adjustment_account";
|
||||
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
method: "accounts.utils.get_company_default",
|
||||
args: {
|
||||
"fieldname": account_for,
|
||||
@@ -142,7 +142,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
},
|
||||
|
||||
get_items: function() {
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
doc: this.frm.doc,
|
||||
method: "get_items",
|
||||
callback: function(r) {
|
||||
@@ -160,7 +160,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
production_order: function() {
|
||||
this.toggle_enable_bom();
|
||||
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
method: "get_production_order_details",
|
||||
args: {production_order: this.frm.doc.production_order}
|
||||
});
|
||||
@@ -212,7 +212,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
|
||||
make_return_jv: function() {
|
||||
if(this.get_doctype_docname()) {
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
method: "make_return_jv",
|
||||
args: {
|
||||
stock_entry: this.frm.doc.name
|
||||
@@ -269,23 +269,23 @@ cur_frm.cscript.toggle_related_fields = function(doc) {
|
||||
}
|
||||
|
||||
cur_frm.cscript.delivery_note_no = function(doc,cdt,cdn){
|
||||
if(doc.delivery_note_no) get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
|
||||
if(doc.delivery_note_no) return get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
|
||||
}
|
||||
|
||||
cur_frm.cscript.sales_invoice_no = function(doc,cdt,cdn){
|
||||
if(doc.sales_invoice_no) get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
|
||||
if(doc.sales_invoice_no) return get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
|
||||
}
|
||||
|
||||
cur_frm.cscript.customer = function(doc,cdt,cdn){
|
||||
if(doc.customer) get_server_fields('get_cust_addr','','',doc,cdt,cdn,1);
|
||||
if(doc.customer) return get_server_fields('get_cust_addr','','',doc,cdt,cdn,1);
|
||||
}
|
||||
|
||||
cur_frm.cscript.purchase_receipt_no = function(doc,cdt,cdn){
|
||||
if(doc.purchase_receipt_no) get_server_fields('get_supp_values','','',doc,cdt,cdn,1);
|
||||
if(doc.purchase_receipt_no) return get_server_fields('get_supp_values','','',doc,cdt,cdn,1);
|
||||
}
|
||||
|
||||
cur_frm.cscript.supplier = function(doc,cdt,cdn){
|
||||
if(doc.supplier) get_server_fields('get_supp_addr','','',doc,cdt,cdn,1);
|
||||
if(doc.supplier) return get_server_fields('get_supp_addr','','',doc,cdt,cdn,1);
|
||||
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
||||
'serial_no' : d.serial_no,
|
||||
'bom_no' : d.bom_no
|
||||
};
|
||||
get_server_fields('get_item_details',JSON.stringify(args),'mtn_details',doc,cdt,cdn,1);
|
||||
return get_server_fields('get_item_details',JSON.stringify(args),'mtn_details',doc,cdt,cdn,1);
|
||||
}
|
||||
|
||||
cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) {
|
||||
@@ -341,7 +341,7 @@ cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) {
|
||||
'bom_no' : d.bom_no,
|
||||
'qty' : d.s_warehouse ? -1* d.qty : d.qty
|
||||
}
|
||||
get_server_fields('get_warehouse_details', JSON.stringify(args),
|
||||
return get_server_fields('get_warehouse_details', JSON.stringify(args),
|
||||
'mtn_details', doc, cdt, cdn, 1);
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(d.uom && d.item_code){
|
||||
var arg = {'item_code':d.item_code, 'uom':d.uom, 'qty':d.qty}
|
||||
get_server_fields('get_uom_details',JSON.stringify(arg),'mtn_details', doc, cdt, cdn, 1);
|
||||
return get_server_fields('get_uom_details',JSON.stringify(arg),'mtn_details', doc, cdt, cdn, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
|
||||
var me = this;
|
||||
|
||||
if (sys_defaults.auto_inventory_accounting && !this.frm.doc.expense_account) {
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
method: "accounts.utils.get_company_default",
|
||||
args: {
|
||||
"fieldname": "stock_adjustment_account",
|
||||
|
||||
@@ -21,7 +21,7 @@ $.extend(cur_frm.cscript, {
|
||||
|
||||
item_code: function() {
|
||||
if(cur_frm.doc.item_code) {
|
||||
cur_frm.call({
|
||||
return cur_frm.call({
|
||||
method: "get_stock_uom",
|
||||
args: { item_code: cur_frm.doc.item_code }
|
||||
});
|
||||
|
||||
@@ -26,6 +26,6 @@ cur_frm.cscript.merge = function(doc, cdt, cdn) {
|
||||
var check = confirm("Are you sure you want to merge this warehouse into "
|
||||
+ doc.merge_with + "?");
|
||||
if (check) {
|
||||
$c_obj(make_doclist(cdt, cdn), 'merge_warehouses', '', '');
|
||||
return $c_obj(make_doclist(cdt, cdn), 'merge_warehouses', '', '');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user