This question has been flagged

Hi folks,

I'm creating a model for some objects and I want to classify them the same way products are classified by categories. I try to relate this module to product.category and I get this reference error.

Programming Error. There is no reference available for product.category

This is my code:

from osv import osv, fields

class my_model(osv.Model):
    _name = "my.model"
    _columns = {
        #Basic properties
        'obj_name':fields.char('Name', size = 64, required=True),
        'obj_manufac_date':fields.date('Manufacturing Date'),

        'obj_category_id':fields.many2one('product.category', 'Category'),
         }

Is there something else I need to make this work?

Thank you all,

jgonzalez

Avatar
Discard
Best Answer

check in the __openerp__.py file depend module product is added.
"depends": ['product']

Avatar
Discard
Author

Thanks so much. It worked fine.

please mark the answer as correct if it worked for you. Thanks