odoo/odoo#209318

Created by fw-bot
Merged at 1efbb52e3677a03b6e52b369e31c11ae2cb7c82d

Statuses:

label
odoo-dev:18.0-17.0-opw-4669927-portal_user_account_localisation_invoice_journal_item-gute-434091-fw
head
9b882fa84f89908d193768ac3619b143621f3ea8
merged
6 months ago by Guillaume Teboul-Tornezy (gute)
odoo/odoo
17.0 #204489
saas-17.4 #208790
18.0 #209318
saas-18.1 #210658
saas-18.2 #210756
saas-18.3 #210788
saas-18.4
19.0
master #210831

[FW][FIX] account_payment: ensure consistent invoice and payment journal entry account_id

  • Configure a payment method (e.g. "demo") with an outstanding receipt account in the bank journal used by the website (automatic invoicing enabled). Enable Automatic Invoice for online payment.
  • Create a partner on the website using an incognito window. In the backend change their default property_account_receivable_id. Assign them a fiscal position where the receivable account is mapped to another account.
  • Make a purchase using the "demo" payment method with the new partner.

The generated invoice and its corresponding journal entry do not share the same account_id (Account Receivable).

The invoice uses the account_id computed in _compute_account_id of account.move.line, which is not necessarily the same as the account_id set on the partner.

After this commit, the payment uses the same account_id as the related invoice, (same as _create_payment_vals_from_wizard) avoiding any discrepancy.

opw-4669927

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #208790
Forward-Port-Of: #204489