コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
4580 ビュー

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
2575
0
9月 21
3812
0
10月 20
2652
1
4月 23
1959
0
6月 22
2581