From 997a6d3e2756c4de2426374ff93f93592d8b7017 Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Thu, 15 Dec 2022 21:18:59 +0100 Subject: [PATCH] [FW][FIX] account: sequence mismatch handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed annoying error raised onchange of the date/name if they don't match anymore. This was done during the update, which was dumb since it was popping in case you wanted to change both the date and the name. It now only relies on the constraint that is verified upon posting the invoice. Onchange warning is kept only for the format change. Ensure the date constraint is always verified no matter if the invoice was already posted before, or if we're in quick edit mode: the date's info located in the name must always match the accounting date. This is ensured when posted. task-2976499 closes odoo/odoo#108116 Forward-port-of: odoo/odoo#107867 Signed-off-by: William André (wan) --- addons/account/models/account_move.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 187269c9e26..b3bfe769652 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1562,7 +1562,7 @@ class AccountMove(models.Model): if ( new_format != origin_format - or dict(new_format_values, seq=0) != dict(origin_format_values, seq=0) + or dict(new_format_values, year=0, month=0, seq=0) != dict(origin_format_values, year=0, month=0, seq=0) ): changed = _( "It was previously '%(previous)s' and it is now '%(current)s'.", @@ -2365,9 +2365,6 @@ class AccountMove(models.Model): # SEQUENCE MIXIN # ------------------------------------------------------------------------- - def _must_check_constrains_date_sequence(self): - return not self.posted_before and not self.quick_edit_mode - def _get_last_sequence_domain(self, relaxed=False): # EXTENDS account sequence.mixin self.ensure_one()