2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-11-13 19:36:46 +00:00

PO receive fix (#10807)

* Extract note field when receiving stock items against PO

* Fix tracking entry when receiving item
This commit is contained in:
Oliver
2025-11-11 17:29:09 +11:00
committed by GitHub
parent 77f80385c9
commit f3c1cc12af

View File

@@ -951,7 +951,7 @@ class PurchaseOrder(TotalPriceMixin, Order):
batch_code: Optional batch code for the item (optional) batch_code: Optional batch code for the item (optional)
expiry_date: Optional expiry date for the item (optional) expiry_date: Optional expiry date for the item (optional)
serials: Optional list of serial numbers (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: if self.status != PurchaseOrderStatus.PLACED:
raise ValidationError( raise ValidationError(
@@ -1055,6 +1055,7 @@ class PurchaseOrder(TotalPriceMixin, Order):
'quantity': 1 if serialize else stock_quantity, 'quantity': 1 if serialize else stock_quantity,
'batch': item.get('batch_code', ''), 'batch': item.get('batch_code', ''),
'expiry_date': item.get('expiry_date', None), 'expiry_date': item.get('expiry_date', None),
'notes': item.get('note', '') or item.get('notes', ''),
'packaging': item.get('packaging') or supplier_part.packaging, 'packaging': item.get('packaging') or supplier_part.packaging,
} }
@@ -1143,9 +1144,11 @@ class PurchaseOrder(TotalPriceMixin, Order):
item.add_tracking_entry( item.add_tracking_entry(
StockHistoryCode.RECEIVED_AGAINST_PURCHASE_ORDER, StockHistoryCode.RECEIVED_AGAINST_PURCHASE_ORDER,
user, user,
location=item.location, deltas={
purchaseorder=self, 'location': item.location.pk if item.location else None,
quantity=float(item.quantity), 'purchaseorder': self.pk,
'quantity': float(item.quantity),
},
commit=False, commit=False,
) )
) )