diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 29049f7def9..bd2d4364533 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 2543fa4667f..c0aed518452 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 f911956111a..ab331dc3c22 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 dc552cb7739..95de739e0fd 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