Set Text into a Field?

I am trying to create a Modul that helps finding Prices from Vendors over a Api key.
Now i am Stuck because i do not understand how can i set a Text into a Field?
i tried :
prieceField.setText()
or
prieceField = “string”
but with no luck.

In future i would like to convert the json File i get from a Vendor after a request into a Table. But for now i would be happy if i could set a Text in a field.

Thank you for helping me.

You should create an record instance (or get it from the database) and set the value on the field. For example:


pool = Pool()
Model = pool.get('your.model.name')
record = Model()
record.priceField = 'string'
record.save()

Will create a record in the database setting the string value to the priceField field.

i will try it. Thank you

If that worked for you it will be great if you can mark the post as solution.
Otherwise I will be happy to reply any other questions :wink:

I played around with that solution, but i has one catch. With this idea i can edit a existing record. But i can not set A Text into Field during the action.

I thought about adding a tkinter field or something like this. Or can i override the fields so i can develop a setText function?

What does “during the action” means?
What are you trying to achieve?

i hope this img helps to understand what i want to achieve. Like a google search … just for prices.

You should not use a form to make search, this is not an intended usage of the form.
Instead you should use a view with a context model like done for Sales → Products (which probably already does what you want).

ok i think this could be a great idea. I will try to modify Sales-Products Modul. Thank you. I will post my results.