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
This commit is contained in:
Jatin3128
2026-06-29 17:22:20 +05:30
committed by GitHub
parent d4ee034637
commit 6f97c7199c
2 changed files with 8 additions and 0 deletions

View File

@@ -150,6 +150,9 @@ def add_gl_entry(
"remarks": remarks,
}
if project:
gl_entry["project"] = project
if voucher_detail_no:
gl_entry["voucher_detail_no"] = voucher_detail_no

View File

@@ -67,6 +67,7 @@ class PurchaseReceiptGLComposer(BaseStockGLComposer):
remarks=remarks,
against_account=stock_asset_rbnb,
account_currency=account_currency,
project=item.project,
item=item,
)
@@ -118,6 +119,7 @@ class PurchaseReceiptGLComposer(BaseStockGLComposer):
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,
)
@@ -141,6 +143,7 @@ class PurchaseReceiptGLComposer(BaseStockGLComposer):
against_account=doc.supplier,
debit_in_account_currency=-1 * discrepancy_caused_by_exchange_rate_difference,
account_currency=account_currency,
project=item.project,
item=item,
)
@@ -154,6 +157,7 @@ class PurchaseReceiptGLComposer(BaseStockGLComposer):
against_account=doc.supplier,
debit_in_account_currency=-1 * discrepancy_caused_by_exchange_rate_difference,
account_currency=account_currency,
project=item.project,
item=item,
)
@@ -214,6 +218,7 @@ class PurchaseReceiptGLComposer(BaseStockGLComposer):
remarks=remarks,
against_account=stock_asset_account_name,
account_currency=supplier_warehouse_account_currency,
project=item.project,
item=item,
)