스크립트를 만들어 한 데이터베이스에서 다른 데이터베이스로 데이터를 가져올 수 있습니다.
import xmlrpclib
from osv import osv, fields
#To create connection to the database from where you want to import data
def connect_server(self, cr, uid, ids, context=None):
sock_common = xmlrpclib.ServerProxy ('http://localhost:8070/xmlrpc/common', encoding="UTF-8")
remote_uid = sock_common.login(database_name, user_name, password)
sock = xmlrpclib.ServerProxy('http://localhost:8070/xmlrpc/object', encoding="UTF-8")
return (sock, remote_uid)
#Fetch data from another database
def get_data(cr, uid, ids, context=None):
sock, remote_uid = self.connect_server(cr, uid, ids, context=context)
pos_order_obj = self.pool.get('pos.order')
pos_order_ids = sock.execute(db_name, remote_uid, password, pos_order_obj._name, 'search', [])
for pos in in sock.execute(db_name, remote_uid, password, pos_order_obj._name, 'read', pos_order_ids, []):
#fetch the data and create record in your current database.
new_pos_val = {'name': pos['name'],}
pos_order_obj.create(cr, uid, new_pos_val, context=context)
return True
희망 사항은 문제를 해결할 것입니다.
저에게 프로그래밍 질문처럼 보이지 않습니다. – Junuxx