Merge branch 'latest' of github.com:webnotes/erpnext into latest
diff --git a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js
index d4ce9e4..dee9510 100644
--- a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js
+++ b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js
@@ -22,16 +22,18 @@
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
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index d7d88bb..323d956 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -33,7 +33,7 @@
}
// 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 @@
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);
}
});
}
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index db5215a..272f304 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -20,14 +20,16 @@
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 ===============================================================