Reputation: 47
I try to insert a tree template inside a tab on Odoo.
I have a problem when I want to implement a new class. Class in relation with another template created.
Server trace-back :
File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 101, in __getitem__
return self.models[model_name]
KeyError: 'products.group'
Do you have an idea ?
original
from openerp.osv import fields, osv
from openerp.tools.translate import
class product_template(osv.osv):
_inherit = "product.template"
_description = "ClicShopping Product Template"
my modifications
from openerp.osv import fields, osv, orm
from openerp.tools.translate import
class product_template(osv.osv):
_inherit = "product.template"
_description = "Product Template"
_columns = { ......}
class products_group(orm.Model):
_inherit = 'products.group'
_columns = { ......}
My template products_group(orm.Model):
from openerp.osv import orm, fields
from openerp.tools.translate import _
class products_group(orm.Model):
_name = 'products.group'
_columns = { ......}
Upvotes: 0
Views: 1831
Reputation: 11141
In OpenERP, Sequence is matter when we inherit other class. So first we need to match that hierarchical. For example if any new object is define in other files and we inherit that class in another file than we must to load/import parent file first. So we never get that type of key error
In your case, if class products_group
is define in other file than check out sequence of import that file in __ init __.py
Make sure __ init __.py first load with this
code _name = 'products.group'
Upvotes: 0