Merge branch 'develop'
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index 330025d..ef6eca3 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1 +1 @@
-__version__ = '4.5.0'
+__version__ = '4.5.1'
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 686b351..a8e5732 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -4,7 +4,7 @@
app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
app_icon = "icon-th"
app_color = "#e74c3c"
-app_version = "4.5.0"
+app_version = "4.5.1"
error_report_email = "support@erpnext.com"
diff --git a/erpnext/patches/v4_2/fix_gl_entries_for_stock_transactions.py b/erpnext/patches/v4_2/fix_gl_entries_for_stock_transactions.py
new file mode 100644
index 0000000..e065d2d
--- /dev/null
+++ b/erpnext/patches/v4_2/fix_gl_entries_for_stock_transactions.py
@@ -0,0 +1,26 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ warehouses_with_account = frappe.db.sql_list("""select master_name from tabAccount
+ where ifnull(account_type, '') = 'Warehouse'""")
+
+ stock_vouchers_without_gle = frappe.db.sql("""select distinct sle.voucher_type, sle.voucher_no
+ from `tabStock Ledger Entry` sle
+ where sle.warehouse in (%s)
+ and not exists(select name from `tabGL Entry`
+ where voucher_type=sle.voucher_type and voucher_no=sle.voucher_no)
+ order by sle.posting_date""" %
+ ', '.join(['%s']*len(warehouses_with_account)), tuple(warehouses_with_account))
+
+ for voucher_type, voucher_no in stock_vouchers_without_gle:
+ print voucher_type, voucher_no
+ frappe.db.sql("""delete from `tabGL Entry`
+ where voucher_type=%s and voucher_no=%s""", (voucher_type, voucher_no))
+
+ voucher = frappe.get_doc(voucher_type, voucher_no)
+ voucher.make_gl_entries()
+ frappe.db.commit()
diff --git a/erpnext/stock/doctype/item/item_list.js b/erpnext/stock/doctype/item/item_list.js
index 330faed..e1cd020 100644
--- a/erpnext/stock/doctype/item/item_list.js
+++ b/erpnext/stock/doctype/item/item_list.js
@@ -1,5 +1,5 @@
frappe.listview_settings['Item'] = {
- add_fields: ["item_name", "stock_uom", "item_group", "image",
- "is_stock_item", "is_sales_item", "is_purchase_item",
- "is_manufactured_item", "show_in_website"]
+ add_fields: ["`tabItem`.`item_name`", "`tabItem`.`stock_uom`", "`tabItem`.`item_group`", "`tabItem`.`image`",
+ "`tabItem`.`is_stock_item`", "`tabItem`.`is_sales_item`", "`tabItem`.`is_purchase_item`",
+ "`tabItem`.`is_manufactured_item`", "`tabItem`.`show_in_website`"]
};
diff --git a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py b/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py
index 775f6f1..dc552cb 100644
--- a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py
+++ b/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py
@@ -71,10 +71,10 @@
for d in sle:
iwb_map.setdefault(d.company, {}).setdefault(d.item_code, {}).\
setdefault(d.warehouse, frappe._dict({\
- "opening_qty": 0.0, "opening_val": 0.0,
- "in_qty": 0.0, "in_val": 0.0,
- "out_qty": 0.0, "out_val": 0.0,
- "bal_qty": 0.0, "bal_val": 0.0,
+ "opening_qty": 0.0, "opening_val": 0.0,
+ "in_qty": 0.0, "in_val": 0.0,
+ "out_qty": 0.0, "out_val": 0.0,
+ "bal_qty": 0.0, "bal_val": 0.0,
"val_rate": 0.0, "uom": None
}))
qty_dict = iwb_map[d.company][d.item_code][d.warehouse]
@@ -82,19 +82,19 @@
if d.posting_date < filters["from_date"]:
qty_dict.opening_qty += flt(d.actual_qty)
- qty_dict.opening_val += flt(d.actual_qty * d.valuation_rate)
+ qty_dict.opening_val += flt(d.actual_qty) * flt(d.valuation_rate)
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 * d.valuation_rate)
+ qty_dict.in_val += flt(d.actual_qty) * flt(d.valuation_rate)
else:
qty_dict.out_qty += abs(flt(d.actual_qty))
- qty_dict.out_val += flt(abs(flt(d.actual_qty)) * d.valuation_rate)
+ qty_dict.out_val += flt(abs(flt(d.actual_qty) * flt(d.valuation_rate)))
qty_dict.bal_qty += flt(d.actual_qty)
- qty_dict.bal_val += flt(d.actual_qty * d.valuation_rate)
+ qty_dict.bal_val += flt(d.actual_qty) * flt(d.valuation_rate)
return iwb_map
diff --git a/setup.py b/setup.py
index 1e7adf6..681b6f7 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os
-version = "4.5.0"
+version = "4.5.1"
with open("requirements.txt", "r") as f:
install_requires = f.readlines()