Current items cleared in o2m/m2m when selecting nothing with "add existing" (#15337)

* don't update the state if nothing was selected

* temp disable clearValue for relational fields

Co-authored-by: Nitwel <nitwel@arcor.de>
This commit is contained in:
Brainslug
2022-09-01 20:52:32 +02:00
committed by GitHub
parent 5915fa9f2b
commit f5befa5bc5
2 changed files with 11 additions and 26 deletions

View File

@@ -37,7 +37,7 @@
</v-list-item>
<v-list-item
v-if="!restricted && (defaultValue === null || !isRequired)"
:disabled="modelValue === null"
:disabled="modelValue === null || relational"
clickable
@click="$emit('update:modelValue', null)"
>
@@ -87,7 +87,14 @@ export default defineComponent({
return props.field?.schema?.is_nullable === false;
});
return { t, defaultValue, isRequired, isCopySupported, isPasteSupported };
const relational = computed(
() =>
props.field.meta?.special?.find((type) =>
['file', 'files', 'm2o', 'o2m', 'm2m', 'm2a', 'translations'].includes(type)
) !== undefined
);
return { t, defaultValue, isRequired, isCopySupported, isPasteSupported, relational };
},
});
</script>