Menjalankan Method ‘Read’ Dengan Python Melalui XML-RPC

#1 import xmlrpclib

import xmlrpclib

#2 Buat object ServerProxy ke /xmlrpc/obj pada remote server

obj_rpc = xmlrpclib.ServerProxy(‘http://localhost:8069/xmlrpc/object’)

#3 Jalankan method execute dengan parameter sebagai berikut :

dbname

char. Nama database

uid

int. User ID

pwd

string. Password dari uid

model

string. Nama object OpenERP

nama_method

string. Literal ‘read’

ids

list. List of ID dari resource OpenERP yang ingin dibuka

fields

list. List of string dari name field yang ingin diambil

contoh :

ids = [1, 3, 4]
fields = [‘name’, ‘active’]
hasil = obj_rpc.execute(‘tes_db’, 1, ‘password’, ‘res.partner’, ‘read’, ids, fields)

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s