Fixed issues

This commit is contained in:
Neil Trini Lasrado 2014-10-07 12:50:17 +05:30
parent 78fa6954e5
commit e6b14a4bf6
7 changed files with 22 additions and 29 deletions

View File

@ -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",

View File

@ -154,11 +154,11 @@ cur_frm.cscript.refresh = function(doc) {
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) {

View File

@ -24,7 +24,7 @@ def get_fiscal_years(date=None, fiscal_year=None, label="Date", verbose=1, compa
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)

View File

@ -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.send_sms = function() {
}
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);
}

View File

@ -12,13 +12,13 @@ $.extend(erpnext, {
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) {

View File

@ -199,3 +199,11 @@ cur_frm.cscript.send_sms = function() {
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);
}

View File

@ -465,9 +465,9 @@ cur_frm.add_fetch('production_order', 'total_fixed_cost', 'total_fixed_cost');
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);
}