From 5e637beeb95976130dae329b7478887ca9c8edfc Mon Sep 17 00:00:00 2001 From: "Maruan Aguerdouh (magm)" Date: Tue, 24 Jan 2023 10:40:48 +0000 Subject: [PATCH] [FIX] account: show suggestion only after second line and don't apply taxes from suggestions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce: - Go to accounting > journal entries > create a new journal entry. - Add a line with an account. - Add a second line. Previous behavior: We are going to get in the second line a suggestion of the first line introduced, also even if we don't select the suggestion the taxes of the suggestion will be applied. Current behavior: As discussed with the PO, we only want to get suggestions when we used 2 accounts in a row, so the 3rd line will be the one getting the suggestion. And we also avoid seting the taxes of the suggestion if we don't select it. Related to #39784 opw-3098361 closes odoo/odoo#118865 X-original-commit: 927890d0178c361ef8d80fe6a1ec2ffaefaf73fd Related: odoo/enterprise#39921 Signed-off-by: William André (wan) --- addons/account/models/account_move_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move_line.py b/addons/account/models/account_move_line.py index b95c8a935ca..7da15cde6f4 100644 --- a/addons/account/models/account_move_line.py +++ b/addons/account/models/account_move_line.py @@ -592,7 +592,7 @@ class AccountMoveLine(models.Model): previous_two_accounts = line.move_id.line_ids.filtered( lambda l: l.account_id and l.display_type == line.display_type )[-2:].account_id - if len(previous_two_accounts) == 1: + if len(previous_two_accounts) == 1 and len(line.move_id.line_ids) > 2: line.account_id = previous_two_accounts else: line.account_id = line.move_id.journal_id.default_account_id