def validate_statement(cls, statements): Lang = Pool().get('ir.lang') for statement in statements: computed_end_balance = statement.start_balance for line in statement.lines: computed_end_balance += line.amount if computed_end_balance != statement.end_balance: lang, = Lang.search([ ('code', '=', Transaction().language), ]) amount = Lang.format(lang, '%.' + str(statement.journal.currency.digits) + 'f', computed_end_balance, True) cls.raise_user_error('wrong_end_balance', error_args=(amount,)) for line in statement.lines: line.create_move()