Fixes #3323 : error with currencies in multi-company environnement

Please refer to my analysis of the code on the bug report #3323