+ {!isNew && id &&
}
{error && (
{error}
)}
diff --git a/src/food-market.web/src/pages/SupplyEditPage.tsx b/src/food-market.web/src/pages/SupplyEditPage.tsx
index e44cfbf..cdce480 100644
--- a/src/food-market.web/src/pages/SupplyEditPage.tsx
+++ b/src/food-market.web/src/pages/SupplyEditPage.tsx
@@ -1,4 +1,5 @@
import { useState, useEffect, useRef, type FormEvent, type ReactNode } from 'react'
+import { RelatedDocsBlock } from '@/components/RelatedDocsBlock'
import { useNavigate, useParams, Link } from 'react-router-dom'
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query'
import { ArrowLeft, Plus, Trash2, Save, CheckCircle, Undo2 } from 'lucide-react'
@@ -350,6 +351,7 @@ export function SupplyEditPage() {
{/* Scrollable body */}
+ {!isNew && id &&
}
{error && (
{error}
)}
diff --git a/tests/food-market.IntegrationTests/SupplierReturnFromSupplyTests.cs b/tests/food-market.IntegrationTests/SupplierReturnFromSupplyTests.cs
index e6f75f2..854db55 100644
--- a/tests/food-market.IntegrationTests/SupplierReturnFromSupplyTests.cs
+++ b/tests/food-market.IntegrationTests/SupplierReturnFromSupplyTests.cs
@@ -38,5 +38,14 @@ public async Task CreateFromSupply_presets_lines_and_links_supply()
lines.Should().ContainSingle(l => l.GetProperty("productId").GetString() == product);
lines.First().GetProperty("quantity").GetDecimal().Should().Be(10m);
lines.First().GetProperty("unitPrice").GetDecimal().Should().Be(100m);
+ var returnId = r.GetProperty("id").GetString();
+
+ // Связи документов (п.5): приёмка видит возврат как связанный; возврат — приёмку как основание.
+ var supRel = await api.GetJsonAsync($"/api/documents/supply/{supplyId}/related");
+ supRel.GetProperty("related").EnumerateArray()
+ .Should().Contain(x => x.GetProperty("type").GetString() == "supplier-return" && x.GetProperty("id").GetString() == returnId);
+ var retRel = await api.GetJsonAsync($"/api/documents/supplier-return/{returnId}/related");
+ retRel.GetProperty("basedOn").EnumerateArray()
+ .Should().Contain(x => x.GetProperty("type").GetString() == "supply" && x.GetProperty("id").GetString() == supplyId);
}
}