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

Hello!

I want to make changes in an existing test from another custom module without modifying files there. Is there is any way how to do it?

Thanks.

아바타
취소
베스트 답변

Yes we can modify existing test files with help of inheriting class and overwrite/override existing method.

Ex:If i want to alter one of test cases in sale module then i will create test file in my custom module and then inherit that class with help of import that class.

from odoo.addons.sale.tests.test_sale_order import TestSaleOrder 
@tagged('post_install', '-at_install')
class TestSaleOrderExtended(TestSaleOrder):
        //now simply write your logic here
        //You can call super to call main code and add your existing code OR you can overwrite method with your own logic

Hope it will Help
Thanks

아바타
취소
작성자

Thanks

If I do not want the super class function to be executed at all , I try to override with out calling super class method but unfortunately the super class function still executed . any solution ?

관련 게시물 답글 화면 활동
2
10월 23
2585
0
9월 21
3826
0
10월 20
2664
1
4월 23
1967
0
6월 22
2593