Python代码
class chatter(models.Model):
_name = 'mail.chatter'
_inherit = ['stock.scrap','mail.thread','mail.activity.mixin','mail.alias.mixin']
_description = 'chatter for scrap form'
XML代码:
"<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>"
答案 0 :(得分:1)
您扩展的方式有误。如果需要,应该实现聊天的模型应该继承mail.thread
和其他混合。
class StockScrap(models.Model):
_name = 'stock.scrap'
_inherit = ['stock.scrap', 'mail.thread']
# and so on
您的视图扩展名几乎是正确的,但是您需要在此处再次使用正确的模型:stock.scrap
而不是mail.chatter
。