added onload_post_render
diff --git a/crm/doctype/enquiry/enquiry.js b/crm/doctype/enquiry/enquiry.js
index a8c8ea2..2eddafa 100644
--- a/crm/doctype/enquiry/enquiry.js
+++ b/crm/doctype/enquiry/enquiry.js
@@ -42,15 +42,16 @@
hide_field(['customer', 'customer_address', 'contact_person', 'customer_name', 'contact_display', 'customer_group']);
}
}
-
- if(doc.enquiry_from == 'Lead' && doc.lead) {
- cur_frm.cscript.lead(doc,cdt,cdn);
- }
// setup fetch
cur_frm.cscript.set_fetch();
}
+cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
+ if(doc.enquiry_from == 'Lead' && doc.lead) {
+ cur_frm.cscript.lead(doc,cdt,cdn);
+ }
+}
// fetch
// ===============================================================
diff --git a/material_management/doctype/purchase_receipt/purchase_receipt.js b/material_management/doctype/purchase_receipt/purchase_receipt.js
index da06321..e060e3c 100644
--- a/material_management/doctype/purchase_receipt/purchase_receipt.js
+++ b/material_management/doctype/purchase_receipt/purchase_receipt.js
@@ -13,10 +13,6 @@
if (!doc.posting_date) doc.posting_date = dateutil.obj_to_str(new Date());
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
if (!doc.status) doc.status = 'Draft';
-
- if(doc.__islocal){
- cur_frm.cscript.get_default_schedule_date(doc);
- }
if(doc.__islocal){
hide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
@@ -26,6 +22,12 @@
}
+cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
+ if(doc.__islocal){
+ cur_frm.cscript.get_default_schedule_date(doc);
+ }
+}
+
//========================== Refresh ===============================================================
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
diff --git a/srm/doctype/indent/indent.js b/srm/doctype/indent/indent.js
index a2e1614..8d7ffb1 100644
--- a/srm/doctype/indent/indent.js
+++ b/srm/doctype/indent/indent.js
@@ -9,10 +9,13 @@
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date())
if (!doc.status) doc.status = 'Draft';
+}
+
+cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
// second call
if(doc.__islocal){
cur_frm.cscript.get_item_defaults(doc);
- }
+ }
}
cur_frm.cscript.get_item_defaults = function(doc) {
diff --git a/srm/doctype/purchase_order/purchase_order.js b/srm/doctype/purchase_order/purchase_order.js
index cbc0d3a..5714126 100644
--- a/srm/doctype/purchase_order/purchase_order.js
+++ b/srm/doctype/purchase_order/purchase_order.js
@@ -15,16 +15,18 @@
if(!doc.currency) doc.currency = sys_defaults.currency;
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
-
- if(doc.__islocal){
- cur_frm.cscript.get_default_schedule_date(doc);
- }
if(doc.__islocal){
hide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
}
}
+cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
+ if(doc.__islocal){
+ cur_frm.cscript.get_default_schedule_date(doc);
+ }
+}
+
// ================================== Refresh ==========================================
cur_frm.cscript.refresh = function(doc, cdt, cdn) {