Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3314 Weergaven

When I create a new database and run automated tests at the same time, my method in an inherited model is not called - but when I run the tests again, it is called.

I'm using this command: odoo -d my_database -i my_module --test-enable --stop-after-init

If "my_database" does not exist, it is created and my_module is installed, but during the automated tests, my method is not called. If I run the same command once again, my method is called.

My module basically do this:

import logging
from odoo import api, models

_logger = logging.getLogger(__name__)

class MyModule(models.Model):
  _inherit = 'res.partner'

  @api.model
  def create(self, vals):
    _logger.info('Create in my_module')
    return super(MyModule, self).create(vals)

- and my test is like:

import logging
from odoo.tests.common import TransactionCase

_logger = logging.getLogger(__name__)

class TestSGMemberCalendar(TransactionCase):

  def test_my_module(self):
    partner = self.env['res.partner'].create({'name': 'Test'})
    _logger.info('Partner: %s' % partner)

However, my module is part of a more complex project, and I have not been able to reproduce the problem in a minimal module alone, so I will appreciate any ideas on how to narrow down the problem.

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
jan. 25
6540
1
apr. 24
2510
1
dec. 23
4569
2
nov. 22
3790
0
nov. 22
3641