[FIX] core: harden the legacy migrations package matching regex

Since odoo/odoo#122569, we now try to import the `migrations`
sub-package of each module to find upgrade tests.
However, this badly written regex match the OCA module `base_maintenance`,
which generate a RecursionError.

closes odoo/odoo#136549

X-original-commit: abd9e6686bdb1f84d67bd536d9cecda627cd001a
Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
This commit is contained in:
Christophe Simonis
2023-09-27 07:28:12 +00:00
parent b1916943d6
commit 407542b008
+1 -1
View File
@@ -68,7 +68,7 @@ class UpgradeHook(object):
"""Makes the legacy `migrations` package being `odoo.upgrade`"""
def find_module(self, name, path=None):
if re.match(r"^odoo.addons.base.maintenance.migrations\b", name):
if re.match(r"^odoo\.addons\.base\.maintenance\.migrations\b", name):
# We can't trigger a DeprecationWarning in this case.
# In order to be cross-versions, the multi-versions upgrade scripts (0.0.0 scripts),
# the tests, and the common files (utility functions) still needs to import from the