From 442a6164324a7f82cb7c0a8aeac3d0770baa326a Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 31 Oct 2025 21:23:23 +1100 Subject: [PATCH] Support attachments against SupplierPart (#10724) * Support attachments against SupplierPart * Update CHANGELOG.md * API update --- CHANGELOG.md | 1 + src/backend/InvenTree/InvenTree/api_version.py | 5 ++++- src/backend/InvenTree/company/models.py | 1 + src/frontend/src/pages/company/SupplierPartDetail.tsx | 5 +++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0974420d6f..5d41f9bd63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added support for Debian 12, Ubuntu 22.04 and Ubuntu 24.04 in the installer and package in [#10705](https://github.com/inventree/InvenTree/pull/10705) - Support for S3 and SFTP storage backends for media and static files ([#10140](https://github.com/inventree/InvenTree/pull/10140)) - Adds hooks for custom UI spotlight actions in [#10720](https://github.com/inventree/InvenTree/pull/10720) +- Support uploading attachments against SupplierPart in [#10724](https://github.com/inventree/InvenTree/pull/10724) ### Changed diff --git a/src/backend/InvenTree/InvenTree/api_version.py b/src/backend/InvenTree/InvenTree/api_version.py index 1468edc624..c4735f7e94 100644 --- a/src/backend/InvenTree/InvenTree/api_version.py +++ b/src/backend/InvenTree/InvenTree/api_version.py @@ -1,11 +1,14 @@ """InvenTree API version information.""" # InvenTree API version -INVENTREE_API_VERSION = 420 +INVENTREE_API_VERSION = 421 """Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" INVENTREE_API_TEXT = """ +v421 -> 2025-10-31 : https://github.com/inventree/InvenTree/pull/10724 + - Allow upload of attachments against SupplierPart objects via the API + v420 -> 2025-10-26 : https://github.com/inventree/InvenTree/pull/10675 - Adds optional "customer_detail" filter to SalesOrderShipment API endpoint diff --git a/src/backend/InvenTree/company/models.py b/src/backend/InvenTree/company/models.py index 8e5efe1454..c276e83b01 100644 --- a/src/backend/InvenTree/company/models.py +++ b/src/backend/InvenTree/company/models.py @@ -669,6 +669,7 @@ class SupplierPartManager(models.Manager): class SupplierPart( + InvenTree.models.InvenTreeAttachmentMixin, InvenTree.models.MetadataMixin, InvenTree.models.InvenTreeBarcodeMixin, InvenTree.models.InvenTreeNotesMixin, diff --git a/src/frontend/src/pages/company/SupplierPartDetail.tsx b/src/frontend/src/pages/company/SupplierPartDetail.tsx index eea533cc17..35cdf4f836 100644 --- a/src/frontend/src/pages/company/SupplierPartDetail.tsx +++ b/src/frontend/src/pages/company/SupplierPartDetail.tsx @@ -32,6 +32,7 @@ import { } from '../../components/items/ActionDropdown'; import InstanceDetail from '../../components/nav/InstanceDetail'; import { PageDetail } from '../../components/nav/PageDetail'; +import AttachmentPanel from '../../components/panels/AttachmentPanel'; import NotesPanel from '../../components/panels/NotesPanel'; import type { PanelType } from '../../components/panels/Panel'; import { PanelGroup } from '../../components/panels/PanelGroup'; @@ -283,6 +284,10 @@ export default function SupplierPartDetail() { ) }, + AttachmentPanel({ + model_type: ModelType.supplierpart, + model_id: supplierPart?.pk + }), NotesPanel({ model_type: ModelType.supplierpart, model_id: supplierPart?.pk