From 9614b552fd195aefa2a1301918f267b83938c4fa Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 8 Oct 2014 12:55:06 +0530 Subject: [PATCH] fiscal year auto-fetch added to c-form, installation_note, stock_reconciliation, customer_issue, maintanence_visit & removed for Expense Claim --- erpnext/accounts/doctype/c_form/c_form.js | 10 ++++++++++ .../hr/doctype/expense_claim/expense_claim.js | 9 --------- .../installation_note/installation_note.js | 9 +++++++++ .../stock_reconciliation.js | 9 +++++++++ .../stock_reconciliation.json | 20 +++++++++---------- .../doctype/customer_issue/customer_issue.js | 9 +++++++++ .../maintenance_visit/maintenance_visit.js | 9 +++++++++ 7 files changed, 56 insertions(+), 19 deletions(-) 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/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js index a4a64d9092a..e070b3f13dd 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.js +++ b/erpnext/hr/doctype/expense_claim/expense_claim.js @@ -2,7 +2,6 @@ // License: GNU General Public License v3. See license.txt frappe.provide("erpnext.hr"); -frappe.require("assets/erpnext/js/utils.js"); erpnext.hr.ExpenseClaimController = frappe.ui.form.Controller.extend({ make_bank_voucher: function() { @@ -154,12 +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); } -} - -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/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/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