Skip to content

Commit 63ec36a

Browse files
fix: fetch correct expense account for operations in stock entry (backport #54278) (#54281)
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com> fix: fetch correct expense account for operations in stock entry (#54278)
1 parent bd6269b commit 63ec36a

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
@@ -1585,15 +1585,10 @@ def get_children(parent=None, is_root=False, **filters):
15851585
def add_additional_cost(stock_entry, work_order, job_card=None):
15861586
# Add non stock items cost in the additional cost
15871587
stock_entry.additional_costs = []
1588-
company_account = frappe.db.get_value(
1588+
expense_account = frappe.get_value(
15891589
"Company",
15901590
work_order.company,
1591-
["default_expense_account", "default_operating_cost_account"],
1592-
as_dict=1,
1593-
)
1594-
1595-
expense_account = (
1596-
company_account.default_operating_cost_account or company_account.default_expense_account
1591+
"default_operating_cost_account",
15971592
)
15981593
add_non_stock_items_cost(stock_entry, work_order, expense_account, job_card=job_card)
15991594
add_operations_cost(stock_entry, work_order, expense_account, job_card=job_card)
@@ -1676,7 +1671,7 @@ def add_operating_cost_component_wise(
16761671

16771672
per_unit_cost = flt(actual_cp_operating_cost) / flt(row.completed_qty - work_order.produced_qty)
16781673

1679-
if per_unit_cost and expense_account:
1674+
if per_unit_cost:
16801675
stock_entry.append(
16811676
"additional_costs",
16821677
{

0 commit comments

Comments
 (0)