Skip to Content
Menu
This question has been flagged
1 Reply
4420 Views

I'm trying to add social network feature in my module. I added 'mail' dependency to `__manifest__.py`. Then inherited 'mail.thread' to model. And then added 'oe_chatter' class to views.xml.But It shows KeyError:' share'

__manifest__.py

depends = ['mail']

models.py

class MyModel(models.Model):
    _name = 'app.mymodel'
    _inherit = 'mail.thread'
     ....
     ....

views.xml

<div class="oe_chatter">
    <field name="message_follower_ids" widget="mail_followers"/>
    <field name="message_ids" widget="mail_thread"/>
</div>


Server Error

Traceback (most recent call last):
  File "/opt/odoo/odoo-10.0/odoo/http.py", line 640, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/odoo-10.0/odoo/http.py", line 677, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/odoo-10.0/odoo/http.py", line 333, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/odoo-10.0/odoo/service/model.py", line 101, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/odoo-10.0/odoo/http.py", line 326, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo/odoo-10.0/odoo/http.py", line 935, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/odoo-10.0/odoo/http.py", line 506, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/odoo-10.0/addons/web/controllers/main.py", line 889, in call_button
    action = self._call_kw(model, method, args, {})
  File "/opt/odoo/odoo-10.0/addons/web/controllers/main.py", line 877, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo-10.0/odoo/api.py", line 689, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/odoo-10.0/odoo/api.py", line 680, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/odoo-10.0/odoo/addons/base/module/module.py", line 410, in button_immediate_install
    return self._button_immediate_function(type(self).button_install)
  File "/opt/odoo/odoo-10.0/odoo/addons/base/module/module.py", line 484, in _button_immediate_function
    modules.registry.Registry.new(self._cr.dbname, update_module=True)
  File "/opt/odoo/odoo-10.0/odoo/modules/registry.py", line 82, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/opt/odoo/odoo-10.0/odoo/modules/loading.py", line 339, in load_modules
    loaded_modules, update_module)
  File "/opt/odoo/odoo-10.0/odoo/modules/loading.py", line 237, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/opt/odoo/odoo-10.0/odoo/modules/loading.py", line 135, in load_module_graph
    registry.setup_models(cr, partial=True)
  File "/opt/odoo/odoo-10.0/odoo/modules/registry.py", line 294, in setup_models
    model._setup_complete()
  File "/opt/odoo/odoo-10.0/odoo/models.py", line 2883, in _setup_complete
    field.setup_triggers(self)
  File "/opt/odoo/odoo-10.0/odoo/fields.py", line 702, in setup_triggers
    for model, field, path in self.resolve_deps(model):
  File "/opt/odoo/odoo-10.0/odoo/fields.py", line 680, in resolve_deps
    field = model._fields[fname]
KeyError: 'share'
Avatar
Discard
Best Answer

You need to inherit both 'mail.thread' and 'ir.needaction_mixin' as shown below:-

_inherit = ['mail.thread', 'ir.needaction_mixin']

Avatar
Discard

I have also used chatter in odoo 10 and inherited 'mail.thread' only and it shows error. This error is solved after adding 'ir.needaction_mixin'.

Author

Found the problem. The problem was for other piece of code. I've inherited res.partner in my model. That was the real culprit.

In odoo 10 there is no deed to inherit 'ir.needaction.mixin' with 'mail.thread'

Thanks for replay.

Related Posts Replies Views Activity
2
Dec 23
11087
3
Jul 22
20955
2
Jun 21
16960
0
Sep 20
2620
1
Mar 18
7545