[FIX] account: wrong destination account id in internal transfer
- Setup at least 2 bank accounts [ACC1] and [ACC2] - Setup a Journal [BNK1] with [ACC1] - Setup a second journal [BNK2] with [ACC2] - Create an Internal Outgoing Transfer from [BNK1] setting as destination journal [BNK2] - Save and confirm partner_bank_id will be selected from: - the Journal, for inbound payments, so [ACC1] - one, possibly the first, bank account of the company for outbound payment, so [ACC1] or [ACC2] This is wrong as [ACC2] should be used because defined on [BNK2] which is the destination journal opw-2794081 closes odoo/odoo#89599 X-original-commit: 4624d1ebdedf84ed3031f7af1be827de54f72566 Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
@@ -382,11 +382,13 @@ class AccountPayment(models.Model):
|
||||
else:
|
||||
payment.amount_signed = payment.amount
|
||||
|
||||
@api.depends('partner_id', 'company_id', 'payment_type')
|
||||
@api.depends('partner_id', 'company_id', 'payment_type', 'destination_journal_id', 'is_internal_transfer')
|
||||
def _compute_available_partner_bank_ids(self):
|
||||
for pay in self:
|
||||
if pay.payment_type == 'inbound':
|
||||
pay.available_partner_bank_ids = pay.journal_id.bank_account_id
|
||||
elif pay.is_internal_transfer:
|
||||
pay.available_partner_bank_ids = pay.destination_journal_id.bank_account_id
|
||||
else:
|
||||
pay.available_partner_bank_ids = pay.partner_id.bank_ids\
|
||||
.filtered(lambda x: x.company_id.id in (False, pay.company_id.id))._origin
|
||||
|
||||
Reference in New Issue
Block a user