@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.
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký