From 20df6453df866b89edc98cb02cdcc9bc806038cf Mon Sep 17 00:00:00 2001 From: Swapnesh Shah Date: Wed, 28 Jul 2021 17:12:08 +0000 Subject: [PATCH] [FIX] account: do not set deprecated account as default Before this commit, It was setting first available account as default regardless of it is deprecated or not. With this commit, we are excluding deprecated account as default. Fixes #74280 closes odoo/odoo#74901 X-original-commit: fa07151785d9a3b3cbaddba34bea072eceda0e81 Signed-off-by: Laurent Smet --- addons/account/models/account_payment.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index 80ca759301d..79048dc8176 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -456,6 +456,7 @@ class AccountPayment(models.Model): pay.destination_account_id = self.env['account.account'].search([ ('company_id', '=', pay.company_id.id), ('internal_type', '=', 'receivable'), + ('deprecated', '=', False), ], limit=1) elif pay.partner_type == 'supplier': # Send money to pay a bill or receive money to refund it. @@ -465,6 +466,7 @@ class AccountPayment(models.Model): pay.destination_account_id = self.env['account.account'].search([ ('company_id', '=', pay.company_id.id), ('internal_type', '=', 'payable'), + ('deprecated', '=', False), ], limit=1) @api.depends('partner_bank_id', 'amount', 'ref', 'currency_id', 'journal_id', 'move_id.state',