odoo/odoo#263169

Created by fw-bot
Merged at 38afd6a20a73575e736dc6a8bdb306cf5fbb752a

Statuses:

label
odoo-dev:saas-18.3-18.0-opw-6044883-reverse_journals_for_refund-aksi-524128-fw
head
0ce075ad544322542c37c3f0b3929d1c839dbb9e
merged
3 days ago by Ajit Kumar Krishnanand Singh (aksi)
odoo/odoo
18.0 #256258
saas-18.2 #263146
saas-18.3 #263169
saas-18.4 #263189
19.0 #263230
saas-19.1 #263292
saas-19.2 #263360
saas-19.3 #263390
master #263595 missing statuses missing r+

[FIX] point_of_sale: do not swap accounts for outbound payments

Step to reproduce:
- we need a session, where in total, we gave out money (when we refund)
- for this, start a pos session, do a order, pay using bank and close session
- restart the pos, refund the order, and pay using bank, close it.
- go to accounting > customer > payment
- open payment for both session

Observation:
- in journal entries for both payment, amount is credit into
account_receivable and debit from outstanding account

Cause:
- commit[1] swaps accounts when we have outbound payments, which is functionally
incorrect and lead to this issue.
[1] 844d2960af6b2cdd8620eb1681bda03dd48a97e4

Fix:
- do not swap accounts between outstanding and destination accounts.

Expected after fix:
- Inbound and outbound payments use the same accounts
- Journal entries are correct:
- Inbound: debit outstanding, credit account_receivable
- Outbound: reverse of inbound entries

opw-6044883

Forward-Port-Of: #256258