From fe181e0d6693d61a51464586ed300b6864472a52 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Wed, 6 May 2026 14:25:14 +0200 Subject: [PATCH] Lock notes on orders if they are completed (#11880) * Lock notes on orders if they are completed Fixes #11879 * also check setting * use statuscode object * remove build lock (cherry picked from commit 610e275ca0340280b9153b0a77718d8007e48d7d) --- src/frontend/src/components/editors/NotesEditor.tsx | 2 +- src/frontend/src/pages/purchasing/PurchaseOrderDetail.tsx | 8 +++++++- src/frontend/src/pages/sales/SalesOrderDetail.tsx | 8 +++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/components/editors/NotesEditor.tsx b/src/frontend/src/components/editors/NotesEditor.tsx index 667cdd1ae5..058c3e4046 100644 --- a/src/frontend/src/components/editors/NotesEditor.tsx +++ b/src/frontend/src/components/editors/NotesEditor.tsx @@ -209,7 +209,7 @@ export default function NotesEditor({ const sibling = mdeInstance?.codemirror.getWrapperElement()?.nextSibling; - if (sibling != null) { + if (sibling != null && editable != false) { EasyMDE.togglePreview(mdeInstance); } } diff --git a/src/frontend/src/pages/purchasing/PurchaseOrderDetail.tsx b/src/frontend/src/pages/purchasing/PurchaseOrderDetail.tsx index f8295065c9..7828433d6f 100644 --- a/src/frontend/src/pages/purchasing/PurchaseOrderDetail.tsx +++ b/src/frontend/src/pages/purchasing/PurchaseOrderDetail.tsx @@ -410,7 +410,13 @@ export default function PurchaseOrderDetail() { NotesPanel({ model_type: ModelType.purchaseorder, model_id: order.pk, - has_note: !!order.notes + has_note: !!order.notes, + // TODO @matmair - change API to include a "locked" attribute that we can check here + editable: + order.status == poStatus.COMPLETE && + !globalSettings.isSet('PURCHASEORDER_EDIT_COMPLETED_ORDERS') + ? false + : undefined }) ]; }, [order, id, user]); diff --git a/src/frontend/src/pages/sales/SalesOrderDetail.tsx b/src/frontend/src/pages/sales/SalesOrderDetail.tsx index 9fc6317929..ccec5f0832 100644 --- a/src/frontend/src/pages/sales/SalesOrderDetail.tsx +++ b/src/frontend/src/pages/sales/SalesOrderDetail.tsx @@ -448,7 +448,13 @@ export default function SalesOrderDetail() { NotesPanel({ model_type: ModelType.salesorder, model_id: order.pk, - has_note: !!order.notes + has_note: !!order.notes, + // TODO @matmair - change API to include a "locked" attribute that we can check here + editable: + order.status == soStatus.COMPLETE && + !globalSettings.isSet('SALESORDER_EDIT_COMPLETED_ORDERS') + ? false + : undefined }) ]; }, [order, id, user, soStatus, user]);