[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
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user