From 2a981e6a561f572742202d9c964d3b1f3aecacf9 Mon Sep 17 00:00:00 2001
From: Christophe Simonis <chs@odoo.com>
Date: Wed, 10 May 2023 13:36:06 +0000
Subject: [PATCH] [FIX] core: ensure `odoo.upgrade` __path__ contains real
 directories

mimic what is done for `odoo.addons` __path__.

closes odoo/odoo#121045

Signed-off-by: Christophe Simonis <chs@odoo.com>
---
 odoo/modules/module.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/odoo/modules/module.py b/odoo/modules/module.py
index c43f6a921eb7..dda40b6a8dc0 100644
--- a/odoo/modules/module.py
+++ b/odoo/modules/module.py
@@ -158,7 +158,7 @@ def initialize_sys_path():
     legacy_upgrade_path = os.path.join(base_path, 'base', 'maintenance', 'migrations')
     for up in (tools.config['upgrade_path'] or legacy_upgrade_path).split(','):
         up = os.path.normcase(os.path.abspath(tools.ustr(up.strip())))
-        if up not in upgrade.__path__:
+        if os.path.isdir(up) and up not in upgrade.__path__:
             upgrade.__path__.append(up)
 
     # create decrecated module alias from odoo.addons.base.maintenance.migrations to odoo.upgrade
-- 
GitLab