Skip to Content
Menú
This question has been flagged
2 Respostes
2866 Vistes

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



Avatar
Descartar
Autor Best Answer

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()


Avatar
Descartar
Best Answer

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

Avatar
Descartar
Autor

Thanks but there is no change.

Related Posts Respostes Vistes Activitat
1
de març 15
5862
0
de març 15
5563
0
de maig 21
3640
2
d’abr. 20
15723
4
de març 19
16276