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

Inherit Product Category issue

By
Mathieu Laflamme
on 7/16/15, 11:16 AM 760 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.

0

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
4341
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 7/16/15, 11:44 AM

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.


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

Mathieu Laflamme
on 7/16/15, 2:21 PM
0
Bruno JOLIVEAU
On 7/22/15, 10:25 AM

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

https://github.com/syleam/product_category_extended

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: 7/16/15, 11:16 AM
Seen: 760 times
Last updated: 7/22/15, 10:25 AM