Skip to content

Commit

Permalink
fix: Validate for missing expense account (#36078)
Browse files Browse the repository at this point in the history
fix: Validate for missing expense account (#36078)

* fix: Validate for missing expense account

* fix: Validate for missing expense account

(cherry picked from commit ce9164e)

Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
  • Loading branch information
mergify[bot] and deepeshgarg007 authored Jul 11, 2023
1 parent 7925fc7 commit f4f886c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions erpnext/controllers/stock_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ def get_gl_entries(
warehouse_asset_account = warehouse_account[item_row.get("warehouse")]["account"]

expense_account = frappe.get_cached_value("Company", self.company, "default_expense_account")
if not expense_account:
frappe.throw(
_(
"Please set default cost of goods sold account in company {0} for booking rounding gain and loss during stock transfer"
).format(frappe.bold(self.company))
)

gl_list.append(
self.get_gl_dict(
Expand Down

0 comments on commit f4f886c

Please sign in to comment.