Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
4567 Visualizzazioni

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.

Avatar
Abbandona
Risposta migliore

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

Avatar
Abbandona
Autore

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 ?

Post correlati Risposte Visualizzazioni Attività
2
ott 23
2570
0
set 21
3790
0
ott 20
2643
1
apr 23
1950
0
giu 22
2575