Merge branch 'develop' of github.com:frappe/erpnext into develop

This commit is contained in:
Nabin Hait 2014-04-29 11:31:37 +05:30
commit b1777ecfd8
4 changed files with 30 additions and 13 deletions

View File

@ -1,8 +1,18 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
cur_frm.add_fetch("bank_account", "company", "company");
cur_frm.cscript.onload = function(doc, cdt, cdn){ cur_frm.cscript.onload = function(doc, cdt, cdn){
cur_frm.set_intro('<i class="icon-question" /> ' + cur_frm.set_intro('<i class="icon-question" /> ' +
__("Update clearance date of Journal Entries marked as 'Bank Vouchers'")) __("Update clearance date of Journal Entries marked as 'Bank Vouchers'"));
}
cur_frm.add_fetch("bank_account", "company", "company");
cur_frm.set_query("bank_account", function() {
return {
"filters": {
"account_type": "Bank",
"group_or_ledger": "Ledger"
}
};
});
}

View File

@ -64,7 +64,10 @@ class CostCenter(NestedSet):
""" """
Cost Center name must be unique Cost Center name must be unique
""" """
if (self.get("__islocal") or not self.name) and frappe.db.sql("select name from `tabCost Center` where cost_center_name = %s and company=%s", (self.cost_center_name, self.company)): if ((self.get("__islocal") or not self.name) and
frappe.db.sql("select name from `tabCost Center` where cost_center_name=%s and company=%s",
(self.cost_center_name, self.company))
):
msgprint(_("Cost Center Name already exists"), raise_exception=1) msgprint(_("Cost Center Name already exists"), raise_exception=1)
self.validate_mandatory() self.validate_mandatory()

View File

@ -2,15 +2,23 @@
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
$.extend(cur_frm.cscript, { $.extend(cur_frm.cscript, {
onload: function() {
if(cur_frm.doc.__islocal) {
cur_frm.set_value("year_start_date",
frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1));
}
},
refresh: function (doc, dt, dn) { refresh: function (doc, dt, dn) {
var me = this; var me = this;
this.frm.toggle_enable('year_start_date', doc.__islocal) this.frm.toggle_enable('year_start_date', doc.__islocal)
this.frm.toggle_enable('year_end_date', doc.__islocal) this.frm.toggle_enable('year_end_date', doc.__islocal)
if (!doc.__islocal && (doc.name != sys_defaults.fiscal_year)) { if (!doc.__islocal && (doc.name != sys_defaults.fiscal_year)) {
this.frm.add_custom_button(__("Set as Default"), this.frm.cscript.set_as_default); this.frm.add_custom_button(__("Set as Default"), this.frm.cscript.set_as_default);
this.frm.set_intro(__("To set this Fiscal Year as Default, click on 'Set as Default'")); this.frm.set_intro(__("To set this Fiscal Year as Default, click on 'Set as Default'"));
} else this.frm.set_intro(""); } else {
this.frm.set_intro("");
}
}, },
set_as_default: function() { set_as_default: function() {
return frappe.call({ return frappe.call({
@ -21,8 +29,8 @@ $.extend(cur_frm.cscript, {
year_start_date: function(doc, dt, dn) { year_start_date: function(doc, dt, dn) {
var me = this; var me = this;
year_end_date = year_end_date =
frappe.datetime.add_days(frappe.datetime.add_months(this.frm.doc.year_start_date, 12), -1); frappe.datetime.add_days(frappe.datetime.add_months(this.frm.doc.year_start_date, 12), -1);
this.frm.set_value("year_end_date", year_end_date); this.frm.set_value("year_end_date", year_end_date);
}, },
}); });

View File

@ -20,10 +20,6 @@ $.extend(erpnext.queries, {
return { query: "erpnext.controllers.queries.supplier_query" }; return { query: "erpnext.controllers.queries.supplier_query" };
}, },
account: function() {
return { query: "erpnext.controllers.queries.account_query" };
},
item: function(filters) { item: function(filters) {
var args = { query: "erpnext.controllers.queries.item_query" }; var args = { query: "erpnext.controllers.queries.item_query" };
if(filters) args["filters"] = filters; if(filters) args["filters"] = filters;