Merge pull request #4345 from nabinhait/stock_reco

[fix] Get items in stock reconciliation based on default warehouse
This commit is contained in:
Rushabh Mehta 2015-12-01 16:50:32 +05:30
commit 84f44ad5eb

View File

@ -249,18 +249,26 @@ class StockReconciliation(StockController):
@frappe.whitelist() @frappe.whitelist()
def get_items(warehouse, posting_date, posting_time): def get_items(warehouse, posting_date, posting_time):
items = frappe.get_list("Item", fields=["name"], filters= items = frappe.get_list("Bin", fields=["item_code"], filters={"warehouse": warehouse}, as_list=1)
{"is_stock_item": 1, "has_serial_no": 0, "has_batch_no": 0, "has_variants": 0})
for item in items: items += frappe.get_list("Item", fields=["name"], filters= {"is_stock_item": 1, "has_serial_no": 0,
item.item_code = item.name "has_batch_no": 0, "has_variants": 0, "default_warehouse": warehouse}, as_list=1)
item.warehouse = warehouse
item.qty, item.valuation_rate = get_stock_balance(item.name, warehouse, res = []
posting_date, posting_time, with_valuation_rate=True) for item in set(items):
item.current_qty = item.qty stock_bal = get_stock_balance(item[0], warehouse, posting_date, posting_time,
item.current_valuation_rate = item.valuation_rate with_valuation_rate=True)
del item["name"]
res.append({
"item_code": item[0],
"warehouse": warehouse,
"qty": stock_bal[0],
"valuation_rate": stock_bal[1],
"current_qty": stock_bal[0],
"current_valuation_rate": stock_bal[1]
})
return items return res
@frappe.whitelist() @frappe.whitelist()
def get_stock_balance_for(item_code, warehouse, posting_date, posting_time): def get_stock_balance_for(item_code, warehouse, posting_date, posting_time):