[IMP] account: improve error message of mismatched date and sequence number
The error message when resetting a payment to draft and changing the date is not adequate. This aims to guide the user to the appropiate journal entry where changes are required. part 2 of task [2533660] closes odoo/odoo#73470 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
@@ -63,12 +63,14 @@ class SequenceMixin(models.AbstractModel):
|
||||
or format_values['month'] and format_values['month'] != date.month
|
||||
):
|
||||
raise ValidationError(_(
|
||||
"The %(date_field)s (%(date)s) doesn't match the %(sequence_field)s (%(sequence)s).\n"
|
||||
"You might want to clear the field %(sequence_field)s before proceeding with the change of the date.",
|
||||
"The %(date_field)s (%(date)s) doesn't match the sequence number of the related %(model)s (%(sequence)s)\n"
|
||||
"You will need to clear the %(model)s's %(sequence_field)s to proceed.\n"
|
||||
"In doing so, you might want to resequence your entries in order to maintain a continuous date-based sequence.",
|
||||
date=format_date(self.env, date),
|
||||
sequence=sequence,
|
||||
date_field=record._fields[record._sequence_date_field]._description_string(self.env),
|
||||
sequence_field=record._fields[record._sequence_field]._description_string(self.env),
|
||||
model=self.env['ir.model']._get(record._name).display_name,
|
||||
))
|
||||
|
||||
@api.depends(lambda self: [self._sequence_field])
|
||||
|
||||
Reference in New Issue
Block a user