'Checks that all posted moves have still the same data as when they were posted
and raises an error with the result.'

@api.model
def _check_hash_integrity(self, company_id):

    moves = self.search([('state', '=', 'posted'), ('company_id', '=', company_id), ('l10n_fr_secure_sequence_number', '!=', 0)], order='l10n_fr_secure_sequence_number    ASC')
    if (not moves):
        raise UserError(_('Warning:    impossible    to    find    any    move    with    a    hash.'))
    previous_hash = ''
    start_move_info = []
    for move in moves:
        if (move.l10n_fr_hash != move._compute_hash(previous_hash=previous_hash)):
            raise UserError((_('Corrupted    Data    on    move    %s.') % move.id))
        if (not previous_hash):
            start_move_info = [move.date, move.l10n_fr_secure_sequence_number]
        previous_hash = move.l10n_fr_hash
    end_move_info = [move.date, move.l10n_fr_secure_sequence_number]
    raise UserError((_('Successfully    checked    the    integrity    of    account    moves.\n\n                                                                                                    The    account    moves    are    guaranteed    to    be    in    their    original    and    inalterable    state\n                                                                                                        -    since:            %s                    (Sequence    Number:    %s)\n                                                                                                        -    to:                        %s                    (Sequence    Number:    %s)') % (start_move_info[0], start_move_info[1], end_move_info[0], end_move_info[1])))
