Skip to Content
Menu
This question has been flagged
3 Replies
3338 Views

I want to extend the product.category model and Odoo doesn't let me! 

class ProductCategory(models.Model):
    _inherit = 'product.category' 

I get the following error:


2015-07-16 11:06:27,473 16220 CRITICAL odoo_8a openerp.service.server: Failed to initialize database `odoo_8a`.
Traceback (most recent call last):
File "C:\Users\laflammm\Desktop\GitHub\odoo\openerp\service\server.py", line 929, in preload_registries
registry = RegistryManager.new(dbname, update_module=update_module)
File "C:\Users\laflammm\Desktop\GitHub\odoo\openerp\modules\registry.py", line 370, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "C:\Users\laflammm\Desktop\GitHub\odoo\openerp\modules\loading.py", line 351, in load_modules
force, status, report, loaded_modules, update_module)
File "C:\Users\laflammm\Desktop\GitHub\odoo\openerp\modules\loading.py", line 255, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "C:\Users\laflammm\Desktop\GitHub\odoo\openerp\modules\loading.py", line 152, in load_module_graph
models = registry.load(cr, package)
File "C:\Users\laflammm\Desktop\GitHub\odoo\openerp\modules\registry.py", line 163, in load
model = cls._build_model(self, cr)
File "C:\Users\laflammm\Desktop\GitHub\odoo\openerp\models.py", line 595, in _build_model
original_module = pool[name]._original_module if name in parents else cls._module
File "C:\Users\laflammm\Desktop\GitHub\odoo\openerp\modules\registry.py", line 102, in __getitem__
return self.models[model_name]
KeyError: 'product.category'

I don't get it... I was able to extend res.partner and res.users with no problem! I'm using Odoo V8

Any help would be appreciated.

Avatar
Discard
Best Answer

Mathieu,

It seems you miss to set the 'product' module inside the 'depends' of __openerp__.py file.

Or if it is there, we guess you have setup auto_install=True in __openerp__.py.

Hope this helps.

Thanks.


Avatar
Discard
Author

I didn't know I needed to explicitly indicate the dependencies. I though it could access stuff that are currently installed. But it makes total sense. Thanks

Best Answer

Depend on your needs, maybe you can have a look here

https://github.com/syleam/product_category_extended

Avatar
Discard
Related Posts Replies Views Activity
4
Mar 24
1659
1
Oct 23
3656
1
Jun 22
4908
4
Jun 21
13941
2
Aug 17
11586