Skip to content

Commit

Permalink
[MIG] module_analysis: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
absal-smile committed Feb 3, 2025
1 parent b52fc86 commit e8335a0
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 17 deletions.
47 changes: 39 additions & 8 deletions module_analysis/tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class TestModule(TransactionCase):
def setUpClass(cls):
super().setUpClass()
cls.IrModuleModule = cls.env["ir.module.module"]
# Remove lib because it breaks tests in case of installation of modules with
# pip
# 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"
)
Expand All @@ -28,17 +27,49 @@ def test_installed_modules(self):
or module.xml_code_qty > 0
or module.js_code_qty > 0,
_(
"module %s doesn't have code analysed defined, whereas it is"
" installed."
)
% (module.name),
"module {} doesn't have code analysed defined, "
"whereas it is installed."
).format(module.name),
)

def test_uninstalled_modules(self):
uninstalled_modules = self.IrModuleModule.search([("state", "!=", "installed")])
for module in uninstalled_modules:
self.assertTrue(
module.python_code_qty == 0,
_("module %s has python lines defined, whereas it is" " not installed.")
% (module.name),
_(
"module {} has python lines defined, whereas it is not installed."
).format(module.name),
)

def test_module_with_no_code(self):
modules_with_no_code = self.IrModuleModule.search(
[
("python_code_qty", "=", 0),
("xml_code_qty", "=", 0),
("js_code_qty", "=", 0),
]
)
for module in modules_with_no_code:
self.assertTrue(
module.state != "installed",
_("module {} has no code but is marked as installed.").format(
module.name
),
)

def test_module_with_code(self):
modules_with_code = self.IrModuleModule.search(
[
("python_code_qty", ">", 0),
("xml_code_qty", ">", 0),
("js_code_qty", ">", 0),
]
)
for module in modules_with_code:
self.assertTrue(
module.state == "installed",
_("module {} has code but is not marked as installed.").format(
module.name
),
)
6 changes: 3 additions & 3 deletions module_analysis/views/view_ir_module_author.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<record id="view_ir_module_author_tree" model="ir.ui.view">
<field name="model">ir.module.author</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="name" />
<field name="installed_module_qty" />
</tree>
</list>
</field>
</record>
<record id="action_ir_module_author" model="ir.actions.act_window">
<field name="name">Modules Authors</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.module.author</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
</record>
<menuitem
id="menu_module_authors"
Expand Down
6 changes: 3 additions & 3 deletions module_analysis/views/view_ir_module_type.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<record id="view_ir_module_type_tree" model="ir.ui.view">
<field name="model">ir.module.type</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="name" />
<field name="installed_module_qty" />
</tree>
</list>
</field>
</record>
<record id="action_ir_module_type" model="ir.actions.act_window">
<field name="name">Modules Types</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.module.type</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
</record>
<menuitem
id="menu_module_types"
Expand Down
6 changes: 3 additions & 3 deletions module_analysis/views/view_ir_module_type_rule.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<record id="view_ir_module_type_rule_tree" model="ir.ui.view">
<field name="model">ir.module.type.rule</field>
<field name="arch" type="xml">
<tree editable="bottom">
<list editable="bottom">
<field name="sequence" widget="handle" />
<field name="module_type_id" />
<field name="module_domain" />
</tree>
</list>
</field>
</record>
<record id="action_ir_module_type_rule" model="ir.actions.act_window">
<field name="name">Modules Types Rules</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.module.type.rule</field>
<field name="view_mode">tree</field>
<field name="view_mode">list</field>
</record>
<menuitem
id="menu_module_type_rules"
Expand Down

0 comments on commit e8335a0

Please sign in to comment.