2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 12:35:46 +00:00
This commit is contained in:
Oliver Walters
2022-05-03 13:51:04 +10:00
parent 1794f65d19
commit 8cd8581dbf
2 changed files with 16 additions and 6 deletions

View File

@ -268,8 +268,18 @@ class PurchaseOrderLineItemSerializer(InvenTreeModelSerializer):
data = super().validate(data)
supplier_part = data['part']
purchase_order = data['order']
supplier_part = data.get('part', None)
purchase_order = data.get('order', None)
if not supplier_part:
raise ValidationError({
'part': _('Supplier part must be specified'),
})
if not purchase_order:
raise ValidationError({
'order': _('Purchase order must be specified'),
})
# Check that the supplier part and purchase order match
if supplier_part is not None and supplier_part.supplier != purchase_order.supplier: