Odoo Help


How can I Import Customers to openerp via Python code?

on 1/17/15, 1:30 AM 1,177 views

Hi ,

Anybody can explain, How can I import Customer Name to Openerp by a custom module

Thanks in advance

Please elaborate more, what exactly you want.

Emipro Technologies Pvt. Ltd.
on 1/17/15, 1:59 AM
Kibong Moon
On 1/20/15, 1:14 AM

I'm not sure what you intend to do. But I assume you want to write a python code which perform importing customers outside Odoo web client.

In that case, you can use openerp_proxy (sudo pip install openerp_proxy if you didn't have it installed).

$ openerp_proxy

>>> db = session.connect()

(provide host, db, user, password at prompt)

>>> cmdl = db['res.partner']
>>> cinst = cmdl.create({'name': 'customer 1', 'display_name': 'Test Customer 1', 'customer': True})

It's done!

Let's verify it.

>>> cinst

11       -----> it's the id of new instance that stored in your database.

>>> cinst = cmdl.read(11)

>>> cinst = cmdl.read(11)
>>> cinst
{'ean13': False, 'property_account_position': False, 'signup_valid': False, 'ref_companies': [], 'sale_order_count': 0, 'write_uid': [1, 'Administrator'], 'contact_address': '\n\n  \n', 'property_product_pricelist': [1, 'Public Pricelist (EUR)'], 'signup_url': False, 'journal_item_count': 0, 'parent_name': False, 'display_name': 'customer 1', 'opt_out': False, ..............

ditors'], 'is_company': False, 'bank_ids': [], 'vat_subjected': False, 'section_id': False, 'property_supplier_payment_term': False, 'write_date': '2015-01-20 06:09:16', 'date': False, 'lang': 'en_US', 'credit_limit': 0.0, 'mobile': False, 'property_payment_term': False, 'category_id': []}


So you can see, you can create new records outside the odoo web using openerp_proxy.

I'm not sure but no one would recommend this way because you need lots of cautions.

Good luck!



Hengky Zhang
On 1/20/15, 12:10 AM

you can use .csv file to import the existing data to openerp

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 1/17/15, 1:30 AM
Seen: 1177 times
Last updated: 3/16/15, 8:10 AM