Merge branch 'develop' of github.com:frappe/erpnext into develop
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
index 089f61e..72ab425 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
@@ -1,8 +1,18 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// 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.set_intro('<i class="icon-question" /> ' +
- __("Update clearance date of Journal Entries marked as 'Bank Vouchers'"))
-}
\ No newline at end of file
+ cur_frm.set_intro('<i class="icon-question" /> ' +
+ __("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"
+ }
+ };
+ });
+}
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py
index 71ebe6c..b20cbe9 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.py
+++ b/erpnext/accounts/doctype/cost_center/cost_center.py
@@ -64,7 +64,10 @@
"""
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)
self.validate_mandatory()
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.js b/erpnext/accounts/doctype/fiscal_year/fiscal_year.js
index c83e1c8..f6f19f7 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.js
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.js
@@ -2,15 +2,23 @@
// License: GNU General Public License v3. See license.txt
$.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) {
var me = this;
this.frm.toggle_enable('year_start_date', doc.__islocal)
this.frm.toggle_enable('year_end_date', doc.__islocal)
-
+
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.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() {
return frappe.call({
@@ -21,8 +29,8 @@
year_start_date: function(doc, dt, dn) {
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);
this.frm.set_value("year_end_date", year_end_date);
},
-});
\ No newline at end of file
+});
diff --git a/erpnext/public/js/queries.js b/erpnext/public/js/queries.js
index 117e192..cdd14c6 100644
--- a/erpnext/public/js/queries.js
+++ b/erpnext/public/js/queries.js
@@ -20,10 +20,6 @@
return { query: "erpnext.controllers.queries.supplier_query" };
},
- account: function() {
- return { query: "erpnext.controllers.queries.account_query" };
- },
-
item: function(filters) {
var args = { query: "erpnext.controllers.queries.item_query" };
if(filters) args["filters"] = filters;