Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
1976 Weergaven
I'm trying to create a contact from his last name, first name and phone number using the ODOO ORM with the "create()" method.
the method used is:

"""
#data for contact record
#values={"":"","":""}
contact_id = self.env['res.partner'].sudo().create(values)
"""

but I am looking for the model structure and the fields of the res.partner to create the data dictionary before calling the method


Avatar
Annuleer
Beste antwoord


Hi, if you are looking for model structure filtered by model name I think you have 3 good ways:


1) enable 'debug mode', go to menù Settings/Technical/Database Structure/Models.  In the top right side of the screen you can find a Search View where you can filter by Technical name (filter by module name) or filter by model (model name).

One way to discover 'model name' from UI is to look at url and check for 'model=' in the url string. You will see the 'dotted' name of the model. Use it in the 'Search View' in order to filter by model name and find the model structure with list of all stored fields. 


2) enable 'debug mode', simply go to UI form, tree view or the view where you see the field you need to fill, and keep the mouse on it. In debug mode you will se a label appearing al tell you the technical name for the field


3) Use IDE and search for model name (or class) directly in the source code. Due to python and ORM inheritance mechanism this could be a little tricky sometimes, but is often the best way to go if you are well aware of what you are searching for

Avatar
Annuleer
Auteur Beste antwoord

thank you for the help

Avatar
Annuleer