← Back to team overview

openerp-expert-accounting team mailing list archive

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

 

@Olivier Dony


First thanks for your work, this is good to see... I miss the digit parameters in the rounding function of res_currency : Well done !

But I still get a trouble and don't agree on your remark about
OERPScenario... Your last bugfix correct the balance trouble by making
the debit always equal to credit which is good, I agree. Unfortunately,
we still have a trouble with the credit value (in case of a supplier
invoice) or the debit value (in case of a customer invoice)...

The amount on payable / receivable account should be the exact value in
company currency of the total invoice, otherwise you introduce a
rounding error, even with debit= to credit.

Please have a look on the attached print screen (note that the currency
conversion is 0,6547 as in the test case you take from OERPScenario).
You'll see that the amount on the credit is 1983.71 instead of 1983.70
(made by 1298.73/06547 = 1983.70245914 => 1983.70 on 2 digits).

This results in a rounding difference which SHOULD NOT appear in the
payable/receivable account ! This is overall true when you'll reconcile
this invoice... You'll introduce int the bank statement the exact amount
in currency (here 1298.73 CHF), and OpenERP will say there is a
difference because of the 0,01 rounding issue... it's not true from the
user point of view ! If I invoice 1298.73 CHF and receive this exact
amount in CHF on the same date, I expect the invoice to be reconcile
without passing a write-off amount !!!

In fact, I expect OpenERP to make the following for this amount
"1298.73":

- 1983.70 on credit on the payable account
- 0,01 on credit on the "rounding account"

So I can reconcile the real receive amount (1298.37) without passing a
write-off...

That's why we discuss on the expert list the following solution:

- For trunk : Make something perfect, adding an account properties on
res_currency to allow a "rounding account" per company. This will be use
to pass the 0,01 difference.

- For stable : Add or Substract the 0,01 on the biggest debit/credit
line to have the amount balanced

I hope I'm clear enough, this is not that easy to explain. Don't
hesitate to call me if you want to discuss it !


Regards,

Joël


** Attachment added: "Rounding trouble description"
   http://launchpadlibrarian.net/45719213/Capture%20d%E2%80%99%C3%A9cran%202010-04-27%20%C3%A0%2014.55.09.png

-- 
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





Follow ups