From d0a9dd2fb33a4c83dd954cd89730cc6b35426f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C5=BEe=20Fortun?= Date: Mon, 8 Jul 2024 14:54:47 +0200 Subject: [PATCH] Fix not being able to input new record field values if you have canCreateRecord on module set to allow and canUpdateRecord on the record set to deny --- .../compose/src/components/PageBlocks/RecordEditor.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/web/compose/src/components/PageBlocks/RecordEditor.vue b/client/web/compose/src/components/PageBlocks/RecordEditor.vue index 267622e6b..802fd4aad 100644 --- a/client/web/compose/src/components/PageBlocks/RecordEditor.vue +++ b/client/web/compose/src/components/PageBlocks/RecordEditor.vue @@ -147,6 +147,10 @@ export default { horizontal () { return this.block.options.horizontalFieldLayoutEnabled }, + + isNew () { + return this.record && this.record.recordID === NoID + }, }, watch: { @@ -197,11 +201,12 @@ export default { isFieldEditable (field) { if (!field) return false - const { canCreateOwnedRecord } = this.module || {} + const { canCreateRecord, canCreateOwnedRecord } = this.module || {} const { createdAt, canManageOwnerOnRecord } = this.record || {} const { name, canUpdateRecordValue, isSystem, expressions = {} } = field || {} - if (!canUpdateRecordValue) return false + // If new record check canCreateRecord module permissions, otherwise canUpdateRecordValue on the record + if (this.isNew ? !canCreateRecord : !canUpdateRecordValue) return false if (isSystem) { // Make ownedBy field editable if correct permissions @@ -218,6 +223,7 @@ export default { onFieldChange: debounce(function (field) { this.evaluateExpressions() + this.$root.$emit('record-field-change', { fieldName: field.name, })