diff --git a/erpnext/accounts/doctype/c_form/c_form.js b/erpnext/accounts/doctype/c_form/c_form.js index 3bcfa5e4d9d..e4046d55184 100644 --- a/erpnext/accounts/doctype/c_form/c_form.js +++ b/erpnext/accounts/doctype/c_form/c_form.js @@ -3,6 +3,8 @@ //c-form js file // ----------------------------- +frappe.require("assets/erpnext/js/utils.js"); + cur_frm.fields_dict.invoice_details.grid.get_field("invoice_no").get_query = function(doc) { return { filters: { @@ -22,4 +24,12 @@ cur_frm.fields_dict.state.get_query = function(doc) { cur_frm.cscript.invoice_no = function(doc, cdt, cdn) { var d = locals[cdt][cdn]; return get_server_fields('get_invoice_details', d.invoice_no, 'invoice_details', doc, cdt, cdn, 1); +} + +cur_frm.cscript.company = function(doc, cdt, cdn) { + erpnext.get_fiscal_year(doc.company, doc.received_date); +} + +cur_frm.cscript.received_date = function(doc, cdt, cdn){ + erpnext.get_fiscal_year(doc.company, doc.received_date); } \ No newline at end of file diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.json b/erpnext/accounts/doctype/fiscal_year/fiscal_year.json index 0f7aefd3125..3927c4f5b59 100644 --- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.json +++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.json @@ -39,23 +39,17 @@ "reqd": 1 }, { - "default": "No", - "description": "Entries are not allowed against this Fiscal Year if the year is closed.", - "fieldname": "is_fiscal_year_closed", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Year Closed", - "no_copy": 1, - "oldfieldname": "is_fiscal_year_closed", - "oldfieldtype": "Select", - "options": "\nNo\nYes", + "fieldname": "fiscal_year_companies", + "fieldtype": "Table", + "label": "Fiscal Year Companies", + "options": "Fiscal Year Company", "permlevel": 0, - "reqd": 0 + "precision": "" } ], "icon": "icon-calendar", "idx": 1, - "modified": "2014-07-14 05:30:56.843180", + "modified": "2014-10-07 12:23:41.679419", "modified_by": "Administrator", "module": "Accounts", "name": "Fiscal Year", diff --git a/erpnext/accounts/doctype/fiscal_year_company/__init__.py b/erpnext/accounts/doctype/fiscal_year_company/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.json b/erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.json new file mode 100644 index 00000000000..5de4d3cb34e --- /dev/null +++ b/erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.json @@ -0,0 +1,51 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "creation": "2014-10-02 13:35:44.155278", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", + "fields": [ + { + "allow_on_submit": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Company", + "no_copy": 0, + "options": "Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "modified": "2014-10-02 13:35:44.155278", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Fiscal Year Company", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.py b/erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.py new file mode 100644 index 00000000000..76a8bd40d19 --- /dev/null +++ b/erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.py @@ -0,0 +1,9 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class FiscalYearCompany(Document): + pass diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js index 69269d07e91..a346f6c6c4b 100644 --- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js +++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js @@ -2,6 +2,7 @@ // License: GNU General Public License v3. See license.txt frappe.provide("erpnext.accounts"); +frappe.require("assets/erpnext/js/utils.js"); erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({ onload: function() { @@ -153,6 +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.company, doc.posting_date); +} + +cur_frm.cscript.posting_date = function(doc, cdt, cdn){ + erpnext.get_fiscal_year(doc.company, doc.posting_date); } cur_frm.cscript.is_opening = function(doc, cdt, cdn) { diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.json b/erpnext/accounts/doctype/journal_voucher/journal_voucher.json index 1638296c5c4..180a21105d3 100644 --- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.json +++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.json @@ -388,20 +388,6 @@ "read_only": 1, "report_hide": 1 }, - { - "fieldname": "fiscal_year", - "fieldtype": "Link", - "in_filter": 1, - "label": "Fiscal Year", - "oldfieldname": "fiscal_year", - "oldfieldtype": "Select", - "options": "Fiscal Year", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 1, - "search_index": 1 - }, { "fieldname": "company", "fieldtype": "Link", @@ -416,6 +402,20 @@ "reqd": 1, "search_index": 1 }, + { + "fieldname": "fiscal_year", + "fieldtype": "Link", + "in_filter": 1, + "label": "Fiscal Year", + "oldfieldname": "fiscal_year", + "oldfieldtype": "Select", + "options": "Fiscal Year", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 1, + "search_index": 1 + }, { "allow_on_submit": 1, "fieldname": "select_print_heading", @@ -447,7 +447,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2014-09-09 05:35:31.217863", + "modified": "2014-10-02 14:51:20.624847", "modified_by": "Administrator", "module": "Accounts", "name": "Journal Voucher", diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index cf57a61fe54..0c108a4efd7 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -12,26 +12,29 @@ import frappe.desk.reportview class FiscalYearError(frappe.ValidationError): pass class BudgetError(frappe.ValidationError): pass +@frappe.whitelist() +def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1, company=None): + return get_fiscal_years(date, fiscal_year, label, verbose, company)[0] -def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1): - return get_fiscal_years(date, fiscal_year, label, verbose)[0] - -def get_fiscal_years(date=None, fiscal_year=None, label="Date", verbose=1): +def get_fiscal_years(date=None, fiscal_year=None, label="Date", verbose=1, company=None): # if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate) cond = "" if fiscal_year: cond = "name = '%s'" % fiscal_year.replace("'", "\'") + 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.replace("'", "\'"), date, date) else: - cond = "'%s' >= year_start_date and '%s' <= year_end_date" % \ - (date, date) + cond = "'%s' >= year_start_date and '%s' <= year_end_date" %(date, date) + fy = frappe.db.sql("""select name, year_start_date, year_end_date from `tabFiscal Year` where %s order by year_start_date desc""" % cond) if not fy: error_msg = _("""{0} {1} not in any Fiscal Year""").format(label, formatdate(date)) - if verbose: frappe.msgprint(error_msg) + if verbose==1: frappe.msgprint(error_msg) raise FiscalYearError, error_msg - return fy def validate_fiscal_year(date, fiscal_year, label="Date"): diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 9433ebe20c5..8c2b1a25479 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -209,5 +209,4 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { cur_frm.cscript.send_sms = function() { frappe.require("assets/erpnext/js/sms_manager.js"); var sms_man = new SMSManager(cur_frm.doc); -} - +} \ No newline at end of file diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js index b8d40ca236c..b9286a1c24a 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js @@ -71,4 +71,4 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { return { filters:{'supplier': doc.supplier} } -} +} \ No newline at end of file diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js index a4ba2eb7bf9..e070b3f13dd 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.js +++ b/erpnext/hr/doctype/expense_claim/expense_claim.js @@ -153,4 +153,4 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { if(cint(frappe.boot.notification_settings && frappe.boot.notification_settings.expense_claim)) { cur_frm.email_doc(frappe.boot.notification_settings.expense_claim_message); } -} +} \ No newline at end of file diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.json b/erpnext/hr/doctype/expense_claim/expense_claim.json index 15ef03ed178..a82ef90c7b7 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.json +++ b/erpnext/hr/doctype/expense_claim/expense_claim.json @@ -89,6 +89,16 @@ "options": "Simple", "permlevel": 0 }, + { + "fieldname": "posting_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Posting Date", + "oldfieldname": "posting_date", + "oldfieldtype": "Date", + "permlevel": 0, + "reqd": 1 + }, { "fieldname": "employee", "fieldtype": "Link", @@ -114,17 +124,6 @@ "search_index": 0, "width": "150px" }, - { - "fieldname": "fiscal_year", - "fieldtype": "Link", - "in_filter": 1, - "label": "Fiscal Year", - "oldfieldname": "fiscal_year", - "oldfieldtype": "Select", - "options": "Fiscal Year", - "permlevel": 0, - "reqd": 1 - }, { "fieldname": "company", "fieldtype": "Link", @@ -136,21 +135,22 @@ "permlevel": 0, "reqd": 1 }, + { + "fieldname": "fiscal_year", + "fieldtype": "Link", + "in_filter": 1, + "label": "Fiscal Year", + "oldfieldname": "fiscal_year", + "oldfieldtype": "Select", + "options": "Fiscal Year", + "permlevel": 0, + "reqd": 1 + }, { "fieldname": "cb1", "fieldtype": "Column Break", "permlevel": 0 }, - { - "fieldname": "posting_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Posting Date", - "oldfieldname": "posting_date", - "oldfieldtype": "Date", - "permlevel": 0, - "reqd": 1 - }, { "allow_on_submit": 0, "fieldname": "remark", @@ -190,7 +190,7 @@ "icon": "icon-money", "idx": 1, "is_submittable": 1, - "modified": "2014-08-27 07:08:48.454580", + "modified": "2014-10-07 18:22:14.689567", "modified_by": "Administrator", "module": "HR", "name": "Expense Claim", @@ -206,7 +206,6 @@ "read": 1, "report": 1, "role": "Employee", - "user_permission_doctypes": "[\"Company\",\"Employee\",\"Expense Claim\",\"Fiscal Year\"]", "write": 1 }, { @@ -222,7 +221,6 @@ "report": 1, "role": "Expense Approver", "submit": 1, - "user_permission_doctypes": "[\"Expense Claim\",\"User\"]", "write": 1 }, { @@ -238,7 +236,6 @@ "report": 1, "role": "HR User", "submit": 1, - "user_permission_doctypes": "[\"Company\",\"Expense Claim\",\"Fiscal Year\"]", "write": 1 } ], diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js index 3a124850199..41b384267f8 100644 --- a/erpnext/public/js/transaction.js +++ b/erpnext/public/js/transaction.js @@ -3,6 +3,8 @@ frappe.provide("erpnext"); frappe.require("assets/erpnext/js/controllers/stock_controller.js"); +frappe.require("assets/erpnext/js/utils.js"); + erpnext.TransactionController = erpnext.stock.StockController.extend({ onload: function() { @@ -205,22 +207,37 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ }, company: function() { - if(this.frm.doc.company && this.frm.fields_dict.currency) { - var company_currency = this.get_company_currency(); - if (!this.frm.doc.currency) { - this.frm.set_value("currency", company_currency); - } + var me = this; + var fn = function() { + if(me.frm.doc.company && me.frm.fields_dict.currency) { + var company_currency = me.get_company_currency(); + if (!me.frm.doc.currency) { + me.frm.set_value("currency", company_currency); + } - if (this.frm.doc.currency == company_currency) { - this.frm.set_value("conversion_rate", 1.0); - } - if (this.frm.doc.price_list_currency == company_currency) { - this.frm.set_value('plc_conversion_rate', 1.0); - } + if (me.frm.doc.currency == company_currency) { + me.frm.set_value("conversion_rate", 1.0); + } + if (me.frm.doc.price_list_currency == company_currency) { + me.frm.set_value('plc_conversion_rate', 1.0); + } - this.frm.script_manager.trigger("currency"); - this.apply_pricing_rule(); + me.frm.script_manager.trigger("currency"); + me.apply_pricing_rule(); + } } + + if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date; + else var date = this.frm.doc.transaction_date; + erpnext.get_fiscal_year(this.frm.doc.company, date, fn); + }, + + transaction_date: function() { + erpnext.get_fiscal_year(this.frm.doc.company, this.frm.doc.transaction_date); + }, + + posting_date: function() { + erpnext.get_fiscal_year(this.frm.doc.company, this.frm.doc.posting_date); }, get_company_currency: function() { diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index ef7d03ea458..f72bcc447c6 100644 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -12,6 +12,22 @@ $.extend(erpnext, { return frappe.boot.sysdefaults.currency; }, + get_fiscal_year: function(company, date, fn) { + frappe.call({ + type:"GET", + method: "erpnext.accounts.utils.get_fiscal_year", + args: { + "company": company, + "date": date, + "verbose": '0' + }, + callback: function(r) { + if (r.message) cur_frm.set_value("fiscal_year", r.message[0]); + if (fn) fn(); + } + }); + }, + toggle_naming_series: function() { if(cur_frm.fields_dict.naming_series) { cur_frm.toggle_display("naming_series", cur_frm.doc.__islocal?true:false); diff --git a/erpnext/selling/doctype/installation_note/installation_note.js b/erpnext/selling/doctype/installation_note/installation_note.js index e8dee46fd95..60e2f72ab21 100644 --- a/erpnext/selling/doctype/installation_note/installation_note.js +++ b/erpnext/selling/doctype/installation_note/installation_note.js @@ -4,6 +4,7 @@ cur_frm.cscript.tname = "Installation Note Item"; cur_frm.cscript.fname = "installed_item_details"; +frappe.require("assets/erpnext/js/utils.js"); frappe.ui.form.on_change("Installation Note", "customer", function(frm) { erpnext.utils.get_party_details(frm); }); @@ -69,3 +70,11 @@ erpnext.selling.InstallationNote = frappe.ui.form.Controller.extend({ }); $.extend(cur_frm.cscript, new erpnext.selling.InstallationNote({frm: cur_frm})); + +cur_frm.cscript.company = function(doc, cdt, cdn) { + erpnext.get_fiscal_year(doc.company, doc.inst_date); +} + +cur_frm.cscript.inst_date = function(doc, cdt, cdn){ + erpnext.get_fiscal_year(doc.company, doc.inst_date); +} \ No newline at end of file diff --git a/erpnext/selling/doctype/opportunity/opportunity.js b/erpnext/selling/doctype/opportunity/opportunity.js index df84d72b6b7..b29c03ac0b4 100644 --- a/erpnext/selling/doctype/opportunity/opportunity.js +++ b/erpnext/selling/doctype/opportunity/opportunity.js @@ -8,6 +8,7 @@ frappe.ui.form.on_change("Opportunity", "contact_person", erpnext.utils.get_cont frappe.provide("erpnext.selling"); +frappe.require("assets/erpnext/js/utils.js"); cur_frm.email_field = "contact_email"; // TODO commonify this code @@ -145,3 +146,10 @@ cur_frm.cscript.send_sms = function() { 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/selling/doctype/opportunity/opportunity.json b/erpnext/selling/doctype/opportunity/opportunity.json index 270fe779fe2..a47b21f176b 100644 --- a/erpnext/selling/doctype/opportunity/opportunity.json +++ b/erpnext/selling/doctype/opportunity/opportunity.json @@ -272,13 +272,13 @@ "width": "50px" }, { - "fieldname": "fiscal_year", + "fieldname": "company", "fieldtype": "Link", "in_filter": 1, - "label": "Fiscal Year", - "oldfieldname": "fiscal_year", - "oldfieldtype": "Select", - "options": "Fiscal Year", + "label": "Company", + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", "permlevel": 0, "print_hide": 1, "read_only": 0, @@ -307,13 +307,13 @@ "read_only": 0 }, { - "fieldname": "company", + "fieldname": "fiscal_year", "fieldtype": "Link", "in_filter": 1, - "label": "Company", - "oldfieldname": "company", - "oldfieldtype": "Link", - "options": "Company", + "label": "Fiscal Year", + "oldfieldname": "fiscal_year", + "oldfieldtype": "Select", + "options": "Fiscal Year", "permlevel": 0, "print_hide": 1, "read_only": 0, @@ -388,7 +388,7 @@ "icon": "icon-info-sign", "idx": 1, "is_submittable": 1, - "modified": "2014-09-11 18:53:14.037512", + "modified": "2014-10-07 18:12:19.104820", "modified_by": "Administrator", "module": "Selling", "name": "Opportunity", @@ -396,6 +396,7 @@ "permissions": [ { "amend": 1, + "apply_user_permissions": 1, "cancel": 1, "create": 1, "delete": 1, diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 5f25446ed29..857a2591291 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -169,5 +169,4 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { cur_frm.cscript.send_sms = function() { frappe.require("assets/erpnext/js/sms_manager.js"); var sms_man = new SMSManager(cur_frm.doc); -} - +} \ No newline at end of file diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 628e43e1dfb..65b91f4bd78 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -198,4 +198,4 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { cur_frm.cscript.send_sms = function() { frappe.require("assets/erpnext/js/sms_manager.js"); var sms_man = new SMSManager(cur_frm.doc); -}; +}; \ No newline at end of file diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js index 3729b55c7e3..147a3b1d2c0 100644 --- a/erpnext/stock/doctype/material_request/material_request.js +++ b/erpnext/stock/doctype/material_request/material_request.js @@ -6,6 +6,8 @@ cur_frm.cscript.fname = "indent_details"; {% include 'buying/doctype/purchase_common/purchase_common.js' %}; +frappe.require("assets/erpnext/js/utils.js"); + erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.extend({ onload: function(doc) { this._super(); @@ -194,4 +196,4 @@ cur_frm.cscript['Unstop Material Request'] = function(){ cur_frm.cscript.send_sms = function() { frappe.require("assets/erpnext/js/sms_manager.js"); var sms_man = new SMSManager(cur_frm.doc); -} +} \ 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 96dee3da4f5..d961b40f622 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -1,10 +1,10 @@ -// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors -// License: GNU General Public License v3. See license.txt +// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt cur_frm.cscript.tname = "Stock Entry Detail"; cur_frm.cscript.fname = "mtn_details"; frappe.require("assets/erpnext/js/controllers/stock_controller.js"); +frappe.require("assets/erpnext/js/utils.js"); frappe.provide("erpnext.stock"); erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ @@ -462,4 +462,12 @@ cur_frm.fields_dict.supplier.get_query = function(doc, cdt, cdn) { return { query: "erpnext.controllers.queries.supplier_query" } } cur_frm.add_fetch('production_order', 'total_fixed_cost', 'total_fixed_cost'); -cur_frm.add_fetch('bom_no', 'total_fixed_cost', 'total_fixed_cost'); \ No newline at end of file +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.company, doc.posting_date); +} + +cur_frm.cscript.posting_date = function(doc, cdt, cdn){ + erpnext.get_fiscal_year(doc.company, doc.posting_date); +} diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json index 5f78758c6c6..8cbfbef1eab 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.json +++ b/erpnext/stock/doctype/stock_entry/stock_entry.json @@ -509,17 +509,6 @@ "permlevel": 0, "read_only": 1 }, - { - "fieldname": "fiscal_year", - "fieldtype": "Link", - "in_filter": 0, - "label": "Fiscal Year", - "options": "Fiscal Year", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 1 - }, { "allow_on_submit": 0, "fieldname": "company", @@ -538,6 +527,17 @@ "reqd": 1, "search_index": 0 }, + { + "fieldname": "fiscal_year", + "fieldtype": "Link", + "in_filter": 0, + "label": "Fiscal Year", + "options": "Fiscal Year", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 1 + }, { "allow_on_submit": 1, "fieldname": "select_print_heading", @@ -585,7 +585,7 @@ "is_submittable": 1, "issingle": 0, "max_attachments": 0, - "modified": "2014-09-16 15:56:37.514676", + "modified": "2014-10-03 14:55:44.916658", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry", diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js index 432a999b4ac..27ed872400c 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js @@ -2,6 +2,7 @@ // License: GNU General Public License v3. See license.txt frappe.require("assets/erpnext/js/controllers/stock_controller.js"); +frappe.require("assets/erpnext/js/utils.js"); frappe.provide("erpnext.stock"); erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({ @@ -159,3 +160,11 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({ }); cur_frm.cscript = new erpnext.stock.StockReconciliation({frm: cur_frm}); + +cur_frm.cscript.company = function(doc, cdt, cdn) { + erpnext.get_fiscal_year(doc.company, doc.posting_date); +} + +cur_frm.cscript.posting_date = function(doc, cdt, cdn){ + erpnext.get_fiscal_year(doc.company, doc.posting_date); +} \ No newline at end of file diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json index daba967a582..0035fe7aa65 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json @@ -1,5 +1,5 @@ { - "allow_copy": 1, + "allow_copy": 1, "autoname": "SR/.######", "creation": "2013-03-28 10:35:31", "description": "This tool helps you to update or fix the quantity and valuation of stock in the system. It is typically used to synchronise the system values and what actually exists in your warehouses.", @@ -41,6 +41,14 @@ "print_hide": 1, "read_only": 1 }, + { + "fieldname": "company", + "fieldtype": "Link", + "label": "Company", + "options": "Company", + "permlevel": 0, + "reqd": 1 + }, { "fieldname": "fiscal_year", "fieldtype": "Link", @@ -50,14 +58,6 @@ "print_hide": 1, "reqd": 1 }, - { - "fieldname": "company", - "fieldtype": "Link", - "label": "Company", - "options": "Company", - "permlevel": 0, - "reqd": 1 - }, { "depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)", "fieldname": "expense_account", @@ -118,7 +118,7 @@ "idx": 1, "is_submittable": 1, "max_attachments": 1, - "modified": "2014-05-26 03:05:54.024413", + "modified": "2014-10-08 12:47:52.102135", "modified_by": "Administrator", "module": "Stock", "name": "Stock Reconciliation", diff --git a/erpnext/support/doctype/customer_issue/customer_issue.js b/erpnext/support/doctype/customer_issue/customer_issue.js index 67a265dd027..bcc59eabd3d 100644 --- a/erpnext/support/doctype/customer_issue/customer_issue.js +++ b/erpnext/support/doctype/customer_issue/customer_issue.js @@ -2,6 +2,7 @@ // License: GNU General Public License v3. See license.txt frappe.provide("erpnext.support"); +frappe.require("assets/erpnext/js/utils.js"); frappe.ui.form.on_change("Customer Issue", "customer", function(frm) { erpnext.utils.get_party_details(frm) }); @@ -89,3 +90,11 @@ cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { return{ query: "erpnext.controllers.queries.customer_query" } } + +cur_frm.cscript.company = function(doc, cdt, cdn) { + erpnext.get_fiscal_year(doc.company, doc.complaint_date); +} + +cur_frm.cscript.complaint_date = function(doc, cdt, cdn){ + erpnext.get_fiscal_year(doc.company, doc.complaint_date); +} \ No newline at end of file diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js index e9a7c84a30b..ffdcb3ea75b 100644 --- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js +++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js @@ -2,6 +2,7 @@ // License: GNU General Public License v3. See license.txt frappe.provide("erpnext.support"); +frappe.require("assets/erpnext/js/utils.js"); frappe.ui.form.on_change("Maintenance Visit", "customer", function(frm) { erpnext.utils.get_party_details(frm) }); @@ -92,3 +93,11 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) { cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { return {query: "erpnext.controllers.queries.customer_query" } } + +cur_frm.cscript.company = function(doc, cdt, cdn) { + erpnext.get_fiscal_year(doc.company, doc.mntc_date); +} + +cur_frm.cscript.mntc_date = function(doc, cdt, cdn){ + erpnext.get_fiscal_year(doc.company, doc.mntc_date); +} \ No newline at end of file