From 6341805d5ccde08f2a0e955eb3b7e668a89c2198 Mon Sep 17 00:00:00 2001 From: "Chong Wang (cwg)" Date: Thu, 30 Nov 2023 13:27:03 +0100 Subject: [PATCH] [FIX] core: avoid 'Registry' object has no attribute '_m2m' error If `setup_models` is called concurrently, the first one just delete the `registry._m2m`. then the latter one tries to access `registry._m2m`. An error 'Registry' object has no attribute '_m2m' will be raised This commit add a lock to the `setup_model` to fix the problem X-original-commit: 9ae78193f5c9ae4dcfa28c4ea4be1a7f98e42136 Part-of: odoo/odoo#146544 --- odoo/modules/registry.py | 1 + 1 file changed, 1 insertion(+) diff --git a/odoo/modules/registry.py b/odoo/modules/registry.py index 568ae14f926..620496045e4 100644 --- a/odoo/modules/registry.py +++ b/odoo/modules/registry.py @@ -273,6 +273,7 @@ class Registry(Mapping): return self.descendants(model_names, '_inherit', '_inherits') + @locked def setup_models(self, cr): """ Complete the setup of models. This must be called after loading modules and before using the ORM.