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

I inherited a model and put in a method for a scheduled action with some helper functions. I'm getting this error when i run it from the front end why?

NameError: name 'do_something_else' is not defined

I have something like this..


classProducTemplate(models.Model):    
​_inherit = 'product.template'​

​def action_do_something(self):
​do_something_else()
​@staticmethod
​def do_something_else():
​pass



아바타
취소
작성자 베스트 답변

I omitted "self"

class ProducTemplate(models.Model):
_inherit = 'product.template'

@staticmethod
def do_something_else():
pass

def action_do_something(self):
self.do_something_else()


아바타
취소
베스트 답변

Hi,

The definition do_something_else needs to exist before you start to reference it.

class ProducTemplate(models.Model):
_inherit = 'product.template'

@staticmethod
def do_something_else():
pass

def action_do_something(self):
do_something_else()

Regards

아바타
취소
작성자

Thanks but there is no change.

관련 게시물 답글 화면 활동
1
3월 15
5743
0
3월 15
5451
0
5월 21
3497
2
4월 20
15576
4
3월 19
16170