fix: fetch correct expense account for operations in stock entry (#54278)

This commit is contained in:
Mihir Kandoi
2026-04-14 15:25:07 +05:30
committed by GitHub
parent ea0d53e2f3
commit 5ff2ae5a83

View File

@@ -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",
{