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

Hi everyone,

Im trying to override a method that was already overridden in other own model. What happens is that i set a breaking point in my method but it does not in into the method.

The code in the model A:

@api.multi
def action_state_approve(self):
for state in self:
state.state = 'approved'

So in my other Model is where Im trying to override the above method:

class ClassB(models.Model):
_inherit = 'sale.order'

@api.multi
def action_state_approve(self):
super(ClassB, self).action_state_approve()
アバター
破棄
最善の回答

Hi.

Do you have set the inheritted function model in your __openerp__.py file?

You have to declare it in the depends key.

Kind regards.

アバター
破棄
最善の回答

return super(ClassB, self).action_state_approve()

アバター
破棄
最善の回答

Dear Osmani

Try to override by using Super Class Like This:

   @api.multi
def action_state_approve(self):
res= super(ClassB,self).action_state_approve()
...........
return res

I hope I helped you ...
アバター
破棄
関連投稿 返信 ビュー 活動
2
6月 15
3798
0
4月 24
1840
4
11月 23
5889
0
10月 23
1692
2
6月 23
2216