コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
2897 ビュー

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,

アバター
破棄
最善の回答

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']
アバター
破棄
最善の回答

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

アバター
破棄