3
0

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

This commit is contained in:
Jože Fortun
2024-07-08 14:54:47 +02:00
parent 1b4b349385
commit d0a9dd2fb3

View File

@@ -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,
})