Odoo Help


How can I create a product in Python interactively?

Kasper Souren
on 7/14/14, 1:53 PM 1,500 views

I want to interactively create new product. I got as far as importing the addon:


import openerp


from openerp.addons.product import product

p = new product.product_product()

SyntaxError: invalid syntax

p = product.product_product()


NoneType   # no luck here either

# And then there is...


TypeError: unbound method create() must be called with product_product instance as first argument (got nothing instead)

# Ok I get that, but how do I create a product_product instance?

# And this one is not very clear either:


TypeError: create_instance() takes exactly 3 arguments (1 given)

# But the docstring is not very helpful.




Kasper Souren
On 8/1/14, 7:04 AM

Use ERPpeek:

models('product') # get a list of models that contain the word product

m = model('product.product')

p = m.create({ 'name': 'Test product' })

# p.unlink()  # If you want to remove your test product


See also this tutorial.

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: 7/14/14, 1:53 PM
Seen: 1500 times
Last updated: 3/16/15, 8:10 AM