title: New model added via Studio causes a KeyError on a computed field
body: <p>[Odoo v13 cloud edition]</p>
  <p>I've added a new model via Studio: <code>crm.lead.activities</code>. In that model I have a computed field <code>x_name</code>:</p>
  <p>Dependencies: x_res_id, x_date, x_activity_type_id</p>
  <p>Compute:</p>
  <pre><code>for record in self:
    record['x_name'] = record.x_res_id.name + ' / ' + str(record.x_date) + ' / ' + record.x_activity_type_id.name
  </code></pre>
  <p><code>x_res_id</code> is a <em>many2one</em> field to <code>crm.lead</code></p>
  <p>But when I try to (un)install a module, I get a KeyError. What can I do to solve this?</p>
  <pre><code>Odoo Server Error
  Traceback (most recent call last):
    File &quot;/home/odoo/src/odoo/13.0/odoo/http.py&quot;, line 624, in _handle_exception
      return super(JsonRequest, self)._handle_exception(exception)
    File &quot;/home/odoo/src/odoo/13.0/odoo/http.py&quot;, line 310, in _handle_exception
      raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
    File &quot;/home/odoo/src/odoo/13.0/odoo/tools/pycompat.py&quot;, line 14, in reraise
      raise value
    File &quot;/home/odoo/src/odoo/13.0/odoo/http.py&quot;, line 669, in dispatch
      result = self._call_function(**self.params)
    File &quot;/home/odoo/src/odoo/13.0/odoo/http.py&quot;, line 350, in _call_function
      return checked_call(self.db, *args, **kwargs)
    File &quot;/home/odoo/src/odoo/13.0/odoo/service/model.py&quot;, line 94, in wrapper
      return f(dbname, *args, **kwargs)
    File &quot;/home/odoo/src/odoo/13.0/odoo/http.py&quot;, line 339, in checked_call
      result = self.endpoint(*a, **kw)
    File &quot;/home/odoo/src/odoo/13.0/odoo/http.py&quot;, line 915, in __call__
      return self.method(*args, **kw)
    File &quot;/home/odoo/src/odoo/13.0/odoo/http.py&quot;, line 515, in response_wrap
      response = f(*args, **kw)
    File &quot;/home/odoo/src/odoo/13.0/addons/web/controllers/main.py&quot;, line 1326, in call_button
      action = self._call_kw(model, method, args, kwargs)
    File &quot;/home/odoo/src/odoo/13.0/addons/web/controllers/main.py&quot;, line 1314, in _call_kw
      return call_kw(request.env[model], method, args, kwargs)
    File &quot;/home/odoo/src/odoo/13.0/odoo/api.py&quot;, line 387, in call_kw
      result = _call_kw_multi(method, model, args, kwargs)
    File &quot;/home/odoo/src/odoo/13.0/odoo/api.py&quot;, line 374, in _call_kw_multi
      result = method(recs, *args, **kwargs)
    File &quot;&lt;decorator-gen-66&gt;&quot;, line 2, in button_immediate_upgrade
    File &quot;/home/odoo/src/odoo/13.0/odoo/addons/base/models/ir_module.py&quot;, line 72, in check_and_log
      return method(self, *args, **kwargs)
    File &quot;/home/odoo/src/odoo/13.0/odoo/addons/base/models/ir_module.py&quot;, line 634, in button_immediate_upgrade
      return self._button_immediate_function(type(self).button_upgrade)
    File &quot;/home/odoo/src/custom/trial/saas_trial/models/module.py&quot;, line 99, in _button_immediate_function
      res = super(IrModuleModule, self)._button_immediate_function(function)
    File &quot;/home/odoo/src/odoo/13.0/odoo/addons/base/models/ir_module.py&quot;, line 573, in _button_immediate_function
      modules.registry.Registry.new(self._cr.dbname, update_module=True)
    File &quot;/home/odoo/src/odoo/13.0/odoo/modules/registry.py&quot;, line 86, in new
      odoo.modules.load_modules(registry._db, force_demo, status, update_module)
    File &quot;/home/odoo/src/odoo/13.0/odoo/modules/loading.py&quot;, line 369, in load_modules
      registry.setup_models(cr)
    File &quot;/home/odoo/src/odoo/13.0/odoo/modules/registry.py&quot;, line 290, in setup_models
      for path in transitive_dependencies(field):
    File &quot;/home/odoo/src/odoo/13.0/odoo/modules/registry.py&quot;, line 276, in transitive_dependencies
      for seq2 in transitive_dependencies(seq1[-1], seen + [field]):
    File &quot;/home/odoo/src/odoo/13.0/odoo/modules/registry.py&quot;, line 272, in transitive_dependencies
      for seq1 in dependencies[field]:
  KeyError: x_crm.lead.activities.x_name
  </code></pre>