From 46e6ae29411f07a55111da6672003fc8b88c1367 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Thu, 26 Jan 2023 15:14:19 +0000 Subject: [PATCH] [FIX] account: avoid invoice name reset when we change the name manually Before: - Create a new sales journal - Create a new first invoice - Do not put an invoice date yet - Change the name from 2023/000001 to e.g. 2023/000010 - Confirm the invoice - The name will change back to 2023/000001 (which is not the wanted behaviour) After: We avoid the change back by adding a condition in the _compute_name, which is triggered by the invoice_date being set while confirming. X-original-commit: e31c5767c894a92d22fa8201bc1ccf34b052a336 Part-of: odoo/odoo#111294 --- addons/account/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index b81fe67616b..7e80b36f463 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -667,7 +667,7 @@ class AccountMove(models.Model): highest_name = self[0]._get_last_sequence(lock=False) if self else False for move in self: - if not highest_name and move == self[0] and not move.posted_before and move.date: + if not highest_name and move == self[0] and not move.posted_before and move.date and (not move.name or move.name == '/'): # In the form view, we need to compute a default sequence so that the user can edit # it. We only check the first move as an approximation (enough for new in form view) move._set_next_sequence()