From 5ff2ae5a83565adde747728c99c9b49e441ba21e Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 14 Apr 2026 15:25:07 +0530 Subject: [PATCH] fix: fetch correct expense account for operations in stock entry (#54278) --- erpnext/manufacturing/doctype/bom/bom.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index 1bf10247f2b..8180284e9d5 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -1594,15 +1594,10 @@ def get_children(parent: str | None = None, is_root: bool = False, **filters): def add_additional_cost(stock_entry, work_order, job_card=None): # Add non stock items cost in the additional cost stock_entry.additional_costs = [] - company_account = frappe.db.get_value( + expense_account = frappe.get_value( "Company", work_order.company, - ["default_expense_account", "default_operating_cost_account"], - as_dict=1, - ) - - expense_account = ( - company_account.default_operating_cost_account or company_account.default_expense_account + "default_operating_cost_account", ) add_non_stock_items_cost(stock_entry, work_order, expense_account, job_card=job_card) add_operations_cost(stock_entry, work_order, expense_account, job_card=job_card) @@ -1685,7 +1680,7 @@ def add_operating_cost_component_wise( per_unit_cost = flt(actual_cp_operating_cost) / flt(row.completed_qty - work_order.produced_qty) - if per_unit_cost and expense_account: + if per_unit_cost: stock_entry.append( "additional_costs", {