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 : foreign currency in company currency account #695

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

[16] account_reconcile_oca : foreign currency in company currency account #695

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

Comments

@florian-dacosta
Copy link
Contributor

florian-dacosta commented Sep 13, 2024

Hello @etobella

Here the use case is, for an journal in company currency (USD) when you have a line with foreign_currency_id and amount_currency set.

Set up (run bash script at then end)

  • Active CNY currency
  • 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 default bank journal (in company currency USD) on the 2024-09-10, with amount 500, foreign currency : CNY and amount currency 3968.25
  • create an customer invoice in CNY currency for an amount of 3968.25

Here screen shot from Odoo enterprise where all seems ok .
Default screen on the reconciliation UI, we see the counterpart in CNY because it is the foreign currency
1-enterprise-foreign-curr

When we select the invoice with same amount in CNY, we have a full reconciliation, with de exchange loss because Odoo rate is not the same as the one from the bank.
2-inv-selection

Then the invoice is fully reconciled :
3-paid-invoice

Same steps with OCA module :
In default screen of reconciliation UI, we do not see the foreign currency amount but the USD one. It does not help us so choose the right invoice :
1-oca-foreign-curr

Then when selecting the invoice, we have a suspense line instead of a income exchange line, and the amount in currency is wrong.
3-reconcile-foreign

Then the reconciliation is impossible, because of unwanted suspense line.

Doing the same test, only changing the date of the invoice from 2024-09-10 to 2024-09-09, the exchange line become an expense, the result is even stranger :
3reconciliation

The exchange line should be 90 cents instead of 94 and we should not have the last line, which is a suspense line.

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
})
bank_journal = env['account.journal'].search([('type', '=', 'bank'), ('currency_id', '=', False)], limit=1)

usd_statement = env["account.bank.statement"].create({
    "name": "TEST 1 foreign currency",
    "journal_id": bank_journal.id,
    "line_ids": [(0, 0, {
        "date": "2024-09-10",
        "journal_id": bank_journal.id,
        "payment_ref": "VIR CUSTOMER",
        "amount": 500,
        "currency_id": usd.id,
        "foreign_currency_id": cny.id,
        "amount_currency": 3968.25,
    })],
})


inv = self.env['account.move'].create({
    "move_type": "out_invoice",
    "partner_id": env.ref("base.res_partner_12").id,
    "invoice_date": "2024-09-10",
    "currency_id": cny.id,
    "invoice_line_ids": [(0, 0, {
        "name": "test",
        "price_unit": 3968.25,
        "tax_ids": [(6, 0, [])],
    })]
})
inv.action_post()
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.

1 participant