Search code examples
odooodoo-12

odoo chatter doesn't appear in scrap form?


Python code

 class chatter(models.Model):
       _name = 'mail.chatter'
       _inherit = ['stock.scrap','mail.thread','mail.activity.mixin','mail.alias.mixin']
       _description = 'chatter for scrap form' 

XML code:

"<record id="view_chatter_inherited" model="ir.ui.view">
         <field name="name">Chatter</field>
         <field name="model">mail.chatter</field>
         <field name="inherit_id" ref="stock.stock_scrap_form_view"/>
         <field name="arch" type="xml">
           <xpath expr="//form/sheet" position="after">
             <div class="oe_chatter">
               <field name="message_follower_ids" widget="mail_followers"/>
               <field name="activity_ids" widget="mail_activity"/>
               <field name="message_ids" widget="mail_thread"/>
             </div>
           </xpath>
         </field>
</record>"

Solution

  • You're extending the wrong way. The model which should implement the chatter, should be inheriting mail.thread and other mixins, if needed.

    class StockScrap(models.Model):
        _name = 'stock.scrap'
        _inherit = ['stock.scrap', 'mail.thread']
    
        # and so on
    

    Your view extension is nearly correct, but there you need to use the right model again: stock.scrap instead of mail.chatter.