3
0

Fix record not referenced when creating related record in a modal

This commit is contained in:
Jože Fortun
2023-09-20 12:06:57 +02:00
parent ba2d4fe93b
commit c12ca79392
2 changed files with 18 additions and 9 deletions
@@ -34,27 +34,29 @@
>
<template v-if="recordListModule.canCreateRecord">
<template v-if="inlineEditing">
<b-btn
<b-button
v-if="!options.hideAddButton"
data-test-id="button-add-record"
variant="primary"
size="lg"
class="float-left mr-1"
@click="addInline"
class="mr-1"
@click="addInlineRecord()"
>
+ {{ $t('recordList.addRecord') }}
</b-btn>
</b-button>
</template>
<template v-else-if="!inlineEditing && (recordPageID || options.allRecords)">
<button
<b-button
v-if="!options.hideAddButton"
data-test-id="button-add-record"
class="btn btn-lg btn-primary mr-1"
variant="primary"
size="lg"
class="mr-1"
@click="handleAddRecord()"
>
+ {{ $t('recordList.addRecord') }}
</button>
</b-button>
<importer-modal
v-if="!options.hideImportButton"
@@ -1176,7 +1178,7 @@ export default {
}
},
addInline () {
addInlineRecord () {
const r = new compose.Record(this.recordListModule, {})
// Set record values that should be prefilled
@@ -1882,6 +1884,7 @@ export default {
this.$root.$emit('show-record-modal', {
recordID: NoID,
recordPageID: this.recordPageID,
refRecord,
})
} else {
this.$router.push({
@@ -23,6 +23,7 @@
:module="module"
:record-i-d="recordID"
:values="values"
:ref-record="refRecord"
show-record-modal
@handle-record-redirect="loadRecord"
/>
@@ -71,6 +72,7 @@ export default {
module: undefined,
page: undefined,
values: undefined,
refRecord: undefined,
}
},
@@ -123,8 +125,10 @@ export default {
clearRecordIDs: 'ui/clearRecordIDs',
}),
loadRecord ({ recordID, recordPageID, values }) {
loadRecord ({ recordID, recordPageID, values, refRecord }) {
this.values = values
this.refRecord = refRecord
this.loadModal({ recordID, recordPageID })
setTimeout(() => {
@@ -174,6 +178,8 @@ export default {
this.recordID = undefined
this.module = undefined
this.page = undefined
this.values = undefined
this.refRecord = undefined
},
destroyEvents () {