minor fixes in utils, purchase common and task

This commit is contained in:
Anand Doshi 2013-03-11 14:57:45 +05:30
parent fd6d2e0d2f
commit 88ac485541
3 changed files with 7 additions and 30 deletions

View File

@ -68,15 +68,15 @@ erpnext.buying.BuyingController = erpnext.utils.Controller.extend({
callback: function(r) {
if(!r.exc) {
me.price_list_currency();
if (callback_fn) callback_fn(me.frm.doc, me.frm.doc.doctype,
me.frm.doc.name);
if (typeof callback_fn === "function")
callback_fn(me.frm.doc, me.frm.doc.doctype, me.frm.doc.name);
}
}
});
} else {
me.price_list_currency();
if (callback_fn) callback_fn(me.frm.doc, me.frm.doc.doctype,
me.frm.doc.name);
if (typeof callback_fn === "function")
callback_fn(me.frm.doc, me.frm.doc.doctype, me.frm.doc.name);
}
}
},

View File

@ -29,7 +29,8 @@ erpnext.projects.Task = erpnext.utils.Controller.extend({
project: function() {
if(this.frm.doc.project) {
get_server_fields('get_project_details', '','', doc, cdt, cdn, 1);
get_server_fields('get_project_details', '','', this.frm.doc, this.frm.doc.doctype,
this.frm.doc.name, 1);
}
},

View File

@ -26,31 +26,7 @@ erpnext.get_currency = function(company) {
}
// TODO
erpnext.utils.Controller = Class.extend({
init: function(opts) {
$.extend(this, opts);
this.setup && this.setup();
},
onload_post_render: function() {
if(this.frm.doc.__islocal) {
this.setup_defaults();
}
},
setup_defaults: function() {
var me = this;
var defaults = {
posting_date: wn.datetime.get_today(),
posting_time: wn.datetime.now_time()
}
$.each(defaults, function(k, v) {
if(!me.frm.doc[k]) me.frm.set_value(k, v);
});
},
erpnext.utils.Controller = wn.ui.form.Controller.extend({
refresh: function() {
erpnext.hide_naming_series();
}