콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
4060 화면

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
3962
0
4월 24
1976
4
11월 23
6089
0
10월 23
1828
2
6월 23
2354