Skip to content

EspoCRM – Open Source CRM Application

clone model on list to detail

Yuri Kuznetsovd1b3afdd014d
diff --git a/client/src/views/record/list.js b/client/src/views/record/list.js
index cd6637b615..9ccadb6358 100644
--- a/client/src/views/record/list.js
+++ b/client/src/views/record/list.js
@@ -2152,11 +2152,17 @@ class ListRecordView extends View {
const model = this.collection.get(id);
const scope = this.getModelScope(id);
+ const clonedModel = model.clone();
+
const options = {
id: id,
- model: model,
+ model: clonedModel,
};
+ this.listenTo(clonedModel, 'sync', () => {
+ model.setMultiple(clonedModel.getClonedAttributes(), {sync: true});
+ });
+
if (this.options.keepCurrentRootUrl) {
options.rootUrl = this.getRouter().getCurrentUrl();
}