From 4f0e5db2162e3559df13a8feb94b677cbe6b1edc Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 10 Oct 2014 20:54:57 +0530 Subject: [PATCH] Stock balance grid report deprecated and moved to server side --- erpnext/config/stock.py | 16 +- erpnext/stock/page/stock_balance/README.md | 1 - erpnext/stock/page/stock_balance/__init__.py | 0 .../stock/page/stock_balance/stock_balance.js | 192 ------------------ .../page/stock_balance/stock_balance.json | 23 --- 5 files changed, 5 insertions(+), 227 deletions(-) delete mode 100644 erpnext/stock/page/stock_balance/README.md delete mode 100644 erpnext/stock/page/stock_balance/__init__.py delete mode 100644 erpnext/stock/page/stock_balance/stock_balance.js delete mode 100644 erpnext/stock/page/stock_balance/stock_balance.json diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py index 7a4345e4d2..04e45d45a1 100644 --- a/erpnext/config/stock.py +++ b/erpnext/config/stock.py @@ -142,10 +142,10 @@ def get_data(): "doctype": "Item", }, { - "type": "page", - "name": "stock-balance", - "label": _("Stock Balance"), - "icon": "icon-table", + "type": "report", + "is_query_report": True, + "name": "Stock Balance", + "doctype": "Warehouse" }, { "type": "report", @@ -170,13 +170,7 @@ def get_data(): "name": "stock-analytics", "label": _("Stock Analytics"), "icon": "icon-bar-chart" - }, - { - "type": "report", - "is_query_report": True, - "name": "Warehouse-Wise Stock Balance", - "doctype": "Warehouse" - }, + } ] }, { diff --git a/erpnext/stock/page/stock_balance/README.md b/erpnext/stock/page/stock_balance/README.md deleted file mode 100644 index 6522aeb099..0000000000 --- a/erpnext/stock/page/stock_balance/README.md +++ /dev/null @@ -1 +0,0 @@ -Stock balances on a particular day, per warehouse. \ No newline at end of file diff --git a/erpnext/stock/page/stock_balance/__init__.py b/erpnext/stock/page/stock_balance/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/stock/page/stock_balance/stock_balance.js b/erpnext/stock/page/stock_balance/stock_balance.js deleted file mode 100644 index 198d317824..0000000000 --- a/erpnext/stock/page/stock_balance/stock_balance.js +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors -// License: GNU General Public License v3. See license.txt - -frappe.require("assets/erpnext/js/stock_analytics.js"); - -frappe.pages['stock-balance'].onload = function(wrapper) { - frappe.ui.make_app_page({ - parent: wrapper, - title: __('Stock Balance'), - single_column: true - }); - - new erpnext.StockBalance(wrapper); - - wrapper.appframe.add_module_icon("Stock"); -} - -erpnext.StockBalance = erpnext.StockAnalytics.extend({ - init: function(wrapper) { - this._super(wrapper, { - title: __("Stock Balance"), - doctypes: ["Item", "Item Group", "Warehouse", "Stock Ledger Entry", "Brand", - "Stock Entry", "Project", "Serial No"], - }); - }, - setup_columns: function() { - this.columns = [ - {id: "name", name: __("Item"), field: "name", width: 300, - formatter: this.tree_formatter}, - {id: "item_name", name: __("Item Name"), field: "item_name", width: 100}, - {id: "description", name: __("Description"), field: "description", width: 200, - formatter: this.text_formatter}, - {id: "brand", name: __("Brand"), field: "brand", width: 100}, - {id: "stock_uom", name: __("UOM"), field: "stock_uom", width: 100}, - {id: "opening_qty", name: __("Opening Qty"), field: "opening_qty", width: 100, - formatter: this.currency_formatter}, - {id: "inflow_qty", name: __("In Qty"), field: "inflow_qty", width: 100, - formatter: this.currency_formatter}, - {id: "outflow_qty", name: __("Out Qty"), field: "outflow_qty", width: 100, - formatter: this.currency_formatter}, - {id: "closing_qty", name: __("Closing Qty"), field: "closing_qty", width: 100, - formatter: this.currency_formatter}, - - {id: "opening_value", name: __("Opening Value"), field: "opening_value", width: 100, - formatter: this.currency_formatter}, - {id: "inflow_value", name: __("In Value"), field: "inflow_value", width: 100, - formatter: this.currency_formatter}, - {id: "outflow_value", name: __("Out Value"), field: "outflow_value", width: 100, - formatter: this.currency_formatter}, - {id: "closing_value", name: __("Closing Value"), field: "closing_value", width: 100, - formatter: this.currency_formatter}, - {id: "valuation_rate", name: __("Valuation Rate"), field: "valuation_rate", width: 100, - formatter: this.currency_formatter}, - ]; - }, - - filters: [ - {fieldtype:"Select", label: __("Brand"), link:"Brand", fieldname: "brand", - default_value: __("Select Brand..."), filter: function(val, item, opts) { - return val == opts.default_value || item.brand == val || item._show; - }, link_formatter: {filter_input: "brand"}}, - {fieldtype:"Select", label: __("Warehouse"), link:"Warehouse", fieldname: "warehouse", - default_value: __("Select Warehouse..."), filter: function(val, item, opts, me) { - return me.apply_zero_filter(val, item, opts, me); - }}, - {fieldtype:"Select", label: __("Project"), link:"Project", fieldname: "project", - default_value: __("Select Project..."), filter: function(val, item, opts, me) { - return me.apply_zero_filter(val, item, opts, me); - }, link_formatter: {filter_input: "project"}}, - {fieldtype:"Date", label: __("From Date"), fieldname: "from_date"}, - {fieldtype:"Label", label: __("To")}, - {fieldtype:"Date", label: __("To Date"), fieldname: "to_date"}, - {fieldtype:"Button", label: __("Refresh"), icon:"icon-refresh icon-white"}, - {fieldtype:"Button", label: __("Reset Filters"), icon: "icon-filter"} - ], - - setup_plot_check: function() { - return; - }, - - prepare_data: function() { - this.stock_entry_map = this.make_name_map(frappe.report_dump.data["Stock Entry"], "name"); - this._super(); - }, - - prepare_balances: function() { - var me = this; - var from_date = dateutil.str_to_obj(this.from_date); - var to_date = dateutil.str_to_obj(this.to_date); - var data = frappe.report_dump.data["Stock Ledger Entry"]; - - this.item_warehouse = {}; - this.serialized_buying_rates = this.get_serialized_buying_rates(); - - for(var i=0, j=data.length; i 0) - item.valuation_rate = flt(item.closing_value) / flt(item.closing_qty); - else item.valuation_rate = 0.0 - }); - }, - - update_groups: function() { - var me = this; - - $.each(this.data, function(i, item) { - // update groups - if(!item.is_group && me.apply_filter(item, "brand")) { - var parent = me.parent_map[item.name]; - while(parent) { - parent_group = me.item_by_name[parent]; - $.each(me.columns, function(c, col) { - if (col.formatter == me.currency_formatter && col.field != "valuation_rate") { - parent_group[col.field] = flt(parent_group[col.field]) + flt(item[col.field]); - } - }); - - // show parent if filtered by brand - if(item.brand == me.brand) - parent_group._show = true; - - parent = me.parent_map[parent]; - } - } - }); - }, - - get_plot_data: function() { - return; - } -}); diff --git a/erpnext/stock/page/stock_balance/stock_balance.json b/erpnext/stock/page/stock_balance/stock_balance.json deleted file mode 100644 index 6f25be4407..0000000000 --- a/erpnext/stock/page/stock_balance/stock_balance.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "creation": "2012-12-27 18:57:47.000000", - "docstatus": 0, - "doctype": "Page", - "icon": "icon-table", - "idx": 1, - "modified": "2013-07-11 14:44:15.000000", - "modified_by": "Administrator", - "module": "Stock", - "name": "stock-balance", - "owner": "Administrator", - "page_name": "stock-balance", - "roles": [ - { - "role": "Material Manager" - }, - { - "role": "Analytics" - } - ], - "standard": "Yes", - "title": "Stock Balance" -} \ No newline at end of file