[FIX] base: skip unneeded update_list call

`update_list` is an expensive operation and could be avoided when no modules are
updated. Particually, it speeds up initial theme installation on website, which
has following code:

```
    themes.filtered(lambda m: m.state == 'installed').button_upgrade()
```

Benchmark for Odoo 15: `/website/configurator_apply` spends 1.3 sec for unneeded
`update_list` call.

closes odoo/odoo#75140

X-original-commit: 82ba4994e54fc46cc55a463629727e840349bb6e
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
This commit is contained in:
Ivan Yelizariev
2021-08-16 11:01:44 +00:00
parent 45ab7d954b
commit 99787182e4
+2
View File
@@ -663,6 +663,8 @@ class Module(models.Model):
@assert_log_admin_access
def button_upgrade(self):
if not self:
return
Dependency = self.env['ir.module.module.dependency']
self.update_list()