Skip to Content
Menu
This question has been flagged
5719 Views

Hi

I created a very simple module with the following model:

class Dossier(models.Model):
    _name = 'juridique.dossier'
    _inherit = ['mail.thread', 'mail.activity']
    name = fields.Char(string='Nom')
    message_ids = fields.One2many('mail.message', string='Messages')
    activity_ids = fields.One2many('mail.activity', string='Activités')

Here is my juridique.dossier.view.form:

<?xml version="1.0"?>
<form string="Dossiers">
    <sheet>
      <div class="oe_title">
        <h1>
            <field name="name"/>
        </h1>
      </div>
    </sheet>
  </form>

and my herited view juridique.dossier.view.form.inherit.mail:

<?xml version="1.0"?>
<data>
      <xpath expr="//sheet" position="after">
        <div class="oe_chatter">
                        <field name="activity_ids" widget="mail_activity"/>
                        <field name="message_ids" widget="mail_thread"/>
        </div>
      </xpath>
</data>

I get an error message in trying to install my module:

No inverse field None found for 'mail.activity'

I added the mail module in the __manifest__.py (depends section):

    'depends': ['base', 'mail'],

Could you say to me what is wrong with my config?

thks a lot

Bruno

Avatar
Discard
Author

I found the solution, the inheritance in my model was wrong. here is the correct code:

class Dossier(models.Model):

_name = 'juridique.dossier'

_inherit = ['mail.thread', 'mail.activity.mixin']

name = fields.Char(string='Nom')

message_ids = fields.One2many('mail.message', string='Messages')

activity_ids = fields.One2many('mail.activity', string='Activités')