Skip to content
Snippets Groups Projects
user avatar
Alexandre Brun authored
8c98ccfa
History

OEC -- Open ERP Command

Overview

This program is created to insert data in OpenERP. For example a client database. It does not store values in memory as they are read and consumed on the fly.

Installation

Install the python package with:

python setup.py develop

or:

python setup.py install

Preparation

Copy oec.conf-sample to oec.conf:

cp oec.conf-sample oec.conf

Edit oec.conf and set the server, username, password and openerp database.

Here is a resulting example:

[server]
name = 127.0.0.1
port = 8069

username = admin
password = yourpassword

database = CRM

Usage

Launch the oec program:

$ oec -c oec.conf -i example/crmleads_create.json -t crm.lead -m create

Oec can also consume data from STDIN instead of a filename:

$ cat example/crmleads_create.json | oec -c oec.conf -t crm.lead -m create

For more information about the command line arguments run:

$ oec --help

If an error occurs on the OpenERP server, the error message will be printed on the STDOUT alongside the original data item sent for easy debugging:

$ oec -i example/crmleads_error_create.json -c ./oec.conf -t crm.lead -m create
***********************************
OpenERP Error message:
warning -- Integrity Error

The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set

[object with reference: name - name]
-----------------------------------
{'street': u'10 Downing street'}
***********************************
Import done in 0:00:00.255700
Average time per item: 0:00:00.127850