Odoo Help

Welcome!

This community 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.

0

How can I Import Customers to openerp via Python code?

By
Odoo
on 1/17/15, 1:30 AM 766 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
0
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!

Kibong.

 

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

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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