From e21b0775267e4a9920beb15d90fea8d3386091ea Mon Sep 17 00:00:00 2001 From: Jatin3128 <140256508+Jatin3128@users.noreply.github.com> Date: Mon, 29 Jun 2026 17:22:20 +0530 Subject: [PATCH] fix: carry item-level project to Purchase Receipt GL entries (#56568) Purchase Receipt stock and asset GL lines used the item row's cost center but always fell back to the document-level project, unlike Purchase Invoice which uses the item-level project. add_gl_entry accepted a project argument but never wrote it to the GL dict, so the inward, Stock Received But Not Billed, landed cost, divisional loss, sub-contracting and exchange rate lines dropped the row's project. Write project into the GL dict and pass project=item.project on the entries that were missing it, so project behaves like cost center and matches Purchase Invoice. Ticket: 72523 (cherry picked from commit 6f97c7199c4f65e5e2fda31d99905077f2d2a2bc) --- erpnext/controllers/stock_controller.py | 3 +++ erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 32968952fc6..f58c831922a 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -1490,6 +1490,9 @@ class StockController(AccountsController): "remarks": remarks, } + if project: + gl_entry.update({"project": project}) + if voucher_detail_no: gl_entry.update({"voucher_detail_no": voucher_detail_no}) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index c27e2e40f30..10099631a75 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -493,6 +493,7 @@ class PurchaseReceipt(BuyingController): remarks=remarks, against_account=stock_asset_rbnb, account_currency=account_currency, + project=item.project, item=item, ) @@ -535,6 +536,7 @@ class PurchaseReceipt(BuyingController): against_account=stock_asset_account_name, debit_in_account_currency=-1 * flt(outgoing_amount, item.precision("base_net_amount")), account_currency=account_currency, + project=item.project, item=item, ) @@ -559,6 +561,7 @@ class PurchaseReceipt(BuyingController): against_account=self.supplier, debit_in_account_currency=-1 * discrepancy_caused_by_exchange_rate_difference, account_currency=account_currency, + project=item.project, item=item, ) @@ -572,6 +575,7 @@ class PurchaseReceipt(BuyingController): against_account=self.supplier, debit_in_account_currency=-1 * discrepancy_caused_by_exchange_rate_difference, account_currency=account_currency, + project=item.project, item=item, ) @@ -634,6 +638,7 @@ class PurchaseReceipt(BuyingController): remarks=remarks, against_account=stock_asset_account_name, account_currency=supplier_warehouse_account_currency, + project=item.project, item=item, )