commit 58527c6b3916ae50283e7134fb5f46e8998c17db
parent 940c4c848c1cdf3f3fe6bc6a6995d4233dc3753f
Author: Felicitus <felicitus@felicitus.org>
Date: Fri, 27 Nov 2015 19:18:29 +0100
Set associations for basic duplication manually, fixes #504
Diffstat:
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsManager.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsManager.js
@@ -274,19 +274,24 @@ Ext.define('PartKeepr.PartManager', {
*/
createPartDuplicate: function (rec)
{
- var copy = rec.copy();
+ var data = rec.getData();
+ var associationData = rec.getAssociationData();
- copy.setCategory(rec.getCategory());
- copy.setFootprint(rec.getFootprint());
- copy.setStorageLocation(rec.getStorageLocation());
- copy.setPartUnit(rec.getPartUnit());
+ var newItem = Ext.create("PartKeepr.PartBundle.Entity.Part");
+ newItem.set(data);
+ newItem.setAssociationData({
+ category: associationData.category,
+ partUnit: associationData.partUnit,
+ storageLocation: associationData.storageLocation,
+ footprint: associationData.footprint
+ });
var j = Ext.create("PartKeepr.PartEditorWindow", {
partMode: 'create'
});
j.editor.on("partSaved", this.onNewPartSaved, this);
- j.editor.editItem(copy);
+ j.editor.editItem(newItem);
j.show();
},
/**
@@ -363,7 +368,8 @@ Ext.define('PartKeepr.PartManager', {
j.editor.editItem(part);
j.show();
},
- onNewPartSaved: function (record) {
+ onNewPartSaved: function (record)
+ {
this.grid.getStore().reload();
},
onPartSaved: function (record)