[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 <smetl@users.noreply.github.com>
This commit is contained in:
Swapnesh Shah
2021-08-10 08:05:03 +00:00
committed by GitHub
parent 815ca6be5d
commit 20df6453df
+2
View File
@@ -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',