Reputation: 21939
I have found some examples using model = 'res.partner'
but I want to work with other models. I tried res.product but that didn't work. How can I get a list of usable models?
Upvotes: 1
Views: 3627
Reputation: 121
Another way is to use Openerp Proxy lib t work via xmlrpc. It has IPython shell to debug data.
In Your case to get list of all available models just install and run openerp_proxy shell:
$ pip install openerp_proxy
$ openerp_proxy
connect to database:
>>> db = session.connect()
and print list of all models:
>>> db.registered_objects
# Here will be printed list of all registered models in database
to search for specific models You can do something like this:
>>> for model in sdb['ir.model'].search_records([('model','like','res.partner')]):
print "{0:<20}\t{1:<30}".format(model.name, model.model)
Partner res.partner
Bank Accounts res.partner.bank
Bank Account Type res.partner.bank.type
Bank type fields res.partner.bank.type.field
Partner Categories res.partner.category
res.partner.title res.partner.title
(for more info read the docs)
And in future versions some syntax sugar will be implemented)
Upvotes: 1
Reputation: 639
All the models in Odoo are also tables in the postgresql database. So you also could get the description of the PostgreSQL database via autodoc.
postgresql_autodoc -h localhost -p 5432 -d database -U user
Upvotes: 1
Reputation: 21939
ir.model
contains a list of all models. ir
stands for information retrieval.
A very convenient way to get a better grasp of Odoo's XML-RPC is by using ERPpeek:
sudo pip install -U erppeek
erppeek --server=https://example.com -d your_db -u admin -p password
your_db >>> models()
Upvotes: 5