[fix] [minor] call refresh_fields after cur_frm.call when doc is passed

This commit is contained in:
Anand Doshi 2013-07-25 19:13:45 +05:30
parent 742b55f700
commit 52b049145b
9 changed files with 4 additions and 25 deletions

View File

@ -120,6 +120,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
} }
// TODO toggle display of fields // TODO toggle display of fields
cur_frm.cscript.hide_fields(this.frm.doc);
}, },
debit_to: function() { debit_to: function() {
@ -162,7 +163,7 @@ $.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_
// Hide Fields // 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', par_flds = ['project_name', 'due_date', 'is_opening', 'conversion_rate',
'source', 'total_advance', 'gross_profit', 'source', 'total_advance', 'gross_profit',
'gross_profit_percent', 'get_advances_received', 'gross_profit_percent', 'get_advances_received',
@ -189,6 +190,8 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) {
var cp = wn.control_panel; var cp = wn.control_panel;
if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']); if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
else hide_field(['c_form_applicable', 'c_form_no']); else hide_field(['c_form_applicable', 'c_form_no']);
cur_frm.refresh_fields();
} }

View File

@ -90,7 +90,6 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
freeze: true, freeze: true,
callback: function(r) { callback: function(r) {
if(!r.exc) { if(!r.exc) {
me.frm.refresh_fields();
if(me.frm.doc.price_list_name !== price_list_name) me.price_list_name(); if(me.frm.doc.price_list_name !== price_list_name) me.price_list_name();
} }
} }

View File

@ -81,9 +81,6 @@ erpnext.selling.InstallationNote = wn.ui.form.Controller.extend({
this.frm.call({ this.frm.call({
doc: this.frm.doc, doc: this.frm.doc,
method: "set_customer_defaults", method: "set_customer_defaults",
callback: function(r) {
if(!r.exc) me.frm.refresh_fields();
}
}); });
// TODO shift this to depends_on // TODO shift this to depends_on
@ -105,9 +102,6 @@ erpnext.selling.InstallationNote = wn.ui.form.Controller.extend({
}, },
method: "get_customer_address", method: "get_customer_address",
freeze: true, freeze: true,
callback: function(r) {
me.frm.refresh_fields();
}
}); });
} }
}, },

View File

@ -89,9 +89,6 @@ erpnext.selling.Opportunity = wn.ui.form.Controller.extend({
this.frm.call({ this.frm.call({
doc: this.frm.doc, doc: this.frm.doc,
method: "set_customer_defaults", method: "set_customer_defaults",
callback: function(r) {
if(!r.exc) me.frm.refresh_fields();
}
}); });
// TODO shift this to depends_on // TODO shift this to depends_on
@ -208,7 +205,6 @@ cur_frm.cscript['Declare Opportunity Lost'] = function(){
return; return;
} }
dialog.hide(); dialog.hide();
cur_frm.refresh();
}, },
btn: this btn: this
}) })

View File

@ -142,7 +142,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
freeze: true, freeze: true,
callback: function(r) { callback: function(r) {
if(!r.exc) { if(!r.exc) {
me.frm.refresh_fields();
(me.frm.doc.price_list_name !== price_list_name) ? (me.frm.doc.price_list_name !== price_list_name) ?
me.price_list_name() : me.price_list_name() :
me.price_list_currency(); me.price_list_currency();

View File

@ -29,9 +29,6 @@ erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({
this.frm.call({ this.frm.call({
doc: this.frm.doc, doc: this.frm.doc,
method: "set_customer_defaults", method: "set_customer_defaults",
callback: function(r) {
if(!r.exc) me.frm.refresh_fields();
}
}); });
// TODO shift this to depends_on // TODO shift this to depends_on

View File

@ -47,9 +47,6 @@ erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({
this.frm.call({ this.frm.call({
doc: this.frm.doc, doc: this.frm.doc,
method: "set_customer_defaults", method: "set_customer_defaults",
callback: function(r) {
if(!r.exc) me.frm.refresh_fields();
}
}); });
} }
}, },

View File

@ -65,9 +65,6 @@ erpnext.support.MaintenanceVisit = wn.ui.form.Controller.extend({
this.frm.call({ this.frm.call({
doc: this.frm.doc, doc: this.frm.doc,
method: "set_customer_defaults", method: "set_customer_defaults",
callback: function(r) {
if(!r.exc) me.frm.refresh_fields();
}
}); });
// TODO shift this to depends_on // TODO shift this to depends_on

View File

@ -26,9 +26,6 @@ erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({
this.frm.call({ this.frm.call({
doc: this.frm.doc, doc: this.frm.doc,
method: "set_customer_defaults", method: "set_customer_defaults",
callback: function(r) {
if(!r.exc) me.frm.refresh_fields();
}
}); });
} }
} }