From 7820b171d31b3cf409bf60ce2f77703655926215 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 10 Oct 2014 18:02:23 +0530 Subject: [PATCH] Stock balance grid report deprecated and moved to server side --- erpnext/patches.txt | 3 +- .../__init__.py | 0 .../stock_balance.js} | 8 ++--- .../stock_balance.json} | 11 +++---- .../stock_balance.py} | 30 +++++++++++-------- 5 files changed, 30 insertions(+), 22 deletions(-) rename erpnext/stock/report/{warehouse_wise_stock_balance => stock_balance}/__init__.py (100%) rename erpnext/stock/report/{warehouse_wise_stock_balance/warehouse_wise_stock_balance.js => stock_balance/stock_balance.js} (75%) rename erpnext/stock/report/{warehouse_wise_stock_balance/warehouse_wise_stock_balance.json => stock_balance/stock_balance.json} (57%) rename erpnext/stock/report/{warehouse_wise_stock_balance/warehouse_wise_stock_balance.py => stock_balance/stock_balance.py} (80%) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 29049f7def..bd2d436453 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -81,4 +81,5 @@ erpnext.patches.v4_2.default_website_style erpnext.patches.v4_2.set_company_country erpnext.patches.v4_2.update_sales_order_invoice_field_name erpnext.patches.v4_2.cost_of_production_cycle -erpnext.patches.v4_2.seprate_manufacture_and_repack \ No newline at end of file +erpnext.patches.v4_2.seprate_manufacture_and_repack +execute:frappe.delete_doc("Report", "Warehouse-Wise Stock Balance") diff --git a/erpnext/stock/report/warehouse_wise_stock_balance/__init__.py b/erpnext/stock/report/stock_balance/__init__.py similarity index 100% rename from erpnext/stock/report/warehouse_wise_stock_balance/__init__.py rename to erpnext/stock/report/stock_balance/__init__.py diff --git a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.js b/erpnext/stock/report/stock_balance/stock_balance.js similarity index 75% rename from erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.js rename to erpnext/stock/report/stock_balance/stock_balance.js index 2543fa4667..c0aed51845 100644 --- a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.js +++ b/erpnext/stock/report/stock_balance/stock_balance.js @@ -1,7 +1,7 @@ -// 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 and contributors +// For license information, please see license.txt -frappe.query_reports["Warehouse-Wise Stock Balance"] = { +frappe.query_reports["Stock Balance"] = { "filters": [ { "fieldname":"from_date", @@ -18,4 +18,4 @@ frappe.query_reports["Warehouse-Wise Stock Balance"] = { "default": frappe.datetime.get_today() } ] -} \ No newline at end of file +} diff --git a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.json b/erpnext/stock/report/stock_balance/stock_balance.json similarity index 57% rename from erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.json rename to erpnext/stock/report/stock_balance/stock_balance.json index f911956111..ab331dc3c2 100644 --- a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.json +++ b/erpnext/stock/report/stock_balance/stock_balance.json @@ -1,16 +1,17 @@ { + "add_total_row": 0, "apply_user_permissions": 1, - "creation": "2013-06-05 11:00:31", + "creation": "2014-10-10 17:58:11.577901", + "disabled": 0, "docstatus": 0, "doctype": "Report", - "idx": 1, "is_standard": "Yes", - "modified": "2014-06-03 07:18:17.384923", + "modified": "2014-10-10 17:58:11.577901", "modified_by": "Administrator", "module": "Stock", - "name": "Warehouse-Wise Stock Balance", + "name": "Stock Balance", "owner": "Administrator", "ref_doctype": "Stock Ledger Entry", - "report_name": "Warehouse-Wise Stock Balance", + "report_name": "Stock Balance", "report_type": "Script Report" } \ No newline at end of file diff --git a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py similarity index 80% rename from erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py rename to erpnext/stock/report/stock_balance/stock_balance.py index dc552cb773..95de739e0f 100644 --- a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py +++ b/erpnext/stock/report/stock_balance/stock_balance.py @@ -59,9 +59,9 @@ def get_conditions(filters): def get_stock_ledger_entries(filters): conditions = get_conditions(filters) return frappe.db.sql("""select item_code, warehouse, posting_date, - actual_qty, valuation_rate, stock_uom, company + actual_qty, valuation_rate, stock_uom, company, voucher_type, qty_after_transaction from `tabStock Ledger Entry` - where docstatus < 2 %s order by item_code, warehouse""" % + where docstatus < 2 %s order by posting_date, posting_time, name""" % conditions, as_dict=1) def get_item_warehouse_map(filters): @@ -80,21 +80,27 @@ def get_item_warehouse_map(filters): qty_dict = iwb_map[d.company][d.item_code][d.warehouse] qty_dict.uom = d.stock_uom + if d.voucher_type == "Stock Reconciliation": + qty_diff = flt(d.qty_after_transaction) - qty_dict.bal_qty + value_diff = flt(d.stock_value) - qty_dict.bal_val + else: + qty_diff = flt(d.actual_qty) + value_diff = flt(d.actual_qty) * flt(d.valuation_rate) + if d.posting_date < filters["from_date"]: - qty_dict.opening_qty += flt(d.actual_qty) - qty_dict.opening_val += flt(d.actual_qty) * flt(d.valuation_rate) + qty_dict.opening_qty += qty_diff + qty_dict.opening_val += value_diff elif d.posting_date >= filters["from_date"] and d.posting_date <= filters["to_date"]: qty_dict.val_rate = d.valuation_rate - - if flt(d.actual_qty) > 0: - qty_dict.in_qty += flt(d.actual_qty) - qty_dict.in_val += flt(d.actual_qty) * flt(d.valuation_rate) + if qty_diff > 0: + qty_dict.in_qty += qty_diff + qty_dict.in_val += value_diff else: - qty_dict.out_qty += abs(flt(d.actual_qty)) - qty_dict.out_val += flt(abs(flt(d.actual_qty) * flt(d.valuation_rate))) + qty_dict.out_qty += abs(qty_diff) + qty_dict.out_val += abs(value_diff) - qty_dict.bal_qty += flt(d.actual_qty) - qty_dict.bal_val += flt(d.actual_qty) * flt(d.valuation_rate) + qty_dict.bal_qty += qty_diff + qty_dict.bal_val += value_diff return iwb_map