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

How to manage the use of osv object inheritance ?

By
Yug Faa
on 3/13/13, 10:35 AM 1,245 views

Hello everyone,

I ask this question because I don't find the answer in the memento and the developper book, I want to know the order.

We have this class on module base:

class res_partner(osv.osv):
    _description = 'Partner'
    _name = "res.partner"

    def create(self, cr, ....
...
res_partner()

I inherit from the first module module1 the class res_partner() as :

class res_partner(osv.osv):
    _description = 'Partner'
    _inherit = "res.partner"

    def create(self, cr, ....
        return super(res_parner, self).create(cr, ...
...
res_partner()

I inherit in a second module module2 from res_partner() as :

class res_partner(osv.osv):
    _description = 'Partner'
    _inherit = "res.partner"

    def create(self, cr, ....
        return super(res_parner, self).create(cr, ...
...
res_partner()

Now when I call create from the last module module2 how can make it call the create of module1 ? and how to call the create of module base without passing by inheritance ?

Best regards

1
Allison
On 3/13/13, 11:12 AM

I'm not sure if this accomplishes what you need, but have you played around with the 'depends' option in the __openerp__.py file? You could try having module2 depend on module1. Just a thought - I'm still a newbie.

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: 3/13/13, 10:35 AM
Seen: 1245 times
Last updated: 3/16/15, 8:10 AM