Fixed issues
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.json b/erpnext/accounts/doctype/fiscal_year/fiscal_year.json
index ed98b39..3927c4f 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.json
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.json
@@ -39,9 +39,9 @@
"reqd": 1
},
{
- "fieldname": "company",
+ "fieldname": "fiscal_year_companies",
"fieldtype": "Table",
- "label": "List of Companies",
+ "label": "Fiscal Year Companies",
"options": "Fiscal Year Company",
"permlevel": 0,
"precision": ""
@@ -49,7 +49,7 @@
],
"icon": "icon-calendar",
"idx": 1,
- "modified": "2014-10-02 13:40:40.298965",
+ "modified": "2014-10-07 12:23:41.679419",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Fiscal Year",
diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
index 2c2018e..a346f6c 100644
--- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
@@ -154,11 +154,11 @@
cur_frm.cscript.company = function(doc, cdt, cdn) {
cur_frm.refresh_fields();
- erpnext.get_fiscal_year(doc);
+ erpnext.get_fiscal_year(doc.company, doc.posting_date);
}
cur_frm.cscript.posting_date = function(doc, cdt, cdn){
- erpnext.get_fiscal_year(doc);
+ erpnext.get_fiscal_year(doc.company, doc.posting_date);
}
cur_frm.cscript.is_opening = function(doc, cdt, cdn) {
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index fb4a86c..0c108a4 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -24,7 +24,7 @@
elif company:
cond = """('%s' in (select company from `tabFiscal Year Company`
where `tabFiscal Year Company`.parent = `tabFiscal Year`.name))
- and '%s' >= year_start_date and '%s' <= year_end_date """ %(company, date, date)
+ and '%s' >= year_start_date and '%s' <= year_end_date """ %(company.replace("'", "\'"), date, date)
else:
cond = "'%s' >= year_start_date and '%s' <= year_end_date" %(date, date)
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index 3d66cd1..3a4ab4a 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -2,6 +2,7 @@
// License: GNU General Public License v3. See license.txt
frappe.provide("erpnext.buying");
+frappe.require("assets/erpnext/js/utils.js");
cur_frm.cscript.tname = "Purchase Order Item";
cur_frm.cscript.fname = "po_details";
@@ -212,25 +213,9 @@
}
cur_frm.cscript.company = function(doc, cdt, cdn) {
- get_fiscal_year(doc);
+ erpnext.get_fiscal_year(doc.company, doc.transaction_date);
}
cur_frm.cscript.transaction_date = function(doc, cdt, cdn){
- get_fiscal_year(doc);
-}
-
-function get_fiscal_year(doc) {
- frappe.call({
- type:"GET",
- method: "erpnext.accounts.utils.get_fiscal_year",
- args: {
- "company": doc.company,
- "date": doc.transaction_date,
- "verbose": '0'
- },
- callback: function(r) {
- var arr = r.message
- if (arr != null) cur_frm.set_value("fiscal_year",arr[0]);
- }
- });
+ erpnext.get_fiscal_year(doc.company, doc.transaction_date);
}
\ No newline at end of file
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 748678a..b508471 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -12,13 +12,13 @@
return frappe.boot.sysdefaults.currency;
},
- get_fiscal_year: function(doc) {
+ get_fiscal_year: function(company, date) {
frappe.call({
type:"GET",
method: "erpnext.accounts.utils.get_fiscal_year",
args: {
- "company": doc.company,
- "date": doc.posting_date,
+ "company": company,
+ "date": date,
"verbose": '0'
},
callback: function(r) {
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index 628e43e..2533735 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -199,3 +199,11 @@
frappe.require("assets/erpnext/js/sms_manager.js");
var sms_man = new SMSManager(cur_frm.doc);
};
+
+cur_frm.cscript.company = function(doc, cdt, cdn) {
+ erpnext.get_fiscal_year(doc.company, doc.transaction_date);
+}
+
+cur_frm.cscript.transaction_date = function(doc, cdt, cdn){
+ erpnext.get_fiscal_year(doc.company, doc.transaction_date);
+}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 8acf1a0..d961b40 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -465,9 +465,9 @@
cur_frm.add_fetch('bom_no', 'total_fixed_cost', 'total_fixed_cost');
cur_frm.cscript.company = function(doc, cdt, cdn) {
- erpnext.get_fiscal_year(doc);
+ erpnext.get_fiscal_year(doc.company, doc.posting_date);
}
cur_frm.cscript.posting_date = function(doc, cdt, cdn){
- erpnext.get_fiscal_year(doc);
+ erpnext.get_fiscal_year(doc.company, doc.posting_date);
}