@api.multi
def xx(self):
#code;
@api.multi
def yy(self):
#codes;
Now I want to recall function "xx" in function "yy", how shall I do this?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
@api.multi
def xx(self):
#code;
@api.multi
def yy(self):
#codes;
Now I want to recall function "xx" in function "yy", how shall I do this?
try to this code is helpful for you
def xx(self):
a=1
if a:
a=a+1
else:
raise ValidationError("somethins wrong")
return a
@api.multi
def yy(self):
self.Pro_copy=self.xx
print self.Pro_copy
output: 2
do you mean, we can't use "self.Pro_copy" in function xx?
pro_copy is a user defiend field name.self.xx function value is set to sel.pro_copy field. this is sample code.just try to understand workflow only
yes, just use self.(function name)
@api.multi
def yy(self):
self.xx
#codes;
I have tried to code like this; but xx never be executed.
@api.multi
def xx(self):
raise ValidationError("somethins wrong")
@api.multi
def yy(self):
self.xx
self.Pro_copy=self.Pro
Then the code "self.Pro_copy=self.Pro" is executed but function "xx" not executed.
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up