Skip to content
Snippets Groups Projects
Commit 7210a5d6 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Fix major bug when duplicating record with internal objects.

parent 334bc35e
No related branches found
No related tags found
No related merge requests found
...@@ -302,6 +302,7 @@ Ext.define('App.form.Panel', { ...@@ -302,6 +302,7 @@ Ext.define('App.form.Panel', {
var me = this, var me = this,
form = me.getForm(), form = me.getForm(),
newRecord,
table, table,
tableId; tableId;
...@@ -334,7 +335,17 @@ Ext.define('App.form.Panel', { ...@@ -334,7 +335,17 @@ Ext.define('App.form.Panel', {
case 'duplicate': case 'duplicate':
me.buttonAction.setText(me.textDuplicate); me.buttonAction.setText(me.textDuplicate);
form.loadRecord(record);
// create a copy without keeping the reference to internal objects
newRecord = record.copy();
Ext.Array.each(newRecord.fields.items, function (field) {
var value = newRecord.data[field.name];
if (typeof value === "object") {
newRecord.data[field.name] = Ext.clone(value);
}
});
form.loadRecord(newRecord);
break; break;
case 'update': case 'update':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment