تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
4117 أدوات العرض

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.

أفضل إجابة

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.

 

الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال