[FIX] base: reniew request registry after uninstall
Install and then uninstall the utm module via the web client, you get a traceback because the ir.http override of the utm module is still present in the registry altought the module is not installed anymore. The problem affects all modules that override the _post_dispatch method of ir.http, it is not limited to UTM. The problem is that, after the uninstallation, a new registry (without the uninstalled modules) is created but the old registry was still used by the HTTP stack. closes odoo/odoo#122519 Closes: #121755 X-original-commit: 979844600a0bc5ea8b63cf4d58c7aba5133e82f3 Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
This commit is contained in:
@@ -599,6 +599,10 @@ class Module(models.Model):
|
||||
self._cr.commit()
|
||||
registry = modules.registry.Registry.new(self._cr.dbname, update_module=True)
|
||||
self._cr.commit()
|
||||
if request and request.registry is self.env.registry:
|
||||
request.env.cr.reset()
|
||||
request.registry = request.env.registry
|
||||
assert request.env.registry is registry
|
||||
self._cr.reset()
|
||||
assert self.env.registry is registry
|
||||
|
||||
|
||||
+2
-1
@@ -1723,7 +1723,8 @@ class Request:
|
||||
ir_http._authenticate(rule.endpoint)
|
||||
ir_http._pre_dispatch(rule, args)
|
||||
response = self.dispatcher.dispatch(rule.endpoint, args)
|
||||
ir_http._post_dispatch(response)
|
||||
# the registry can have been reniewed by dispatch
|
||||
self.registry['ir.http']._post_dispatch(response)
|
||||
return response
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user