Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
2884 Zobrazení

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
Zrušit
Autor Nejlepší odpověď

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor

Thanks but there is no change.

Related Posts Odpovědi Zobrazení Aktivita
1
bře 15
5869
0
bře 15
5573
0
kvě 21
3663
2
dub 20
15737
4
bře 19
16293