Skip to content

Commit 5ff2ae5

Browse files
authored
fix: fetch correct expense account for operations in stock entry (#54278)
1 parent ea0d53e commit 5ff2ae5

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

  • erpnext/manufacturing/doctype/bom

erpnext/manufacturing/doctype/bom/bom.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,15 +1594,10 @@ def get_children(parent: str | None = None, is_root: bool = False, **filters):
15941594
def add_additional_cost(stock_entry, work_order, job_card=None):
15951595
# Add non stock items cost in the additional cost
15961596
stock_entry.additional_costs = []
1597-
company_account = frappe.db.get_value(
1597+
expense_account = frappe.get_value(
15981598
"Company",
15991599
work_order.company,
1600-
["default_expense_account", "default_operating_cost_account"],
1601-
as_dict=1,
1602-
)
1603-
1604-
expense_account = (
1605-
company_account.default_operating_cost_account or company_account.default_expense_account
1600+
"default_operating_cost_account",
16061601
)
16071602
add_non_stock_items_cost(stock_entry, work_order, expense_account, job_card=job_card)
16081603
add_operations_cost(stock_entry, work_order, expense_account, job_card=job_card)
@@ -1685,7 +1680,7 @@ def add_operating_cost_component_wise(
16851680

16861681
per_unit_cost = flt(actual_cp_operating_cost) / flt(row.completed_qty - work_order.produced_qty)
16871682

1688-
if per_unit_cost and expense_account:
1683+
if per_unit_cost:
16891684
stock_entry.append(
16901685
"additional_costs",
16911686
{

0 commit comments

Comments
 (0)