diff --git a/src/frontend/src/components/editors/NotesEditor.tsx b/src/frontend/src/components/editors/NotesEditor.tsx index afdb3d2c055c..7f1920ac9a62 100644 --- a/src/frontend/src/components/editors/NotesEditor.tsx +++ b/src/frontend/src/components/editors/NotesEditor.tsx @@ -217,7 +217,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 30500dbdc7d7..8a0025a9c6fe 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 fa3b1a709367..6846948a4ce9 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]);