import xmlrpc.client # info = xmlrpc.client.ServerProxy('http://127.0.0.1:8069/').start() # url, db, username, password = info['host'], info['database'], info['user'], info['password'] # # uid = common.authenticate(db, username, password, {}) url = r'http://127.0.0.1:8069' common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url)) # print(common.version()) uid = common.authenticate('', 'admin', 'a6eb1f184da7fb2a1213c098ebdb8cc4f6863cd6', {}) print(uid) models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url)) # models.execute_kw(db, uid, password, 'res.partner', 'check_access_rights', ['read'], {'raise_exception': False}) a = models.execute_kw('', uid, 'a6eb1f184da7fb2a1213c098ebdb8cc4f6863cd6', 'res.partner', 'search', [[['is_company', '=', True]]]) print(a) b = models.execute_kw('', uid, 'a6eb1f184da7fb2a1213c098ebdb8cc4f6863cd6', 'res.partner', 'fields_get', [], {'attributes': ['string', 'help', 'type']}) print(b)
标签:info,uid,xmlrpc,models,common,odoo,print From: https://www.cnblogs.com/pythonClub/p/17367031.html