OK, so I've already asked a question how to access attribute data types when developing plugin for QGIS, using PyQGIS. And one helpful member said i should use pendingFields() method on the current layer. Here is the link on that query: LINK
Indeed I could access them but when I tried to change the data type with setType() and setTypeName() functions, it didn't work. When I queried the objects with type() and typeName() they showed the new data types I have given them, but when I wanted to enter new values for some feature I realized that this layer doesn't recognize new data types.
For example, first attribute field has by default Real data type, so it recognizes only numbers. I converted that field to String using command:
fields = currentLayer.pendingFields()
But the field still acts like before, and doesn't recognize letters, only numbers. How to change data types? Is it even possible? Or you can only define data type for new attribute?