I have a model Order which has two hasMany associations to two other models; Operation and Material. A order can contain multiple operations and materials. But it is possible that multiple orders can contain the same operations and materials. The idProperty i use for the operations is operationid('ZA001' for example).

On my main page i use a store to load in a list of orders that have operations that are in progress(An operation has started). This is what the JSON looks like:
             "operation":[{"operationid":"BA001","linenr":"010","description":"Bankwerken Afbramen","started":true},

The operation with id 'ZA001' is currently running in order '00488'. This operation is also in order '00001' but hasn't start yet so it isn't loaded in yet. When i click on order '00001' it will load in all the information of that order, operations that haven't started + operations that have started.

But since the 'ZA001' operation model already has an instance and it's idProperty is the same as the one in the other order, it just shares this instance in the two orders. Therefore this operation is started in both orders.

This is obviously not what i want and i've been trying to find a good solution. In the Operation model there is a foreignKey to orderid, so i thought i could maybe create a new field and convert both the orderid and lineNr to one field which i will use as the idProperty. But the foreignKey is not set yet when the model is setting his idProperty. So i wasn't able to do this....

Is there any way i can get the orderid before the idproperty is set?