콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
3967 화면

I'm using post_init_hook to run a method but this method will only run once during the module installation. 

How can I make it run every time I update the odoo module?

아바타
취소
베스트 답변

Hii Tiago Rangel,

->If you want to run a method on updation of the module you can write that method in post-migration files.

->Follow below steps to achieve that.

1)Create folder named "migrations" inside your module.
2)Create subfolder inside it and name should be the version of the module which you have specified in the __manifest__.py file.
3)Create file named "post-migration.py"
4)Inside that file create a function like this.

def migrate(cr, version):
YOUR LOGIC HERE 

5)This method will execute once when the module updates.

->Note that if you change your manifest version,you need to create another folder with that version name and do the same process. 

->You can refer following link for your reference-https://odoo-development.readthedocs.io/en/latest/maintenance/data-migration.html

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

아바타
취소
관련 게시물 답글 화면 활동
2
8월 25
3396
1
7월 25
1567
1
8월 25
1152
0
5월 25
1893
2
4월 25
4175