Add a field to InventJournalTrans, propagate to InventTrans

The link above does contain the solution — I have included the code from that page in case that page disappears or no longer becomes available. Thanks to gl00mie for answering on that site and providing this answer.
You should create a new InventMovement method like this:

public MyNewFieldType myNewField() { return MyNewFieldType::DefaultValue; // suppose your new field is an enum } 

Then modify \Classes\InventMovement\initInventTransFromBuffer

void initInventTransFromBuffer(InventTrans _inventTrans, InventMovement _movement_orig) { // ... append this line to the end of whatever else is already in this method _inventTrans.MyNewField = this.myNewField(); } 

And finally overload the new method in the InventMov_Journal class:

public MyNewFieldType myNewField() { return inventJournalTrans.MyNewField; } 

One thought on “Add a field to InventJournalTrans, propagate to InventTrans