Last active
July 1, 2020 13:05
-
-
Save jev-odoo/bcc7a17015e403b04dc4b5ebe09db2d3 to your computer and use it in GitHub Desktop.
OdooRPC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| USER = 'admin' | |
| PASS = 'admin' | |
| import xmlrpc.client | |
| HOST = <your_database_host> # ex: http://localhost:8069 | |
| DB = <your_database_name> | |
| COMMON = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(HOST)) | |
| UID = COMMON.authenticate(DB, USER, PASS, {}) | |
| def call(model, method, args, kwargs): | |
| models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(HOST)) | |
| return models.execute_kw(DB, UID, PASS, | |
| model, method, | |
| args, kwargs) | |
| allfields = [] | |
| attributes = {} | |
| fields_list = call('res.partner', 'fields_get', allfields, attributes) | |
| print(fields_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment