This question has been flagged
2 Replies
2296 Views

HI,

Since delegation inheritance does not inherits methods how would I call a method from the model I have inherited from in my new model?

Thanks,

Avatar
Discard
Best Answer

Robert explicitly asks about delegation inheritance which indeed does not inherit methods (and it's a problem). But you instead talk about Traditional inheritance which does inherit methods and so requires no explanation.

FYI:
delegation inheritance: Product => Template:

_inherits = {'product.template': 'product_tmpl_id'}

traditional inheritance: Template => mail.thread:

_inherit = ['mail.thread']
Avatar
Discard
Best Answer

I think you got little confused here,

Delegation Inheritance will inherit methods too.

you just need to call it using self.METHOD_NAME


Best example is mail.thread object which would have been inherited in almost the main objects, So if you notice method message_post is actually defined in mail.thread, while its child class can simply call the method the way it calls its own method

Avatar
Discard