fixed asynchronus issue

This commit is contained in:
Nabin Hait 2012-02-15 17:31:23 +05:30
parent 237ac638f5
commit 2d8ac7f3f9
3 changed files with 15 additions and 10 deletions

View File

@ -22,16 +22,18 @@ cur_frm.cscript.onload = function(doc,dt,dn) {
if(doc.__islocal){
hide_field(['supplier_address', 'contact_person', 'supplier_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email']);
}
// defined in purchase_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn);
}
//Onload post render
//------------------------
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
if(doc.__islocal && doc.supplier) cur_frm.cscript.supplier(doc,dt,dn);
var callback = function(doc, dt, dn) {
if(doc.__islocal && doc.supplier) cur_frm.cscript.supplier(doc,dt,dn);
}
// defined in purchase_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn, callback);
}
// Refresh

View File

@ -33,7 +33,7 @@ cur_frm.cscript.load_defaults = function(doc, dt, dn) {
}
// Update existing item details
cur_frm.cscript.update_item_details = function(doc, dt, dn) {
cur_frm.cscript.update_item_details = function(doc, dt, dn, callback) {
if(!cur_frm.doc.__islocal) { return; }
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
if(children) {
@ -43,6 +43,7 @@ cur_frm.cscript.update_item_details = function(doc, dt, dn) {
refresh_field(cur_frm.cscript.fname);
doc = locals[doc.doctype][doc.name];
cur_frm.cscript.load_defaults(doc, dt, dn);
if(callback) callback(doc, dt, dn);
}
});
}

View File

@ -20,14 +20,16 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
if(doc.supplier) unhide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
// defined in purchase_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn);
}
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
if(doc.__islocal){
cur_frm.cscript.get_default_schedule_date(doc);
}
var callback = function(doc, dt, dn) {
if(doc.__islocal){
cur_frm.cscript.get_default_schedule_date(doc);
}
}
// defined in purchase_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn, callback);
}
//========================== Refresh ===============================================================