[cleanup] moved company to top section, hide company if only one exists, changed field labels

This commit is contained in:
Anand Doshi
2013-07-09 13:03:39 +05:30
parent 8f050f4cd3
commit bdee6e074a
23 changed files with 616 additions and 742 deletions

View File

@@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// searches for enabled profiles
wn.provide("erpnext.utils");
erpnext.utils.profile_query = function() {
return "select name, concat_ws(' ', first_name, middle_name, last_name) \
from `tabProfile` where ifnull(enabled, 0)=1 and docstatus < 2 and \

View File

@@ -71,12 +71,6 @@ erpnext.startup.start = function() {
}
}
erpnext.hide_naming_series = function() {
if(cur_frm.fields_dict.naming_series) {
cur_frm.toggle_display("naming_series", cur_frm.doc.__islocal?true:false);
}
}
erpnext.setup_mousetrap = function() {
$(document).keydown("meta+g ctrl+g", function(e) {
wn.ui.toolbar.search.show();

View File

@@ -45,6 +45,7 @@ erpnext.TransactionController = wn.ui.form.Controller.extend({
refresh: function() {
this.frm.clear_custom_buttons();
erpnext.hide_naming_series();
erpnext.hide_company();
this.show_item_wise_taxes();
this.frm.fields_dict.currency ? this.currency() : this.set_dynamic_labels();
},

View File

@@ -13,13 +13,31 @@
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
wn.provide("erpnext.utils");
wn.provide("erpnext");
erpnext.get_currency = function(company) {
if(!company && cur_frm)
company = cur_frm.doc.company;
if(company)
return wn.model.get(":Company", company).default_currency || wn.boot.sysdefaults.currency;
else
return wn.boot.sysdefaults.currency;
}
$.extend(erpnext, {
get_currency: function(company) {
if(!company && cur_frm)
company = cur_frm.doc.company;
if(company)
return wn.model.get(":Company", company).default_currency || wn.boot.sysdefaults.currency;
else
return wn.boot.sysdefaults.currency;
},
hide_naming_series: function() {
if(cur_frm.fields_dict.naming_series) {
cur_frm.toggle_display("naming_series", cur_frm.doc.__islocal?true:false);
}
},
hide_company: function() {
if(cur_frm.fields_dict.company) {
var companies = Object.keys(locals[":Company"]);
if(companies.length === 1) {
if(!cur_frm.doc.company) cur_frm.set_value("company", companies[0]);
cur_frm.toggle_display("company", false);
}
}
}
});