From 88bae9969c2f14075f429ad79fb470aa8451b068 Mon Sep 17 00:00:00 2001 From: "Nicolas (vin)" Date: Tue, 8 Sep 2020 05:56:39 +0000 Subject: [PATCH] [FIX] account : fix domain of accounts in the automatic entry wizard Two account.account M2O where authorizing off-balance accounts while they should not be selectable. This change aim to fix that. closes odoo/odoo#57345 X-original-commit: cd25dba354b9d2a83e6b7ab45434bb2879984e33 Signed-off-by: Quentin De Paoli (qdp) Signed-off-by: Nicolas Viseur --- addons/account/wizard/account_automatic_entry_wizard.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/account/wizard/account_automatic_entry_wizard.py b/addons/account/wizard/account_automatic_entry_wizard.py index c3f5cb49b47..4c989cc7548 100644 --- a/addons/account/wizard/account_automatic_entry_wizard.py +++ b/addons/account/wizard/account_automatic_entry_wizard.py @@ -29,10 +29,14 @@ class AutomaticEntryWizard(models.TransientModel): # change period account_type = fields.Selection([('income', 'Revenue'), ('expense', 'Expense')], compute='_compute_account_type', store=True) expense_accrual_account = fields.Many2one('account.account', readonly=False, - domain="[('company_id', '=', company_id), ('internal_type', 'not in', ('receivable', 'payable'))]", + domain="[('company_id', '=', company_id)," + "('internal_type', 'not in', ('receivable', 'payable'))," + "('is_off_balance', '=', False)]", related="company_id.expense_accrual_account_id") revenue_accrual_account = fields.Many2one('account.account', readonly=False, - domain="[('company_id', '=', company_id), ('internal_type', 'not in', ('receivable', 'payable'))]", + domain="[('company_id', '=', company_id)," + "('internal_type', 'not in', ('receivable', 'payable'))," + "('is_off_balance', '=', False)]", related="company_id.revenue_accrual_account_id") # change account