Archive

Archive for May, 2011

Squid, CherryPy and OpenERP

Squid (software)

Image via Wikipedia

This is going to be quick…

Squid and CherryPy (therefore the web client of OpenERP) do not get along pretty well. Reason being CherryPy expects to know the originating URL by reading the http “X-Forwarded-Host” header. The only reverse proxies that add this header are Apache (mod_proxy) and Lighttp. This does not happen with Squid. Actually it does, but this information is published under the variable “Origin”. The result is in order to integrate CherryPy with Squid, you need to modify a little bit the CherryPy code.

In the file lib/ctools.py, located under the root of CherryPy (v3) you can find the proxy function. Just by setting the input variable of the “local” function, which is set by default in “X-Forwarded-Host”, to “Origin” is enough. And doing so you will be able to save a lot of time (in my case 4 hours) and trouble.

You might wonder why you need this, just in case you need to work  with OpenERP behind a reverse proxy like Squid.

Cheers!

Advertisements

A list of OpenERP blogs

Not covered by openerp.com/planet (they should be added there though). Some of these blogs are in spanish and one of them is in portuguese, but I thought it makes sense to list them here as well.

And last but not least…
It’s shocking to see a newspaper specialized in OpenERP
Categories: Uncategorized

A mandatory module for OpenERP, product_code_mandatory

This is a module I found in apps.openerp.com, product_code_mandatory. You can find it in

http://apps.openerp.com/addon/5588

(I wonder why they have not enabled the Drupal module pathauto in this site). What does the product_code_mandatory module do? Very simple, sets de default_code attribute in the product.product class mandatory. Very simple module, really needed (I had to develop it myself for a client). I expect it to be widely adopted. Also is a very clean module that teaches you how to start developing modules for OpenERP

Cheers!

Categories: Uncategorized

Python for Fun, a cool website for practicing Python

I just found this nice website, aimed at the intermediate Python programmer. Contains small Python programs, which will expand our Python knowledge. Hope you enjoy it as much as I do!

http://openbookproject.net/py4fun/

Categories: Python, Reads, Uncategorized

Importing products with web-services in OpenERP

Python logo

Image via Wikipedia

Yesterday someone at the OpenERP forum asked me for an example of how to import product data into OpenERP, so here it is, below you will find an example of a Python script for loading basic product data.

#!/usr/bin/env python
# coding: utf-8

import xmlrpclib
import csv

username = ‘admin’ #the user
pwd = ‘pwd_admin’ #the password of the user
dbname = ‘blog_db’ #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’)

#load categories first
filename = “categories.csv”
reader = csv.reader(open(filename,”rb”))
for row in reader:
category = {
‘name’: row[1],
‘active’: True,
}
category_id = sock.execute(dbname, uid, pwd, ‘res.partner.category’, ‘create’, category)
print category_id

print “End categories load”

filename = “product_template.csv”
reader = csv.reader(open(filename,”rb”))
for row in reader:
product_template = {
‘name’: row[0].rstrip(),
‘supply_method’:’produce’,
‘standard_price’:1,
‘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)
print template_id

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

print “End product load”

This is a simple script you can execute from the command line. In summary, first you need to create the categories and then you need to create the product.template objects and product.product objects. If you have any question about this, please let me know.

Cheers!

OpenERP and E-Commerce

Shield logo for Ubercart project

Image via Wikipedia

Last week a client asked me if OpenERP had an E-Commerce solution, and she was disappointed when I said no. But she was glad when I explained her why it was already integrated with existing open-source e-commerce solutions, such as Magento. And I wanted to share my thoughts on this, since some people keep asking for integrated e-commerce functionality (as well as business intelligence functionality).

To the best of my knowledge, to this day OpenERP already has connectors to Magento Commerce and Joomla. Does not have connectors to Drupal (Ubercart and Drupal Commerce projects) but I expect OpenERP to have those connectors soon since the Drupal community is growing fast (actually I am really tempted to develop a connector to Drupal Commerce but first I need a project to fund the development, and I need the time. Plus, Drupal Commerce first has to release an stable release). Which means, you can install your e-commerce solution, and integrate it with OpenERP.

What areas do you have to integrate? The product catalog comes to my mind (and the ability to manage multiple pictures per product). Then the sales orders, invoices, price lists and the delivery and inventory information. Those are the information items that should be available to the e-commerce solution, in order to make it work properly. Then the customer information, such as credit limits and order history. Lots of information that needs to be pulled from OpenERP.

OK, now why it is not a good idea for OpenERP to be a full-fledge e-commerce solution. Because the ERP and MRP problems are big enough. That’s why. E-Commerce is a different beast on its own, that demands other skills. Such as having the ability to make the page look good and the capability of implementing a design in your page. Plus, the page needs to be optimized for search, and the e-commerce solution needs to manage content the way a CMS does. That is quite an stretch for an ERP system. Ah! Have I mentioned that e-commerce packages need to integrate with payment gateways and sometimes need to be multi-lingual?

At the end of the day, the OpenERP community is not big enough to justify the development of an e-commerce solution on its own, and the e-commerce packages around already do an outstanding job. We will be much better off focusing on the development of the integration connectors, rather than developing an e-commerce solution from the ground-up.

Cheers,

OpenERP Quizz, a good idea

Just found this link in the forum:

http://www.openerp.com/functional-test

It’s a very good idea and just wanted to share it with you,

Have a great weekend!

Categories: Uncategorized