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 to determine if we need to instantiate an object?

By
Roger Chen
on 3/25/14, 2:29 AM 836 views

OpenERP Document

doc.openerp.com trunk server 03_module_dev_02

tells that:

To define a new object, you must define a new Python class then instantiate it. This class must inherit from the osv class in the osv module.

and gives a sample code:

class name_of_the_object( osv.osv ):
     _name = 'name.of.the.object'
     _columns = { ... }
    #...
name_of_the_object()  #instantiate here

However, in Product Variant Multi module, objects in product_variant.py like

product_variant_dimension_type

and

product_variant_dimension_option

do not have this kind of code to do instantiation.

class product_variant_dimension_type(orm.Model):
    _name = "product.variant.dimension.type"
    _description = "Dimension Type"
    _columns = {
        # fields...
    }
    # others...
# No instantiate code: "product_variant_dimension_type()" here

So when should we instantiate an object?

0
Weste
On 3/25/14, 12:20 PM

orm.Model is more or less the same as osv.osv

I think it didn't answer my question above, but you're right that orm.Model is more or less the same as osv.osv.

Roger Chen
on 3/26/14, 4:57 AM

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: 3/25/14, 2:29 AM
Seen: 836 times
Last updated: 3/16/15, 8:10 AM