From eb00cae86cc3e9f19ea7a7466e3dcba5c7333978 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 27 May 2015 13:18:09 +0530 Subject: [PATCH] Fiscal Year removed from Material Request --- .../production_planning_tool.py | 6 +--- erpnext/public/js/utils.js | 28 ++++++++++--------- .../material_request/material_request.json | 17 +---------- erpnext/stock/reorder_item.py | 11 -------- 4 files changed, 17 insertions(+), 45 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py index 12987901d6..e11863a25f 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -359,10 +359,7 @@ class ProductionPlanningTool(Document): def insert_purchase_request(self): items_to_be_requested = self.get_requested_items() - - from erpnext.accounts.utils import get_fiscal_year - fiscal_year = get_fiscal_year(nowdate())[0] - + purchase_request_list = [] if items_to_be_requested: for item in items_to_be_requested: @@ -372,7 +369,6 @@ class ProductionPlanningTool(Document): "transaction_date": nowdate(), "status": "Draft", "company": self.company, - "fiscal_year": fiscal_year, "requested_by": frappe.session.user, "material_request_type": "Purchase" }) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 5476d147ab..3dfd7e1017 100644 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -14,19 +14,21 @@ $.extend(erpnext, { }, 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(); - } - }); + if(frappe.meta.get_docfield(cur_frm.doctype, "fiscal_year")) { + 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() { diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json index 97345129ab..894b9e1343 100644 --- a/erpnext/stock/doctype/material_request/material_request.json +++ b/erpnext/stock/doctype/material_request/material_request.json @@ -131,21 +131,6 @@ "search_index": 1, "width": "100px" }, - { - "fieldname": "fiscal_year", - "fieldtype": "Link", - "in_filter": 1, - "label": "Fiscal Year", - "oldfieldname": "fiscal_year", - "oldfieldtype": "Select", - "options": "Fiscal Year", - "permlevel": 0, - "print_hide": 1, - "print_width": "150px", - "reqd": 1, - "search_index": 1, - "width": "150px" - }, { "fieldname": "column_break2", "fieldtype": "Column Break", @@ -236,7 +221,7 @@ "icon": "icon-ticket", "idx": 1, "is_submittable": 1, - "modified": "2015-02-20 05:07:33.215371", + "modified": "2015-05-27 15:36:06.818491", "modified_by": "Administrator", "module": "Stock", "name": "Material Request", diff --git a/erpnext/stock/reorder_item.py b/erpnext/stock/reorder_item.py index 30fe755bd4..cab419f3d3 100644 --- a/erpnext/stock/reorder_item.py +++ b/erpnext/stock/reorder_item.py @@ -3,7 +3,6 @@ import frappe from frappe.utils import flt, cstr, nowdate, add_days, cint -from erpnext.accounts.utils import get_fiscal_year, FiscalYearError def reorder_item(): """ Reorder item if stock reaches reorder level""" @@ -83,7 +82,6 @@ def get_item_warehouse_projected_qty(): def create_material_request(material_requests): """ Create indent on reaching reorder level """ mr_list = [] - defaults = frappe.defaults.get_defaults() exceptions_list = [] def _log_exception(): @@ -93,14 +91,6 @@ def create_material_request(material_requests): else: exceptions_list.append(frappe.get_traceback()) - try: - current_fiscal_year = get_fiscal_year(nowdate())[0] or defaults.fiscal_year - - except FiscalYearError: - _log_exception() - notify_errors(exceptions_list) - return - for request_type in material_requests: for company in material_requests[request_type]: try: @@ -111,7 +101,6 @@ def create_material_request(material_requests): mr = frappe.new_doc("Material Request") mr.update({ "company": company, - "fiscal_year": current_fiscal_year, "transaction_date": nowdate(), "material_request_type": request_type })