3
0

Fix not all related fields populated when adding record from related record list

This commit is contained in:
Jože Fortun
2024-06-01 16:59:48 +02:00
parent 22ae5b0fd6
commit 8d63ed4511

View File

@@ -406,11 +406,11 @@ export default {
} else {
if (this.refRecord) {
// Record create form called from a related records block,
// we'll try to find an appropriate field and cross-link this new record to ref
const recRefField = this.module.fields.find(f => f.kind === 'Record' && f.options.moduleID === this.refRecord.moduleID)
if (recRefField) {
this.values[recRefField.name] = this.refRecord.recordID
}
// we'll try to find an appropriate fields and cross-link this new record to ref
this.module.fields.filter(f => f.kind === 'Record' && f.options.moduleID === this.refRecord.moduleID).forEach(f => {
this.values[f.name] = this.refRecord.recordID
})
}
return new compose.Record(module, { values: this.values })