commit
f334afd1d2
|
@ -6,9 +6,8 @@ from odoo import SUPERUSER_ID, api
|
||||||
|
|
||||||
|
|
||||||
def analyse_installed_modules(cr, registry):
|
def analyse_installed_modules(cr, registry):
|
||||||
with api.Environment.manage():
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
installed_modules = env["ir.module.module"].search(
|
||||||
installed_modules = env["ir.module.module"].search(
|
["|", ("state", "=", "installed"), ("name", "=", "module_analysis")]
|
||||||
["|", ("state", "=", "installed"), ("name", "=", "module_analysis")]
|
)
|
||||||
)
|
installed_modules.button_analyse_code()
|
||||||
installed_modules.button_analyse_code()
|
|
||||||
|
|
|
@ -2,15 +2,21 @@
|
||||||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
|
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo.tests.common import TransactionCase, at_install, post_install
|
from odoo.tests.common import TransactionCase, tagged
|
||||||
|
|
||||||
|
|
||||||
@at_install(False)
|
@tagged("-at_install", "post_install")
|
||||||
@post_install(True)
|
|
||||||
class TestModule(TransactionCase):
|
class TestModule(TransactionCase):
|
||||||
def setUp(self):
|
@classmethod
|
||||||
super().setUp()
|
def setUpClass(cls):
|
||||||
self.IrModuleModule = self.env["ir.module.module"]
|
super().setUpClass()
|
||||||
|
cls.IrModuleModule = cls.env["ir.module.module"]
|
||||||
|
# Remove lib because it breaks tests in case of installation of modules with
|
||||||
|
# pip
|
||||||
|
cls.env["ir.config_parameter"].set_param(
|
||||||
|
"module_analysis.exclude_directories", "demo,test,tests,doc,description"
|
||||||
|
)
|
||||||
|
cls.IrModuleModule.cron_analyse_code()
|
||||||
|
|
||||||
def test_installed_modules(self):
|
def test_installed_modules(self):
|
||||||
installed_modules = self.IrModuleModule.search(
|
installed_modules = self.IrModuleModule.search(
|
||||||
|
|
Loading…
Reference in New Issue