Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16] account_reconcile_oca : bank account in foreign currency, rounding error for full reconcile #693

Open
florian-dacosta opened this issue Sep 13, 2024 · 3 comments · May be fixed by #694
Labels

Comments

@florian-dacosta
Copy link
Contributor

florian-dacosta commented Sep 13, 2024

Hello @etobella

Second issue, linked to #692 I guess :
It may be solved with a change on the linked issue, I post it to record it so we can check this case easily then.

Here is the use case (I'll join a shell script at the end allowing to reproduce the issue from a demo database with only account_reconcile_oca installed).

Set up (you can run the shell script)

  • Active CNY currency
  • Create a bank journal in a foreign currency (CNY) (set the currency on the journal)
  • Create a rate for the CNY currency : 0.125989013758 USD per unit for 2024-09-10 and 0.126225969731 USD per unit for 2024-09-09
  • Create a statement line on this CNY bank journal with amount 259200
  • Create a customer invoice, with currency CNY, and total amount 259200

Then, go to the bank statement reconciliation, and you have this :
1-before-reconcile

The suspense line does not have any currency visible, like in first issue. I think it is confusing already because we are in a account in CNY and the suspense line should reflect the bank line.

Then when I choose the invoice :
2-inv-selection

The currency amount appear now, but it is not the right amount (259199.98 instead of 259200). I guess there is some kind of conversion toward usd and then backtoward CNY.

Therefor the amount is strikethrough which is also confusing because the amount is of the invoice is the same as the amount received.
And it let me think that the reconciliation will be partial

Once validated, I check the accounting entry :
3-accounting-entry

I see that the counterpart is not in CNY currency, it has been switched to a full USD line. I expect to have a amount currency of -259200 for the line with account 121000. (same as first linked issue)

Finally on the reconciled invoice :
4-invoice

I see a payment of 0.02 cny which I don't want.

Like I said it may be solved or partially solved by link issue, I still post it now to show all the problems I found for now.
And once again, thanks for the job on the matter!

Shell script :
usd = env.ref("base.USD")
cny = env.ref("base.CNY")
cny.write({'active': True})

env["res.currency.rate"].create({
    "name": "2024-09-10",
    "currency_id": cny.id,
    "inverse_company_rate": 0.125989013758
})
env["res.currency.rate"].create({
    "name": "2024-09-09",
    "currency_id": cny.id,
    "inverse_company_rate": 0.126225969731
})

cny_journal = env["account.journal"].create({
    "name": "Bank CNY",
    "type": "bank",
    "currency_id": cny.id,
})

cny_statement = env["account.bank.statement"].create({
    "name": "TEST 1 CNY",
    "journal_id": cny_journal.id,
    "line_ids": [(0, 0, {
        "date": "2024-09-10",
        "journal_id": cny_journal.id,
        "payment_ref": "VIR CUSTOMER",
        "amount": 259200,
        "currency_id": usd.id,
    })],
})


inv = self.env['account.move'].create({
    "move_type": "out_invoice",
    "partner_id": env.ref("base.res_partner_12").id,
    "invoice_date": "2024-09-09",
    "currency_id": cny.id,
    "invoice_line_ids": [(0, 0, {
        "name": "test",
        "price_unit": "259200",
        "tax_ids": [(6, 0, [])],
    })]
})
inv.action_post()
@etobella
Copy link
Member

Can you test the same functionality in EE using runbot? it seems a rounding issue

@florian-dacosta
Copy link
Contributor Author

Well, it seems to be a rounding issue indeed, but I can't get why we would have to round anything in this case.
We have an amount (259200) and it has to be converted in the company currency using the rate. But the inverse conversion is not needed IMHO, that is why I think there is an issue. As if the CNY amount is converted in euro (with rounding then) and the amount in euro is converted back to CNY (once again, with rounding).

I'll test in enterprise version.

@florian-dacosta
Copy link
Contributor Author

Here with enterprise, all seems ok :

1 default reconciliation screen - no rounding issue
1-enterprise-reconcile

  1. Selection of the invoice :
    2-inv-selection

Invoice after reconciliation :
3-reconciled-invoice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants