From 52b049145bb5dce6cef0b178f91a839dfab2c166 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 25 Jul 2013 19:13:45 +0530 Subject: [PATCH] [fix] [minor] call refresh_fields after cur_frm.call when doc is passed --- accounts/doctype/sales_invoice/sales_invoice.js | 5 ++++- buying/doctype/purchase_common/purchase_common.js | 1 - selling/doctype/installation_note/installation_note.js | 6 ------ selling/doctype/opportunity/opportunity.js | 4 ---- selling/doctype/sales_common/sales_common.js | 1 - support/doctype/customer_issue/customer_issue.js | 3 --- .../doctype/maintenance_schedule/maintenance_schedule.js | 3 --- support/doctype/maintenance_visit/maintenance_visit.js | 3 --- support/doctype/support_ticket/support_ticket.js | 3 --- 9 files changed, 4 insertions(+), 25 deletions(-) diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index b61cbb0b4a..aa21d5dd7e 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -120,6 +120,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } // TODO toggle display of fields + cur_frm.cscript.hide_fields(this.frm.doc); }, debit_to: function() { @@ -162,7 +163,7 @@ $.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_ // Hide Fields // ------------ -cur_frm.cscript.hide_fields = function(doc, cdt, cdn) { +cur_frm.cscript.hide_fields = function(doc) { par_flds = ['project_name', 'due_date', 'is_opening', 'conversion_rate', 'source', 'total_advance', 'gross_profit', 'gross_profit_percent', 'get_advances_received', @@ -189,6 +190,8 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) { var cp = wn.control_panel; if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']); else hide_field(['c_form_applicable', 'c_form_no']); + + cur_frm.refresh_fields(); } diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index 494a9dcb2c..148ba1c920 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -90,7 +90,6 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ freeze: true, callback: function(r) { if(!r.exc) { - me.frm.refresh_fields(); if(me.frm.doc.price_list_name !== price_list_name) me.price_list_name(); } } diff --git a/selling/doctype/installation_note/installation_note.js b/selling/doctype/installation_note/installation_note.js index dce0a31252..5ad698a0ca 100644 --- a/selling/doctype/installation_note/installation_note.js +++ b/selling/doctype/installation_note/installation_note.js @@ -81,9 +81,6 @@ erpnext.selling.InstallationNote = wn.ui.form.Controller.extend({ this.frm.call({ doc: this.frm.doc, method: "set_customer_defaults", - callback: function(r) { - if(!r.exc) me.frm.refresh_fields(); - } }); // TODO shift this to depends_on @@ -105,9 +102,6 @@ erpnext.selling.InstallationNote = wn.ui.form.Controller.extend({ }, method: "get_customer_address", freeze: true, - callback: function(r) { - me.frm.refresh_fields(); - } }); } }, diff --git a/selling/doctype/opportunity/opportunity.js b/selling/doctype/opportunity/opportunity.js index 7c647c3f76..0ac22a116d 100644 --- a/selling/doctype/opportunity/opportunity.js +++ b/selling/doctype/opportunity/opportunity.js @@ -89,9 +89,6 @@ erpnext.selling.Opportunity = wn.ui.form.Controller.extend({ this.frm.call({ doc: this.frm.doc, method: "set_customer_defaults", - callback: function(r) { - if(!r.exc) me.frm.refresh_fields(); - } }); // TODO shift this to depends_on @@ -208,7 +205,6 @@ cur_frm.cscript['Declare Opportunity Lost'] = function(){ return; } dialog.hide(); - cur_frm.refresh(); }, btn: this }) diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js index 9a13c4f98c..246d4a1ad3 100644 --- a/selling/doctype/sales_common/sales_common.js +++ b/selling/doctype/sales_common/sales_common.js @@ -142,7 +142,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ freeze: true, callback: function(r) { if(!r.exc) { - me.frm.refresh_fields(); (me.frm.doc.price_list_name !== price_list_name) ? me.price_list_name() : me.price_list_currency(); diff --git a/support/doctype/customer_issue/customer_issue.js b/support/doctype/customer_issue/customer_issue.js index 96662b95c7..3620c7e10a 100644 --- a/support/doctype/customer_issue/customer_issue.js +++ b/support/doctype/customer_issue/customer_issue.js @@ -29,9 +29,6 @@ erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({ this.frm.call({ doc: this.frm.doc, method: "set_customer_defaults", - callback: function(r) { - if(!r.exc) me.frm.refresh_fields(); - } }); // TODO shift this to depends_on diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.js b/support/doctype/maintenance_schedule/maintenance_schedule.js index d84726986a..f8652d7e16 100644 --- a/support/doctype/maintenance_schedule/maintenance_schedule.js +++ b/support/doctype/maintenance_schedule/maintenance_schedule.js @@ -47,9 +47,6 @@ erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({ this.frm.call({ doc: this.frm.doc, method: "set_customer_defaults", - callback: function(r) { - if(!r.exc) me.frm.refresh_fields(); - } }); } }, diff --git a/support/doctype/maintenance_visit/maintenance_visit.js b/support/doctype/maintenance_visit/maintenance_visit.js index f3faf3f292..9f5fc5d915 100644 --- a/support/doctype/maintenance_visit/maintenance_visit.js +++ b/support/doctype/maintenance_visit/maintenance_visit.js @@ -65,9 +65,6 @@ erpnext.support.MaintenanceVisit = wn.ui.form.Controller.extend({ this.frm.call({ doc: this.frm.doc, method: "set_customer_defaults", - callback: function(r) { - if(!r.exc) me.frm.refresh_fields(); - } }); // TODO shift this to depends_on diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js index bd7e6ccf1f..d8cc798c95 100644 --- a/support/doctype/support_ticket/support_ticket.js +++ b/support/doctype/support_ticket/support_ticket.js @@ -26,9 +26,6 @@ erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({ this.frm.call({ doc: this.frm.doc, method: "set_customer_defaults", - callback: function(r) { - if(!r.exc) me.frm.refresh_fields(); - } }); } }