mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-23 16:48:30 +00:00
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com> fix: fetch correct expense account for operations in stock entry (#54278)
This commit is contained in:
@@ -1585,15 +1585,10 @@ def get_children(parent=None, is_root=False, **filters):
|
|||||||
def add_additional_cost(stock_entry, work_order, job_card=None):
|
def add_additional_cost(stock_entry, work_order, job_card=None):
|
||||||
# Add non stock items cost in the additional cost
|
# Add non stock items cost in the additional cost
|
||||||
stock_entry.additional_costs = []
|
stock_entry.additional_costs = []
|
||||||
company_account = frappe.db.get_value(
|
expense_account = frappe.get_value(
|
||||||
"Company",
|
"Company",
|
||||||
work_order.company,
|
work_order.company,
|
||||||
["default_expense_account", "default_operating_cost_account"],
|
"default_operating_cost_account",
|
||||||
as_dict=1,
|
|
||||||
)
|
|
||||||
|
|
||||||
expense_account = (
|
|
||||||
company_account.default_operating_cost_account or company_account.default_expense_account
|
|
||||||
)
|
)
|
||||||
add_non_stock_items_cost(stock_entry, work_order, expense_account, job_card=job_card)
|
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)
|
add_operations_cost(stock_entry, work_order, expense_account, job_card=job_card)
|
||||||
@@ -1676,7 +1671,7 @@ def add_operating_cost_component_wise(
|
|||||||
|
|
||||||
per_unit_cost = flt(actual_cp_operating_cost) / flt(row.completed_qty - work_order.produced_qty)
|
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(
|
stock_entry.append(
|
||||||
"additional_costs",
|
"additional_costs",
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user