Merge branch 'develop'
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index e893b1f..2bdfe47 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1 +1 @@
-__version__ = '4.6.1'
+__version__ = '4.6.2'
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index 83853dd..842409f 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -112,6 +112,6 @@
test_recurring_document(self, test_records)
-test_dependencies = ["BOM"]
+test_dependencies = ["BOM", "Item Price"]
test_records = frappe.get_test_records('Purchase Order')
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index b095984..0f677a0 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.6.1"
+app_version = "4.6.2"
error_report_email = "support@erpnext.com"
diff --git a/erpnext/stock/doctype/item_price/test_records.json b/erpnext/stock/doctype/item_price/test_records.json
index b4ceb92..36870cd 100644
--- a/erpnext/stock/doctype/item_price/test_records.json
+++ b/erpnext/stock/doctype/item_price/test_records.json
@@ -16,5 +16,11 @@
"item_code": "_Test Item 2",
"price_list": "_Test Price List Rest of the World",
"price_list_rate": 20
+ },
+ {
+ "doctype": "Item Price",
+ "item_code": "_Test Item Home Desktop 100",
+ "price_list": "_Test Price List",
+ "price_list_rate": 1000
}
]
diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
index 67f621a..69751a2 100644
--- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
@@ -151,6 +151,6 @@
accounts_settings.save()
-test_dependencies = ["BOM"]
+test_dependencies = ["BOM", "Item Price"]
test_records = frappe.get_test_records('Purchase Receipt')
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index 2956170..7dc8d83 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -275,7 +275,7 @@
incoming_rate = flt(sle.incoming_rate)
actual_qty = flt(sle.actual_qty)
- intialize_stock_queue(stock_queue, sle.item_code, sle.warehouse)
+ intialize_stock_queue(stock_queue, sle.item_code, sle.warehouse, actual_qty)
if actual_qty > 0:
if stock_queue[-1][0] > 0:
@@ -289,7 +289,7 @@
else:
qty_to_pop = abs(actual_qty)
while qty_to_pop:
- intialize_stock_queue(stock_queue, sle.item_code, sle.warehouse)
+ intialize_stock_queue(stock_queue, sle.item_code, sle.warehouse, actual_qty)
batch = stock_queue[0]
@@ -318,9 +318,9 @@
return abs(valuation_rate)
-def intialize_stock_queue(stock_queue, item_code, warehouse):
+def intialize_stock_queue(stock_queue, item_code, warehouse, actual_qty):
if not stock_queue:
- estimated_val_rate = get_valuation_rate(item_code, warehouse)
+ estimated_val_rate = get_valuation_rate(item_code, warehouse) if actual_qty < 0 else 0
stock_queue.append([0, estimated_val_rate])
def _raise_exceptions(args, verbose=1):
diff --git a/setup.py b/setup.py
index 204d833..34207e8 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os
-version = "4.6.1"
+version = "4.6.2"
with open("requirements.txt", "r") as f:
install_requires = f.readlines()