Comment 44 for bug 427869

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi !

I spend lots of time on this bug and it's very complicated. I provide a patch here which correct the main issue (need to be more tested) : different currency, different rate...

For me it work fine, but because everything is recorded on 2 digit into the DB, you can have 0,01 cents difference during the payment process... At least till you pay the whole invoice completely.

Example:

Amount of 121.65450121654501 is recorded in DB as 121.65. So with a rate at 1.644 you get : 121.65 * 1.644 = 199.9926, which is 199,99 according to accuracy of 2. But the original amount was 200 which correspond to : 121.65450121654501 * 1.644

I warn everybody here : we really need to fix the problem deeply into the ORM. Python need Decimal type instead of float to handle money properly... So, because of that, I don't have a better solution than the one I suggest here.

Don't hesitate to ask question to me, I don't have more time right now to be more precise. If you've got an idea... please share it !

Regards,