Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
2884 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Risposta migliore

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
Abbandona