Cannot validate invoices with foreign currency
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Opinion
|
Critical
|
Unassigned |
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
Related branches
- Husen Daudi (community): Approve
- Odoo Drivers: Pending requested
- OpenERP Core Team: Pending requested
- DragoDen: Pending requested
-
Diff: 437 lines8 files modifiedaccount/account.py (+1/-1)
account/account_bank_statement.py (+11/-3)
account/account_move_line.py (+8/-7)
account/account_view.xml (+3/-0)
account/invoice.py (+43/-11)
account/wizard/wizard_pay_invoice.py (+42/-13)
account/wizard/wizard_reconcile.py (+22/-9)
account_payment/wizard/wizard_payment_order.py (+1/-0)
- OpenERP Core Team: Pending requested
-
Diff: 69 lines (+54/-0)2 files modifiedaccount/__terp__.py (+1/-0)
account/test/sequence_bug602188_test.xml (+53/-0)
Changed in openobject-addons: | |
status: | Confirmed → Fix Committed |
Changed in openobject-addons: | |
status: | New → Confirmed |
milestone: | none → 5.0.7 |
Changed in openobject-addons: | |
status: | Fix Released → Invalid |
status: | Invalid → New |
status: | New → Incomplete |
summary: |
- Cannon validate foreign currency invoices + Cannot validate invoices with foreign currency or price_accuracy=3 |
Changed in openobject-addons: | |
milestone: | 5.0.7 → 5.0.8 |
Changed in openobject-addons: | |
milestone: | 5.0.8 → 5.0.7 |
Changed in openobject-addons: | |
milestone: | 5.0.7 → 5.0.8 |
summary: |
- Cannot validate invoices with foreign currency or price_accuracy=3 + Cannot validate invoices with foreign currency |
Changed in openobject-addons: | |
milestone: | 5.0.9 → 5.0.10 |
Changed in openobject-addons: | |
status: | Fix Released → New |
Changed in openobject-addons: | |
assignee: | OpenERP Core Team (openerp) → nobody |
milestone: | 5.0.10 → none |
status: | New → Opinion |
hello sraps (KN dati) ,
Please apply the attached patch and notify me that its solves your problem or not.
Thanks.