[FIX] account: use same date for paired internal transfer

The paired payment generated when doing an internal transfer didn't have the correct date

Steps to reproduce:
1. Install Accounting
2. Go to Accounting -> Configuration -> Accounting -> Journals and duplicate the 'Bank' journal
3. Go to the Accounting Dashboard
4. Create a new internal transfer in Bank (go to the three dots on the top left corner of Bank and select New -> Internal Transfer)
5. Select 'Bank (copy)' as destination journal and select a date in the past
6. Save and confirm the internal transfer
7. Go to the paired internal transfer (link in the log notes)
8. The date of the transfer is the date of creation, it should be the same as the other transfer

Solution:
Use the date of the posted internal transfer to create the paired one

OPW-2710356
OPW-2730529

closes odoo/odoo#83316

X-original-commit: ce4b81e6abc49268623bad1fcb85e963eb8990c0
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
This commit is contained in:
Merlin (megu)
2022-01-25 13:52:39 +00:00
parent f389f59547
commit 1b8e3e4ec0
+2 -1
View File
@@ -877,7 +877,8 @@ class AccountPayment(models.Model):
'payment_type': payment.payment_type == 'outbound' and 'inbound' or 'outbound',
'move_id': None,
'ref': payment.ref,
'paired_internal_transfer_payment_id': payment.id
'paired_internal_transfer_payment_id': payment.id,
'date': payment.date,
})
paired_payment.move_id._post(soft=False)
payment.paired_internal_transfer_payment_id = paired_payment