[FW][FIX] account: sequence mismatch handling

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) <wan@odoo.com>
This commit is contained in:
qdp-odoo
2022-12-15 21:18:59 +01:00
parent e99772d834
commit 997a6d3e27
+1 -4
View File
@@ -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()