← Back to team overview

openerp-expert-accounting team mailing list archive

[Bug 452854] Re: Cannot validate invoices with foreign currency

 

Hi Olivier,


I understand your point of view. It seems that I don't explain well the remaining trouble... I defend the Expert point of view here, which is :

- The rounding difference introduce in the invoicing computation in
foreign currency should be handled directly in this invoicing process.

This is no more a currency rounding trouble (your patch fix this), but
more a business one. If the foreign currency rate has not been change
between the invoicing and the reconciliation, why should the end user
pass a write-off when making his bank statement ? This should not
happened, cause nothing has change !

Because OpenERP round each line, and then make a sum, it introduce a
rounding difference compare to sum all the line and then round the
total... This result in a 0,01 difference (with price_accuracy=2)..

This should not be like this... So we need to correct the rounding
"error" by adding or subtracting this 0,01 somewhere... The question at
the expert list was how to handle this difference, 2 answers:

- Add a line with this amount in the invoice
or
- Add or substract it to the biggest line of the invoice

The expert choose the second option, and that's what I've done in my
patch.

Is this trouble more clear now ? I would suggest to apply my patch as
well, which (according to my tests) seems to work as expected by the
expert team... Both of your and mine correction are the complete
solution to this huge bug report I think...

Let me know if your opinion or if you need more (clearer)
explanations...


Regards,

Joël

-- 
Cannot validate invoices with foreign currency
https://bugs.launchpad.net/bugs/452854
You received this bug notification because you are a member of OpenERP
Accounting Experts, which is a direct subscriber.

Status in OpenObject Addons Modules: Fix Released

Bug description:
Hello,
have stumbled upon interesting problem. Latvian Lats (LVL) is the base currency for Accounting. Try to issue (or encode received from supplier) invoice in Euros(EUR). The same would happen between any other currencies too.

Invoice totals:
Total w/o VAT (Untaxed): 1158,00 EUR
Tax VAT 21% : 243,18 EUR
Total: 1401,18 EUR

Try to Confirm invoice and you will get "You can not validate a non balanced entry !"

Made some investigation what is wrong, and have found that the problem is.

Obviously the totals are calculated perfectly right, but as the base currency for accounting is different from the currency we are issuing invoice the accounting moves are done in the base currency, in this case LVL.

So goes the currency exchange

Total w/o VAT (Untaxed): 1158,00 EUR ->(813,8470320 ~813,85 LVL)
Tax VAT 21% : 243,18 EUR ->(170,9078767 ~170,91 LVL)
Total: 1401,18 EUR ->(984,7549087 ~984,75 LVL)

Which again are technically right, with one difference, that the totals for posting are now not dependent on each other anymore. They are being rounded before posting.

If you would issue invoice in a base currency the difference is in 0.01LVL, which is lost during rounding process. Notice the Total sum.
Example:
Total w/o VAT (Untaxed): 813,85 LVL
Tax VAT 21% : 170,91 LVL (VO_VAT * 21% = 170,9085000)
Total: 984,76 LVL (VO_VAT + VAT_21)

To deal around floating point storage in Python (as well as other programming languages), allowed difference between sums are allowed 0.0001. This is the place where postings do not pass validate(...) function in "account.py".

This is right as balance between credit and debit should be equal. What should be done - accountant would probably create write-off entry for the missing sum to make the balance right. This functionality is missing in OpenERP, and is fundamental for foreign trade.

Any ideas?

P.S. version 5.0.6.

Kaspars