Skip to Content
मेन्यू
This question has been flagged
2 Replies
2871 Views

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
Discard
Author 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
Discard
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
Discard
Author

Thanks but there is no change.

Related Posts Replies Views Activity
1
मार्च 15
5864
0
मार्च 15
5570
0
मई 21
3650
2
अप्रैल 20
15728
4
मार्च 19
16279