From 802a73dcefa88cdbc4a5af1ca50a870d07ac10a9 Mon Sep 17 00:00:00 2001 From: Pandiyan P Date: Wed, 3 Jun 2026 13:10:26 +0530 Subject: [PATCH] fix(stock): set stock received but not billed account for purchase (#55149) (cherry picked from commit c4d28a261271c69853efb51ecd481b9aa94fd961) --- erpnext/stock/get_item_details.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 8c205a10874..d4145fc879e 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -518,10 +518,21 @@ def get_basic_details(args, item, overwrite_warehouse=True): args.name, args.conversion_rate, item.name, out.conversion_factor ) + expense_account_field = "default_expense_account" + if ( + item.is_stock_item + and erpnext.is_perpetual_inventory_enabled(ctx.company) + and ( + ctx.doctype == "Purchase Receipt" + or (ctx.doctype == "Purchase Invoice" and ctx.get("update_stock")) + ) + ): + expense_account_field = "stock_received_but_not_billed" + # if default specified in item is for another company, fetch from company for d in [ ["Account", "income_account", "default_income_account"], - ["Account", "expense_account", "default_expense_account"], + ["Account", "expense_account", expense_account_field], ["Cost Center", "cost_center", "cost_center"], ["Warehouse", "warehouse", ""], ]: