将openerp 7与网站连接起来

时间:2014-10-31 12:34:47

标签: openerp openerp-7 odoo

我想知道如何将所有可用产品(从openERP 7)显示到网站。潜在客户应该能够浏览,选择并获得报价。非常感谢任何想法。

1 个答案:

答案 0 :(得分:0)

你需要使用XMLRPC从opennerp服务器中获取数据,使用一些脚本,这里是简单的pytohn XML-RPC示例,但你可以在不同的lang中使用diff lib来调用XML-RPC:

import xmlrpclib

username = 'admin' #the user
pwd = 'admin'      #the password of the user
dbname = 'openerp'    #the database

# Get the uid
sock_common = xmlrpclib.ServerProxy ('http://localhost:8069/xmlrpc/common')
uid = sock_common.login(dbname, username, pwd)

#replace localhost with the address of the server
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
#THis will search all product from database.
product_ids = sock.execute(dbname, uid, pwd, 'product.product', 'search', [])
#This will read all product from that db with all fields.
product_vals = sock.execute(dbname, uid, pwd, 'product.product', 'read', product_ids)

有关XML-RPC和Web服务的更多信息is here. Odoo首席执行官解释了更多here