account-reconcile icon indicating copy to clipboard operation
account-reconcile copied to clipboard

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

Open florian-dacosta opened this issue 5 months ago • 3 comments

Hello @etobella

Second issue, linked to https://github.com/OCA/account-reconcile/issues/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()

florian-dacosta avatar Sep 13 '24 08:09 florian-dacosta