From e2eeaa991d7e3ad2a8f36abfbe77d1a9f169d34c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 11 Nov 2025 21:15:13 +1100 Subject: [PATCH] PO receive fix (#10807) (#10808) * Extract note field when receiving stock items against PO * Fix tracking entry when receiving item (cherry picked from commit f3c1cc12afa4c989841aea434c2233559d75ce9f) Co-authored-by: Oliver --- src/backend/InvenTree/order/models.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/backend/InvenTree/order/models.py b/src/backend/InvenTree/order/models.py index 208de31872..97584b91b0 100644 --- a/src/backend/InvenTree/order/models.py +++ b/src/backend/InvenTree/order/models.py @@ -951,7 +951,7 @@ class PurchaseOrder(TotalPriceMixin, Order): batch_code: Optional batch code for the item (optional) expiry_date: Optional expiry date for the item (optional) serials: Optional list of serial numbers (optional) - notes: Optional notes for the item (optional) + note: Optional notes for the item (optional) """ if self.status != PurchaseOrderStatus.PLACED: raise ValidationError( @@ -1055,6 +1055,7 @@ class PurchaseOrder(TotalPriceMixin, Order): 'quantity': 1 if serialize else stock_quantity, 'batch': item.get('batch_code', ''), 'expiry_date': item.get('expiry_date', None), + 'notes': item.get('note', '') or item.get('notes', ''), 'packaging': item.get('packaging') or supplier_part.packaging, } @@ -1143,9 +1144,11 @@ class PurchaseOrder(TotalPriceMixin, Order): item.add_tracking_entry( StockHistoryCode.RECEIVED_AGAINST_PURCHASE_ORDER, user, - location=item.location, - purchaseorder=self, - quantity=float(item.quantity), + deltas={ + 'location': item.location.pk if item.location else None, + 'purchaseorder': self.pk, + 'quantity': float(item.quantity), + }, commit=False, ) )