Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
1977 Widoki
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


Awatar
Odrzuć
Najlepsza odpowiedź


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

Awatar
Odrzuć
Autor Najlepsza odpowiedź

thank you for the help

Awatar
Odrzuć