Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3210 มุมมอง

Good day everyone, I stuck in testing my custom module using odoo 12. 

my_module -> models ->__init__.py(from . import sample), sample.py (_name='sample.sample')


my_module -> tests -> __init__.py(from . import test_module), test_module.py


Inside my test_module:

from odoo.tests.common import TransactionCase

import logging

_logger = logging.getLogger(__name__)


_logger.warn('Before Class')

class TestModule(TransactionCase):

        _logger.warn('Inside Class')

        def test_module(self):

            _logger.warn('Method Executed')


        def setUp(self):
            super(TestModule,self).setUp()

            _logger.warn('Method Executed in setUp')


In my run config: --addons-path="path"   --config=path -d my_db -i my_module --test-enable


When I run it, the 'Before class' and 'Inside class' displayed. Then when I tried it using odoo 10, everything works fine, but not in 12. Why the methods did not called by the system?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Did your module actually install? (This should have been a comment, but I'm only allowed to post answers).

อวตาร
ละทิ้ง

Good day, I just post in the tagged 'post_install' and the test work perfectly fine :)

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มี.ค. 23
1756
4
ส.ค. 24
6246
0
ม.ค. 24
976
0
ส.ค. 21
4
0
ก.พ. 20
4