Sorry, but I think this is still an important bug, if the tool will make somehing it should be maden in a good way.
The solution is technically simple but the refactoring is making us study stock management code again.
ADD cost_transaction field on stock.move object.
RECORD what cost was pushed on wizard in the moment of this transaction. (In and Out dont worry in flter this.)
With this 2 little changes propose one value (actual cost) or another (real cost used in transaction when return is done) can be done easily with an extra module.
Without this change it can be almost imposible to do, this is the point.
It doesn't brake the KISS principle OpenERP if we do not do that we are broken because in the close of year - period pocedure it will be so complicated.