Skip to content

Commit

Permalink
Merge pull request frappe#17640 from nabinhait/gle-opening-stock-reco…
Browse files Browse the repository at this point in the history
…-dev

fix: GL Entry for opening stock reconciliation
  • Loading branch information
rmehta authored May 21, 2019
2 parents 8c78299 + 9764eff commit 397a48d
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions erpnext/controllers/stock_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def get_gl_entries(self, warehouse_account=None, default_expense_account=None,
"cost_center": item_row.cost_center,
"remarks": self.get("remarks") or "Accounting Entry for Stock",
"debit": flt(sle.stock_value_difference, 2),
"is_opening": item_row.get("is_opening"),
}, warehouse_account[sle.warehouse]["account_currency"]))

# to target warehouse / expense account
Expand All @@ -89,7 +90,8 @@ def get_gl_entries(self, warehouse_account=None, default_expense_account=None,
"cost_center": item_row.cost_center,
"remarks": self.get("remarks") or "Accounting Entry for Stock",
"credit": flt(sle.stock_value_difference, 2),
"project": item_row.get("project") or self.get("project")
"project": item_row.get("project") or self.get("project"),
"is_opening": item_row.get("is_opening")
}))
elif sle.warehouse not in warehouse_with_no_account:
warehouse_with_no_account.append(sle.warehouse)
Expand Down Expand Up @@ -123,8 +125,17 @@ def update_stock_ledger_entries(self, sle):

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()]
reconciliation_purpose = frappe.db.get_value(self.doctype, self.name, "purpose")
is_opening = "Yes" if reconciliation_purpose == "Opening Stock" else "No"
details = []
for voucher_detail_no, sle in sle_map.items():
details.append(frappe._dict({
"name": voucher_detail_no,
"expense_account": default_expense_account,
"cost_center": default_cost_center,
"is_opening": is_opening
}))
return details
else:
details = self.get("items")

Expand Down

0 comments on commit 397a48d

Please sign in to comment.