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

osv_memory inheritance - Odoo 8

By
Alejandro Perez Cosio
on 4/27/15, 5:46 PM 899 views

Dear all,

I need to inherit the osv_memory model 'pos.session.opening' but when I try to install my custom module, I get this error: 

[...] 
 File "/home/ale/Projects/odoo/openerp/models.py", line 592, in _build_model
original_module = pool[name]._original_module if name in parents else cls._module
File "/home/ale/Projects/odoo/openerp/modules/registry.py", line 101, in __getitem__
return self.models[model_name] KeyError: 'pos.session.opening'

This is my code:

from openerp.osv import osv
class pos_session_opening(osv.osv_memory):
   _inherit = 'pos.session.opening'
   _name = 'pos.session.opening' [...]

If I replace the 'pos.session.opening' string in both variables with 'res.config' (which is also osv_memory) I get no error at all..

I'm I doing something wrong?

Regards!

1
Mansi Kariya (mka)
On 4/28/15, 3:06 AM

Hello Alejandro Perez Cosio,

Make sure that you have kept point_of_sale module in your custom module's dependency list. As pos.session.opening model belongs to point_of_sale, So point_of_sale needs to install first before your custom module

Hope this will help you.

Hello Mansi, thank you for your answer, I did install point_of_sale before my module but didn't put it as a dependency, so I thought it would be enough.. I tried again putting the dependency and guess what.. it worked!

Alejandro Perez Cosio
on 4/28/15, 8:11 AM

You should add point_of_sale to your module dependency list As this is best practise to install dependency modules first. If you add point_of_sale to your custom module's dependency list, this will not through you error next time when you try to install your custom module in new database Instead it will automatically install point_of_sale before your module's installation. And this way you need not to remember to install point_of_sale first for all the new databases you create.

Mansi Kariya (mka)
on 4/28/15, 8:21 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: 4/27/15, 5:46 PM
Seen: 899 times
Last updated: 4/28/15, 8:11 AM