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

[13.0 --> 14.0] account payment move not reconciliable #3240

Open
remi-filament opened this issue May 10, 2022 · 4 comments
Open

[13.0 --> 14.0] account payment move not reconciliable #3240

remi-filament opened this issue May 10, 2022 · 4 comments
Labels
Milestone

Comments

@remi-filament
Copy link
Contributor

Module

account

Describe the bug

After migration of v13 DB to v14 using OpenUpgrade, when trying to reconcile a bank statement line with a payment, the following error is raised :
The journal entry BNK1/2022/0051 reached an invalid state regarding its related statement line. To be consistent, the journal entry must always have exactly one journal item involving the bank/cash account.

Analyzing this issue, from my understanding, when reconciling a bank statement line with a payment in Odoo v14, Odoo replaces the Bank Suspense Account in account_move (created automatically from bank_statement_line) by account from reconciled move. In this case, since payment were registered on the same account as bank one (512001), this causes the resulting move with 2 lines on the same bank account. Odoo is expecting to have only one bank account in this move and therefore raises the error.

Basically a customer payment in Odoo 13 and before created the following move lines :
Debit 50 € on account 512001 (Bank)
Credit 50 € on account 411000 (Receivable)

When a payment in Odoo 14 creates the following move lines :
Debit 50 € on account 512003 (Outstanding Receipts)
Credit 50 € on account 411000 (Receivable)

The workaround consists in rewriting the 512001 in 512003 on outstanding payment move lines.
This could be done automatically in post_install script (after outstanding payment account is automatically created in

journal.payment_debit_account_id = env["account.account"].create(
) I am not sure though whether this is a good idea to do that in migration script (since it would rewrite past move lines) ?

To Reproduce

Affected versions: migration 13 to 14

Steps to reproduce the behavior:

  1. Register payment on customer invoice (without reconciliation to bank)
  2. Migrate DB to v14
  3. Create bank statement line for the same amount as the above payment
  4. Try reconciling bank statement line and payment, you should get the same UserError as above

Expected behavior
Reconciliation is properly handled

@remi-filament
Copy link
Contributor Author

Hi @MiquelRForgeFlow @pedrobaeza do you think it is acceptable to rewrite account_move_lines related to outstanding payments to change bank account to outstanding receipt account (the same should probably be done for outgoing payments as well) ?

@pedrobaeza
Copy link
Member

Not sure doing that will have side effects. For now, such outstanding payments in my migrated DBs (if used), have been manually changed.

@legalsylvain legalsylvain added this to the 14.0 milestone May 1, 2023
@kaynnan
Copy link

kaynnan commented Feb 12, 2024

@pedrobaeza From this change from v13 to v14, what is the correct way to handle this error?

@pedrobaeza
Copy link
Member

Manually fix the wrong journal items.

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

No branches or pull requests

4 participants