[FIX] account: show suggestion only after second line and don't apply taxes from suggestions
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) <wan@odoo.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user