Fixes get_voucher_detail for Stock Reconcilation

This commit is contained in:
Anand Doshi 2014-04-17 11:37:46 +05:30
parent 094610d7ce
commit de1a97d506

View File

@ -33,13 +33,13 @@ class StockController(AccountsController):
if not warehouse_account:
warehouse_account = get_warehouse_account()
stock_ledger = self.get_stock_ledger_details()
voucher_details = self.get_voucher_details(default_expense_account, default_cost_center)
sle_map = self.get_stock_ledger_details()
voucher_details = self.get_voucher_details(default_expense_account, default_cost_center, sle_map)
gl_list = []
warehouse_with_no_account = []
for detail in voucher_details:
sle_list = stock_ledger.get(detail.name)
sle_list = sle_map.get(detail.name)
if sle_list:
for sle in sle_list:
if warehouse_account.get(sle.warehouse):
@ -72,7 +72,11 @@ class StockController(AccountsController):
return process_gl_map(gl_list)
def get_voucher_details(self, default_expense_account, default_cost_center):
def get_voucher_details(self, default_expense_account, default_cost_center, sle_map):
if self.doctype == "Stock Reconciliation":
return [frappe._dict({ "name": voucher_detail_no, "expense_account": default_expense_account,
"cost_center": default_cost_center }) for voucher_detail_no, sle in sle_map.items()]
else:
details = self.get(self.fname)
if default_expense_account or default_cost_center: