Hello,
I need to run python code when opening a view
example : when i open invoice form, i need that an account.move method to be run automatically
Is there a way for that? May be a specific decorator for the method ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
I need to run python code when opening a view
example : when i open invoice form, i need that an account.move method to be run automatically
Is there a way for that? May be a specific decorator for the method ?
Hi,
Try create a boolean field on the model and mention the compute function on that field
then write a compute function without the depends decorator and include the boolean field on form view
for eg:
is_check = fields.Boolean("Check", compute="compute_is_check")
then inherit form view of account.move add the field to view. you can also make that field invisible
define compute method
def compute_is_check(self):
for record in self:
record.is_check = True
record.action_post()
Then the action_post will work when open form view.
Regards
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ý