Before this patch, if you once had one module available and, later, remove it, you'd be getting an exception when browsing its form view and trying to get its icon image. Now it gets the base module icon image, just like it should. @moduon MT-1524 closes odoo/odoo#151870 X-original-commit: 4543f45e0066814d5722acfcac3c8bc8d09b8cb1 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com> Co-authored-by: xmo-odoo <xmo@odoo.com>
23 lines
851 B
Python
23 lines
851 B
Python
from odoo.tests.common import TransactionCase
|
|
from odoo.tools import mute_logger
|
|
|
|
|
|
class IrModuleCase(TransactionCase):
|
|
@mute_logger("odoo.modules.module")
|
|
def test_missing_module_icon(self):
|
|
module = self.env["ir.module.module"].create({"name": "missing"})
|
|
base = self.env["ir.module.module"].search([("name", "=", "base")])
|
|
self.assertEqual(base.icon_image, module.icon_image)
|
|
|
|
@mute_logger("odoo.modules.module")
|
|
def test_new_module_icon(self):
|
|
module = self.env["ir.module.module"].new({"name": "missing"})
|
|
self.assertFalse(module.icon_image)
|
|
|
|
@mute_logger("odoo.modules.module")
|
|
def test_module_wrong_icon(self):
|
|
module = self.env["ir.module.module"].create(
|
|
{"name": "wrong_icon", "icon": "/not/valid.png"}
|
|
)
|
|
self.assertFalse(module.icon_image)
|