Toll Free: (855) 881-7165

LiveZilla Live Chat Software             

OpenERP 7.0 Videos - Install, Configure, and Implement OpenERP

21

OpenERP 7 is a great open source ERP platform that is easy to install and very modular. Working with clients in OpenERP and helping them make difficult decisions we have found one of the most helpful steps is getting their company data into OpenERP. So many ERP vendors are trying so hard to sell the product they are not even willing to go through the effort of demonstrating their system with at least some company data in place for them to work with. The purpose of this article and video is to demonstrate just how easy it is to write a custom script to import data into OpenERP. 

Source code used in the video is provided below.



Example Python Script for importing data into OpenERP 7 using XML-RPC method


import xmlrpclib
import csv

username = "admin"
pwd = "demo"
dbname = "db2"

sock_common = xmlrpclib.ServerProxy("http://localhost:8069/xmlrpc/common")

uid = sock_common.login(dbname, username, pwd)

sock = xmlrpclib.ServerProxy("http://localhost:8069/xmlrpc/object")

reader = csv.reader(open('products.csv','rb'))
for row in reader:
    print row[1]
    product_template = {
        'name': row[1],
        'standard_price':row[2],
        'list_price':row[2],
        'mes_type':'fixed',
        'uom_id':1,
        'uom_po_id':1,
        'type':'product',
        'procure_method':'make_to_stock',
        'cost_method':'standard',
        'categ_id':1}
    template_id=sock.execute(dbname, uid,pwd, 'product.template','create',product_template)

    product_product = {
        'product_tmpl_id':template_id,
        'default_code':row[0],
        'active': True,
        }
    product_id = sock.execute(dbname,uid,pwd,'product.product','create',product_product)





Post Rating

Comments

There are currently no comments, be the first to post one.

Post Comment

Name (required)

Email (required)

Website

CAPTCHA image
Enter the code shown above: